aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaylan Limberg <waylan.limberg@icloud.com>2014-06-16 21:13:04 -0400
committerWaylan Limberg <waylan.limberg@icloud.com>2014-06-16 21:13:04 -0400
commit51857fd458c991a10c7a9d8797ba8fb03af2f4d8 (patch)
treef60956de7b2875f3eb3db78875e669f2c00f1433
parenta6307cd48979860cc929ef7e7e402941d9f993e8 (diff)
parent580712a84f973458ac82958c63661bfa7b709df6 (diff)
downloadmarkdown-51857fd458c991a10c7a9d8797ba8fb03af2f4d8.tar.gz
markdown-51857fd458c991a10c7a9d8797ba8fb03af2f4d8.tar.bz2
markdown-51857fd458c991a10c7a9d8797ba8fb03af2f4d8.zip
Merge pull request #317 from mitya57/doctests
Python 3.4 and fixes for doctests
-rw-r--r--.travis.yml1
-rw-r--r--markdown/extensions/abbr.py2
-rw-r--r--markdown/extensions/fenced_code.py20
-rw-r--r--markdown/extensions/headerid.py12
-rw-r--r--markdown/extensions/meta.py8
-rw-r--r--markdown/extensions/nl2br.py2
-rw-r--r--markdown/extensions/smart_strong.py12
-rw-r--r--markdown/extensions/wikilinks.py18
-rw-r--r--tox.ini2
9 files changed, 39 insertions, 38 deletions
diff --git a/.travis.yml b/.travis.yml
index 22a5855..1f07f39 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -4,6 +4,7 @@ env:
- TOXENV=py27
- TOXENV=py32
- TOXENV=py33
+ - TOXENV=py34
before_install:
- sudo apt-get update -qq
- sudo apt-get install libtidy-0.99-0
diff --git a/markdown/extensions/abbr.py b/markdown/extensions/abbr.py
index 3f8a443..bed3bb4 100644
--- a/markdown/extensions/abbr.py
+++ b/markdown/extensions/abbr.py
@@ -13,7 +13,7 @@ Simple Usage:
... *[ABBR]: Abbreviation
... *[REF]: Abbreviation Reference
... """
- >>> print markdown.markdown(text, ['abbr'])
+ >>> print(markdown.markdown(text, ['abbr']))
<p>Some text with an <abbr title="Abbreviation">ABBR</abbr> and a <abbr title="Abbreviation Reference">REF</abbr>. Ignore REFERENCE and ref.</p>
Copyright 2007-2008
diff --git a/markdown/extensions/fenced_code.py b/markdown/extensions/fenced_code.py
index d6e043c..fe1559c 100644
--- a/markdown/extensions/fenced_code.py
+++ b/markdown/extensions/fenced_code.py
@@ -13,14 +13,14 @@ This extension adds Fenced Code Blocks to Python-Markdown.
... ~~~
... '''
>>> html = markdown.markdown(text, extensions=['fenced_code'])
- >>> print html
+ >>> print(html)
<p>A paragraph before a fenced code block:</p>
<pre><code>Fenced code block
</code></pre>
Works with safe_mode also (we check this because we are using the HtmlStash):
- >>> print markdown.markdown(text, extensions=['fenced_code'], safe_mode='replace')
+ >>> print(markdown.markdown(text, extensions=['fenced_code'], safe_mode='replace'))
<p>A paragraph before a fenced code block:</p>
<pre><code>Fenced code block
</code></pre>
@@ -32,7 +32,7 @@ Include tilde's in a code block and wrap with blank lines:
...
... ~~~~
... ~~~~~~~~'''
- >>> print markdown.markdown(text, extensions=['fenced_code'])
+ >>> print(markdown.markdown(text, extensions=['fenced_code']))
<pre><code>
~~~~
</code></pre>
@@ -43,7 +43,7 @@ Language tags:
... ~~~~{.python}
... # Some python code
... ~~~~'''
- >>> print markdown.markdown(text, extensions=['fenced_code'])
+ >>> print(markdown.markdown(text, extensions=['fenced_code']))
<pre><code class="python"># Some python code
</code></pre>
@@ -54,7 +54,7 @@ Optionally backticks instead of tildes as per how github's code block markdown i
... # Arbitrary code
... ~~~~~ # these tildes will not close the block
... `````'''
- >>> print markdown.markdown(text, extensions=['fenced_code'])
+ >>> print(markdown.markdown(text, extensions=['fenced_code']))
<pre><code># Arbitrary code
~~~~~ # these tildes will not close the block
</code></pre>
@@ -67,11 +67,11 @@ If the codehighlite extension and Pygments are installed, lines can be highlight
... line 2
... line 3
... ```'''
- >>> print markdown.markdown(text, extensions=['codehilite', 'fenced_code'])
- <pre><code><span class="hilight">line 1</span>
- line 2
- <span class="hilight">line 3</span>
- </code></pre>
+ >>> print(markdown.markdown(text, extensions=['codehilite', 'fenced_code']))
+ <div class="codehilite"><pre><span class="hll"><span class="n">line</span> <span class="mi">1</span>
+ </span><span class="n">line</span> <span class="mi">2</span>
+ <span class="hll"><span class="n">line</span> <span class="mi">3</span>
+ </span></pre></div>
Copyright 2007-2008 [Waylan Limberg](http://achinghead.com/).
diff --git a/markdown/extensions/headerid.py b/markdown/extensions/headerid.py
index 8221fe1..07351cc 100644
--- a/markdown/extensions/headerid.py
+++ b/markdown/extensions/headerid.py
@@ -9,7 +9,7 @@ Basic usage:
>>> import markdown
>>> text = "# Some Header #"
>>> md = markdown.markdown(text, ['headerid'])
- >>> print md
+ >>> print(md)
<h1 id="some-header">Some Header</h1>
All header IDs are unique:
@@ -19,7 +19,7 @@ All header IDs are unique:
... #Header
... #Header'''
>>> md = markdown.markdown(text, ['headerid'])
- >>> print md
+ >>> print(md)
<h1 id="header">Header</h1>
<h1 id="header_1">Header</h1>
<h1 id="header_2">Header</h1>
@@ -30,7 +30,7 @@ To fit within a html template's hierarchy, set the header base level:
... #Some Header
... ## Next Level'''
>>> md = markdown.markdown(text, ['headerid(level=3)'])
- >>> print md
+ >>> print(md)
<h3 id="some-header">Some Header</h3>
<h4 id="next-level">Next Level</h4>
@@ -38,7 +38,7 @@ Works with inline markup.
>>> text = '#Some *Header* with [markup](http://example.com).'
>>> md = markdown.markdown(text, ['headerid'])
- >>> print md
+ >>> print(md)
<h1 id="some-header-with-markup">Some <em>Header</em> with <a href="http://example.com">markup</a>.</h1>
Turn off auto generated IDs:
@@ -47,7 +47,7 @@ Turn off auto generated IDs:
... # Some Header
... # Another Header'''
>>> md = markdown.markdown(text, ['headerid(forceid=False)'])
- >>> print md
+ >>> print(md)
<h1>Some Header</h1>
<h1>Another Header</h1>
@@ -58,7 +58,7 @@ Use with MetaData extension:
...
... # A Header'''
>>> md = markdown.markdown(text, ['headerid', 'meta'])
- >>> print md
+ >>> print(md)
<h2>A Header</h2>
Copyright 2007-2011 [Waylan Limberg](http://achinghead.com/).
diff --git a/markdown/extensions/meta.py b/markdown/extensions/meta.py
index c4a4b21..9063188 100644
--- a/markdown/extensions/meta.py
+++ b/markdown/extensions/meta.py
@@ -15,16 +15,16 @@ Basic Usage:
... The body. This is paragraph one.
... '''
>>> md = markdown.Markdown(['meta'])
- >>> print md.convert(text)
+ >>> print(md.convert(text))
<p>The body. This is paragraph one.</p>
- >>> print md.Meta
- {u'blank_data': [u''], u'author': [u'Waylan Limberg', u'John Doe'], u'title': [u'A Test Doc.']}
+ >>> print(md.Meta) # doctest: +SKIP
+ {'blank_data': [''], 'author': ['Waylan Limberg', 'John Doe'], 'title': ['A Test Doc.']}
Make sure text without Meta Data still works (markdown < 1.6b returns a <p>).
>>> text = ' Some Code - not extra lines of meta data.'
>>> md = markdown.Markdown(['meta'])
- >>> print md.convert(text)
+ >>> print(md.convert(text))
<pre><code>Some Code - not extra lines of meta data.
</code></pre>
>>> md.Meta
diff --git a/markdown/extensions/nl2br.py b/markdown/extensions/nl2br.py
index da4b339..028561c 100644
--- a/markdown/extensions/nl2br.py
+++ b/markdown/extensions/nl2br.py
@@ -8,7 +8,7 @@ GitHub-flavored Markdown does.
Usage:
>>> import markdown
- >>> print markdown.markdown('line 1\\nline 2', extensions=['nl2br'])
+ >>> print(markdown.markdown('line 1\\nline 2', extensions=['nl2br']))
<p>line 1<br />
line 2</p>
diff --git a/markdown/extensions/smart_strong.py b/markdown/extensions/smart_strong.py
index 4818cf9..c7ac9f1 100644
--- a/markdown/extensions/smart_strong.py
+++ b/markdown/extensions/smart_strong.py
@@ -7,14 +7,14 @@ This extention adds smarter handling of double underscores within words.
Simple Usage:
>>> import markdown
- >>> print markdown.markdown('Text with double__underscore__words.',
- ... extensions=['smart_strong'])
+ >>> print(markdown.markdown('Text with double__underscore__words.',
+ ... extensions=['smart_strong']))
<p>Text with double__underscore__words.</p>
- >>> print markdown.markdown('__Strong__ still works.',
- ... extensions=['smart_strong'])
+ >>> print(markdown.markdown('__Strong__ still works.',
+ ... extensions=['smart_strong']))
<p><strong>Strong</strong> still works.</p>
- >>> print markdown.markdown('__this__works__too__.',
- ... extensions=['smart_strong'])
+ >>> print(markdown.markdown('__this__works__too__.',
+ ... extensions=['smart_strong']))
<p><strong>this__works__too</strong>.</p>
Copyright 2011
diff --git a/markdown/extensions/wikilinks.py b/markdown/extensions/wikilinks.py
index ba1947c..6d34173 100644
--- a/markdown/extensions/wikilinks.py
+++ b/markdown/extensions/wikilinks.py
@@ -9,21 +9,21 @@ Basic usage:
>>> import markdown
>>> text = "Some text with a [[WikiLink]]."
>>> html = markdown.markdown(text, ['wikilinks'])
- >>> print html
+ >>> print(html)
<p>Some text with a <a class="wikilink" href="/WikiLink/">WikiLink</a>.</p>
Whitespace behavior:
- >>> print markdown.markdown('[[ foo bar_baz ]]', ['wikilinks'])
+ >>> 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'])
+ >>> print(markdown.markdown('foo [[ ]] bar', ['wikilinks']))
<p>foo bar</p>
To define custom settings the simple way:
- >>> print markdown.markdown(text,
+ >>> print(markdown.markdown(text,
... ['wikilinks(base_url=/wiki/,end_url=.html,html_class=foo)']
- ... )
+ ... ))
<p>Some text with a <a class="foo" href="/wiki/WikiLink.html">WikiLink</a>.</p>
Custom settings the complex way:
@@ -35,7 +35,7 @@ Custom settings the complex way:
... ('end_url', '.html'),
... ('html_class', '') ]},
... safe_mode = True)
- >>> print md.convert(text)
+ >>> 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):
@@ -46,12 +46,12 @@ Use MetaData with mdx_meta.py (Note the blank html_class in MetaData):
...
... Some text with a [[WikiLink]]."""
>>> md = markdown.Markdown(extensions=['meta', 'wikilinks'])
- >>> print md.convert(text)
+ >>> 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:
- >>> print md.convert("No [[MetaData]] here.")
+ >>> print(md.convert("No [[MetaData]] here."))
<p>No <a class="wikilink" href="/MetaData/">MetaData</a> here.</p>
Define a custom URL builder:
@@ -60,7 +60,7 @@ Define a custom URL builder:
... return '/bar/'
>>> md = markdown.Markdown(extensions=['wikilinks'],
... extension_configs={'wikilinks' : [('build_url', my_url_builder)]})
- >>> print md.convert('[[foo]]')
+ >>> print(md.convert('[[foo]]'))
<p><a class="wikilink" href="/bar/">foo</a></p>
From the command line:
diff --git a/tox.ini b/tox.ini
index fc2207a..c10eef8 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,5 +1,5 @@
[tox]
-envlist = py26, py27, py31, py32, py33
+envlist = py26, py27, py31, py32, py33, py34
[testenv]
downloadcache = {toxworkdir}/cache