columns.
If there are multiple blank lines in a row, then the output should
-contain only one blank line.
+contain only one blank line. If there are blank lines at the end of
+the file, they should be removed.
Trailing spaces on lines should be removed.
Paragraphs should have a blank line between them.
-List entries are lines that start with "* " or "- ". They should be
-wrapped individually. That is, each list entry should be word wrapped
-all by itself, and should not include text from other list entries.
-If a list entry spans multiple lines, the second line should be
-indented another 2 spaces, so that it is aligned with the text, and
-not with the leading "* ".
+List entries are lines that start with "* " ("** " or "*** "), or "-
+". They should be wrapped individually. That is, each list entry
+should be word wrapped all by itself, and should not include text from
+other list entries. If a list entry spans multiple lines, the second
+line should be indented another 2 spaces, so that it is aligned with
+the text, and not with the leading "* ".
Numbered list entries are lines that start with a number, followed by
a dot. e.g. "1.". Those list entries should be word wrapped just
- Lines that start with "[" (e.g. "[NOTE]", "[source,c]") are left
unchanged on their own line.
- Lines starting with "|" (tables) are left unchanged.
- - List entries begin with "* " or "- ", or with a number followed by
- "." (e.g. "1."). Each entry is wrapped on its own; continuation
- lines are indented so they align with the text after the marker.
- For numbered entries the leading number is preserved as-is.
+ - List entries begin with one to four "*" markers ("* ", "** ",
+ "*** ", "**** "), with "- ", or with a number followed by "."
+ (e.g. "1."). Each entry is wrapped on its own; continuation lines
+ are indented so they align with the text after the marker. For
+ numbered entries the leading number is preserved as-is.
$Id$
"""
return line.lstrip().startswith("//")
-_LIST_MARKER_RE = re.compile(r"^(?:[*-]|\d+\.)\s+")
+_LIST_MARKER_RE = re.compile(r"^(?:\*{1,4}|-|\d+\.)\s+")
def list_marker_len(line):