Browse Source

Added the possibility to pass a macro filter to the render methods

make_mycreole_indenpendent_from_patt
Dirk Alders 2 months ago
parent
commit
2abea3c4ae
1 changed files with 5 additions and 5 deletions
  1. 5
    5
      __init__.py

+ 5
- 5
__init__.py View File

22
     return creole.creole2html(MYCREOLE_HELP)
22
     return creole.creole2html(MYCREOLE_HELP)
23
 
23
 
24
 
24
 
25
-def render_simple(text):
26
-    return creole.creole2html(text)
25
+def render_simple(text, macros=None):
26
+    return creole.creole2html(text, macros=macros)
27
 
27
 
28
 
28
 
29
-def render(request, text, attachment_target_path, next_anchor=''):
29
+def render(request, text, attachment_target_path, next_anchor='', macros=None):
30
     def get_attachment_name(text, state):
30
     def get_attachment_name(text, state):
31
         end_idx = text.index(']]' if state == '[' else '}}')
31
         end_idx = text.index(']]' if state == '[' else '}}')
32
         try:
32
         try:
84
                 else:
84
                 else:
85
                     render_txt += '[[%s|Upload]]' % url_upload(request, rel_path, next_anchor)
85
                     render_txt += '[[%s|Upload]]' % url_upload(request, rel_path, next_anchor)
86
                     text = text[text.index(']]' if state == '[' else '}}') + 2:]
86
                     text = text[text.index(']]' if state == '[' else '}}') + 2:]
87
-        return creole.creole2html(render_txt)
87
+        return creole.creole2html(render_txt, macros=macros)
88
     except:
88
     except:
89
-        return creole.creole2html(text)
89
+        return creole.creole2html(text, macros=macros)
90
 
90
 
91
 
91
 
92
 def url_delete(request, rel_path, next_anchor=''):
92
 def url_delete(request, rel_path, next_anchor=''):

Loading…
Cancel
Save