1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/tests/test_links.txt Tue Jun 11 14:19:17 2013 +0200
1.3 @@ -0,0 +1,7 @@
1.4 +A normal [link] and a \[non-link\].
1.5 +
1.6 +* A [link] in a list.
1.7 +** A \[non-link\] in a list.
1.8 +
1.9 +|| [link] || \[non-link\] ||
1.10 +| [link] | \[non-link\] |
2.1 --- a/tests/test_macros.txt Tue Jun 11 01:36:57 2013 +0200
2.2 +++ b/tests/test_macros.txt Tue Jun 11 14:19:17 2013 +0200
2.3 @@ -1,3 +1,5 @@
2.4 +{toc}
2.5 +
2.6 This is a test of {color:red}colours{color}.
2.7
2.8 {code}sections featuring code{code}
3.1 --- a/wikiparser.py Tue Jun 11 01:36:57 2013 +0200
3.2 +++ b/wikiparser.py Tue Jun 11 14:19:17 2013 +0200
3.3 @@ -278,9 +278,9 @@
3.4 # Content inspection.
3.5
3.6 monospace_regexp_str = r"{{(?P<monotext>.*?)}}"
3.7 -link_regexp_str = r"[[](?P<linktext>.*?)]"
3.8 +link_regexp_str = r"(?<!\\)[[](?P<linktext>.*?)]"
3.9 image_regexp_str = r"!(?P<imagetext>\w.*?)!"
3.10 -macro_regexp_str = r"{(?P<macro>.*?):(?P<options>.*?)}"
3.11 +macro_regexp_str = r"{(?P<macro>.*?)(?::(?P<options>.*?))?}"
3.12
3.13 # Word-dependent patterns.
3.14 # Here, the unbracketed markers must test for the absence of surrounding word
3.15 @@ -367,6 +367,9 @@
3.16 (r"\\""\n", "<<BR>>"),
3.17 (r"\\ ", "<<BR>>"),
3.18 (r"\~", "~"),
3.19 + (r"\[", "<<Verbatim([)>>"),
3.20 + (r"\]", "<<Verbatim(])>>"),
3.21 + (r"\*", "*"),
3.22 ]
3.23
3.24 preformatted_notation_mapping = [
3.25 @@ -397,6 +400,7 @@
3.26
3.27 sectiontypes = {
3.28 "code" : "",
3.29 + "excerpt" : "#!wiki",
3.30 "noformat" : "",
3.31 "quote" : "",
3.32 "info" : "#!wiki important",
3.33 @@ -414,6 +418,7 @@
3.34 macrotypes = {
3.35 "anchor" : "<<Anchor(%(args)s)>>",
3.36 "color" : "<<Color2(%(content)s, %(args)s)>>",
3.37 + "toc" : "<<TableOfContents(%(args)s)>>",
3.38 }
3.39
3.40 class ConfluenceParser:
3.41 @@ -527,7 +532,7 @@
3.42 if macrotypes.has_key(macro_name):
3.43 argname = macroargs.get(macro_name)
3.44 result = macrotypes[macro_name] % {
3.45 - "args" : quote_macro_argument((argname and ("%s=" % argname) or "") + match.group("options"))
3.46 + "args" : quote_macro_argument((argname and ("%s=" % argname) or "") + (match.group("options") or ""))
3.47 }
3.48 if not self.forbids_macros():
3.49 return result
3.50 @@ -622,7 +627,7 @@
3.51
3.52 # Enter the table.
3.53
3.54 - self.enter_section()
3.55 + self.enter_section("table")
3.56
3.57 table_parts = []
3.58 first = True