From 580712a84f973458ac82958c63661bfa7b709df6 Mon Sep 17 00:00:00 2001 From: Dmitry Shachnev Date: Sun, 8 Jun 2014 16:19:04 +0400 Subject: Make doctests support Python 3 --- markdown/extensions/abbr.py | 2 +- markdown/extensions/fenced_code.py | 12 ++++++------ markdown/extensions/headerid.py | 12 ++++++------ markdown/extensions/meta.py | 8 ++++---- markdown/extensions/nl2br.py | 2 +- markdown/extensions/smart_strong.py | 12 ++++++------ markdown/extensions/wikilinks.py | 18 +++++++++--------- 7 files changed, 33 insertions(+), 33 deletions(-) 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']))

Some text with an ABBR and a REF. Ignore REFERENCE and ref.

Copyright 2007-2008 diff --git a/markdown/extensions/fenced_code.py b/markdown/extensions/fenced_code.py index 0bbd9e0..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)

A paragraph before a fenced code block:

Fenced code block
     
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'))

A paragraph before a fenced code block:

Fenced code block
     
@@ -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']))

     ~~~~
     
@@ -43,7 +43,7 @@ Language tags: ... ~~~~{.python} ... # Some python code ... ~~~~''' - >>> print markdown.markdown(text, extensions=['fenced_code']) + >>> print(markdown.markdown(text, extensions=['fenced_code']))
# Some python code
     
@@ -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']))
# Arbitrary code
     ~~~~~ # these tildes will not close the block
     
@@ -67,7 +67,7 @@ If the codehighlite extension and Pygments are installed, lines can be highlight ... line 2 ... line 3 ... ```''' - >>> print markdown.markdown(text, extensions=['codehilite', 'fenced_code']) + >>> print(markdown.markdown(text, extensions=['codehilite', 'fenced_code']))
line 1
     line 2
     line 3
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)
     

Some Header

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)

Header

Header

Header

@@ -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)

Some Header

Next Level

@@ -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)

Some Header with markup.

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)

Some Header

Another Header

@@ -58,7 +58,7 @@ Use with MetaData extension: ... ... # A Header''' >>> md = markdown.markdown(text, ['headerid', 'meta']) - >>> print md + >>> print(md)

A Header

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))

The body. This is paragraph one.

- >>> 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

). >>> text = ' Some Code - not extra lines of meta data.' >>> md = markdown.Markdown(['meta']) - >>> print md.convert(text) + >>> print(md.convert(text))

Some Code - not extra lines of meta data.
     
>>> 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']))

line 1
line 2

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']))

Text with double__underscore__words.

- >>> print markdown.markdown('__Strong__ still works.', - ... extensions=['smart_strong']) + >>> print(markdown.markdown('__Strong__ still works.', + ... extensions=['smart_strong']))

Strong still works.

- >>> print markdown.markdown('__this__works__too__.', - ... extensions=['smart_strong']) + >>> print(markdown.markdown('__this__works__too__.', + ... extensions=['smart_strong']))

this__works__too.

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)

Some text with a WikiLink.

Whitespace behavior: - >>> print markdown.markdown('[[ foo bar_baz ]]', ['wikilinks']) + >>> print(markdown.markdown('[[ foo bar_baz ]]', ['wikilinks']))

foo bar_baz

- >>> print markdown.markdown('foo [[ ]] bar', ['wikilinks']) + >>> print(markdown.markdown('foo [[ ]] bar', ['wikilinks']))

foo bar

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)'] - ... ) + ... ))

Some text with a WikiLink.

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))

Some text with a WikiLink.

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))

Some text with a WikiLink.

MetaData should not carry over to next document: - >>> print md.convert("No [[MetaData]] here.") + >>> print(md.convert("No [[MetaData]] here."))

No MetaData here.

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]]'))

foo

From the command line: -- cgit v1.2.3