Commit 4d34e70b by tschmidt-dev

fixed macro arg regex for args longer than 1 character

parent 7e6da88b
...@@ -10,7 +10,7 @@ from django.template import Context ...@@ -10,7 +10,7 @@ from django.template import Context
re_sq_short = r"'([^'\\]*(?:\\.[^'\\]*)*)'" re_sq_short = r"'([^'\\]*(?:\\.[^'\\]*)*)'"
MACRO_RE = re.compile(r'.*(\[(?P<macro>\w+)(?P<kwargs>\s\w+\:.+)*\]).*', re.IGNORECASE) MACRO_RE = re.compile(r'.*(\[(?P<macro>\w+)(?P<kwargs>\s\w+\:.+)*\]).*', re.IGNORECASE)
KWARG_RE = re.compile(r'\s*(?P<arg>\w+)(:(?P<value>([^\']|%s)))?' % re_sq_short, re.IGNORECASE) KWARG_RE = re.compile(r'\s*(?P<arg>\w+)(:(?P<value>([^\']+|%s)))?' % re_sq_short, re.IGNORECASE)
from wiki.plugins.macros import settings from wiki.plugins.macros import settings
...@@ -54,6 +54,7 @@ class MacroPreprocessor(markdown.preprocessors.Preprocessor): ...@@ -54,6 +54,7 @@ class MacroPreprocessor(markdown.preprocessors.Preprocessor):
value = value.replace(u"\\", u"") value = value.replace(u"\\", u"")
value = value.replace(u"¤KEEPME¤", u"\\") value = value.replace(u"¤KEEPME¤", u"\\")
kwargs_dict[arg] = value kwargs_dict[arg] = value
print kwargs_dict
line = getattr(self, macro)(**kwargs_dict) line = getattr(self, macro)(**kwargs_dict)
else: else:
line = getattr(self, macro)() line = getattr(self, macro)()
...@@ -62,6 +63,7 @@ class MacroPreprocessor(markdown.preprocessors.Preprocessor): ...@@ -62,6 +63,7 @@ class MacroPreprocessor(markdown.preprocessors.Preprocessor):
return new_text return new_text
def article_list(self, depth=2): def article_list(self, depth=2):
print depth
html = render_to_string( html = render_to_string(
"wiki/plugins/macros/article_list.html", "wiki/plugins/macros/article_list.html",
Context({ Context({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment