aboutsummaryrefslogtreecommitdiffstats
path: root/markdown/extensions/wikilinks.py
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2011-08-02 09:23:49 -0400
committerWaylan Limberg <waylan@gmail.com>2011-08-02 09:23:49 -0400
commit7af553173629d8d8e36e71fbf2753dc8d6fe11d3 (patch)
treeb9f2460776fe98511f3c713b5ae5fd5b3899bfaf /markdown/extensions/wikilinks.py
parent447e238186f30f3480afadb68aaf5efa4f6dfc9e (diff)
downloadmarkdown-7af553173629d8d8e36e71fbf2753dc8d6fe11d3.tar.gz
markdown-7af553173629d8d8e36e71fbf2753dc8d6fe11d3.tar.bz2
markdown-7af553173629d8d8e36e71fbf2753dc8d6fe11d3.zip
Added doctests to fabfile and edited them to pass in all supported versions of python. Note: one test (meta) is still failing on Python 3 due to unicode strings.
Diffstat (limited to 'markdown/extensions/wikilinks.py')
-rw-r--r--markdown/extensions/wikilinks.py32
1 files changed, 16 insertions, 16 deletions
diff --git a/markdown/extensions/wikilinks.py b/markdown/extensions/wikilinks.py
index cf4b633..af43bba 100644
--- a/markdown/extensions/wikilinks.py
+++ b/markdown/extensions/wikilinks.py
@@ -11,22 +11,22 @@ Basic usage:
>>> import markdown
>>> text = "Some text with a [[WikiLink]]."
>>> html = markdown.markdown(text, ['wikilinks'])
- >>> html
- u'<p>Some text with a <a class="wikilink" href="/WikiLink/">WikiLink</a>.</p>'
+ >>> print html
+ <p>Some text with a <a class="wikilink" href="/WikiLink/">WikiLink</a>.</p>
Whitespace behavior:
- >>> markdown.markdown('[[ foo bar_baz ]]', ['wikilinks'])
- u'<p><a class="wikilink" href="/foo_bar_baz/">foo bar_baz</a></p>'
- >>> markdown.markdown('foo [[ ]] bar', ['wikilinks'])
- u'<p>foo bar</p>'
+ >>> print markdown.markdown('[[ foo bar_baz ]]', ['wikilinks'])
+ <p><a class="wikilink" href="/foo_bar_baz/">foo bar_baz</a></p>
+ >>> print markdown.markdown('foo [[ ]] bar', ['wikilinks'])
+ <p>foo bar</p>
To define custom settings the simple way:
- >>> markdown.markdown(text,
+ >>> print markdown.markdown(text,
... ['wikilinks(base_url=/wiki/,end_url=.html,html_class=foo)']
... )
- u'<p>Some text with a <a class="foo" href="/wiki/WikiLink.html">WikiLink</a>.</p>'
+ <p>Some text with a <a class="foo" href="/wiki/WikiLink.html">WikiLink</a>.</p>
Custom settings the complex way:
@@ -37,8 +37,8 @@ Custom settings the complex way:
... ('end_url', '.html'),
... ('html_class', '') ]},
... safe_mode = True)
- >>> md.convert(text)
- u'<p>Some text with a <a href="http://example.com/WikiLink.html">WikiLink</a>.</p>'
+ >>> print md.convert(text)
+ <p>Some text with a <a href="http://example.com/WikiLink.html">WikiLink</a>.</p>
Use MetaData with mdx_meta.py (Note the blank html_class in MetaData):
@@ -48,13 +48,13 @@ Use MetaData with mdx_meta.py (Note the blank html_class in MetaData):
...
... Some text with a [[WikiLink]]."""
>>> md = markdown.Markdown(extensions=['meta', 'wikilinks'])
- >>> md.convert(text)
- u'<p>Some text with a <a href="http://example.com/WikiLink.html">WikiLink</a>.</p>'
+ >>> print md.convert(text)
+ <p>Some text with a <a href="http://example.com/WikiLink.html">WikiLink</a>.</p>
MetaData should not carry over to next document:
- >>> md.convert("No [[MetaData]] here.")
- u'<p>No <a class="wikilink" href="/MetaData/">MetaData</a> here.</p>'
+ >>> print md.convert("No [[MetaData]] here.")
+ <p>No <a class="wikilink" href="/MetaData/">MetaData</a> here.</p>
Define a custom URL builder:
@@ -62,8 +62,8 @@ Define a custom URL builder:
... return '/bar/'
>>> md = markdown.Markdown(extensions=['wikilinks'],
... extension_configs={'wikilinks' : [('build_url', my_url_builder)]})
- >>> md.convert('[[foo]]')
- u'<p><a class="wikilink" href="/bar/">foo</a></p>'
+ >>> print md.convert('[[foo]]')
+ <p><a class="wikilink" href="/bar/">foo</a></p>
From the command line: