aboutsummaryrefslogtreecommitdiffstats
path: root/markdown.py
diff options
context:
space:
mode:
authorYuri Takhteyev <yuri@freewisdom.org>2007-03-19 02:37:37 +0000
committerYuri Takhteyev <yuri@freewisdom.org>2007-03-19 02:37:37 +0000
commitf74f4e1be915d6019c2c4acbd70cc7bfb49f7c85 (patch)
tree8553a53923f7fef9544c0375c88864174f626eba /markdown.py
parent56cf5f0beaa82d78d6a9b13af545dd099e095ccf (diff)
downloadmarkdown-f74f4e1be915d6019c2c4acbd70cc7bfb49f7c85.tar.gz
markdown-f74f4e1be915d6019c2c4acbd70cc7bfb49f7c85.tar.bz2
markdown-f74f4e1be915d6019c2c4acbd70cc7bfb49f7c85.zip
Changed the default conversion method to pass the text to the convert()
method (was "toString()") rather than to the constructor. The idea is to get rid of the parameter in the constructor later, so that the standard pattern would be: markdown.Markdown().convert(text) rather than str(markdown.Markdown(text))
Diffstat (limited to 'markdown.py')
-rw-r--r--markdown.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/markdown.py b/markdown.py
index 4d1eeaf..b368d08 100644
--- a/markdown.py
+++ b/markdown.py
@@ -942,7 +942,7 @@ class Markdown:
Markdown text """
- def __init__(self, source=None,
+ def __init__(self, source=None, # deprecated
extensions=[],
extension_configs=None,
encoding=None,
@@ -1496,7 +1496,7 @@ class Markdown:
else :
return None
- def __str__(self, source = None):
+ def convert (self, source = None):
"""Return the document in XHTML format.
@returns: A serialized XHTML body."""
@@ -1534,7 +1534,10 @@ class Markdown:
return self.docType + xml
- toString = __str__
+ __str__ = convert # deprecated - will be changed in 1.7 to report
+ # information about the MD instance
+
+ toString = __str__ # toString() method is deprecated
def __unicode__(self):
@@ -1543,7 +1546,7 @@ class Markdown:
return str(self)#.decode(self.encoding)
- toUnicode = __unicode__
+ toUnicode = __unicode__ # deprecated - will be removed in 1.7
@@ -1602,11 +1605,11 @@ def markdown(text,
extension_configs[name] = configs
#print configs
- md = Markdown(text, extensions=extension_names,
+ md = Markdown(extensions=extension_names,
extension_configs=extension_configs,
safe_mode = safe_mode)
- return md.toString()
+ return md.convert(text)
class Extension :