From 5366b6908de0daa389ac514eb92c8db3e04148db Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Sun, 29 Aug 2010 00:22:28 -0400 Subject: Wrapper functions now accept any arguments also accepted by the class, rather than a limited subset. They are also more future proof. By using *args and **kwargs, we should not need to update them if we add/change any arguments or keywords on the class. --- markdown/__init__.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/markdown/__init__.py b/markdown/__init__.py index 57708fe..1375523 100644 --- a/markdown/__init__.py +++ b/markdown/__init__.py @@ -335,10 +335,7 @@ Those are the two functions we really mean to export: markdown() and markdownFromFile(). """ -def markdown(text, - extensions = [], - safe_mode = False, - output_format = 'xhtml1'): +def markdown(text, *args, **kwargs): """Convert a markdown string to HTML and return HTML as a unicode string. This is a shortcut function for `Markdown` class to cover the most @@ -362,9 +359,7 @@ def markdown(text, Returns: An HTML document as a string. """ - md = Markdown(extensions=extensions, - safe_mode=safe_mode, - output_format=output_format) + md = Markdown(*args, **kwargs) return md.convert(text) @@ -372,12 +367,9 @@ def markdownFromFile(input = None, output = None, extensions = [], encoding = None, - safe_mode = False, - output_format = 'xhtml1'): + *args, **kwargs): """Read markdown code from a file and write it to a file or a stream.""" - md = Markdown(extensions=extensions, - safe_mode=safe_mode, - output_format=output_format) + md = Markdown(extensions=extensions, *args, **kwargs) md.convertFile(input, output, encoding) -- cgit v1.2.3