running libfuturize.fixes.fix_print_with_import

This commit is contained in:
ilvalle
2016-05-30 21:23:40 +02:00
parent 36ca754c77
commit 48e10a3793
36 changed files with 240 additions and 204 deletions
+16 -15
View File
@@ -3,6 +3,7 @@
# created by Massimo Di Pierro
# recreated by Vladyslav Kozlovskyy
# license MIT/BSD/GPL
from __future__ import print_function
import re
import urllib
from cgi import escape
@@ -45,11 +46,11 @@ Example of usage:
``
m = "Hello **world** [[link http://web2py.com]]"
from markmin2html import markmin2html
print markmin2html(m)
print(markmin2html(m))
from markmin2latex import markmin2latex
print markmin2latex(m)
print(markmin2latex(m))
from markmin2pdf import markmin2pdf # requires pdflatex
print markmin2pdf(m)
print(markmin2pdf(m))
``
====================
# This is a test block
@@ -803,7 +804,7 @@ def render(text,
>>> render("``aaa``:custom", extra=dict(custom=lambda text: 'x'+text+'x'))
'xaaax'
>>> print render(r"$$\int_a^b sin(x)dx$$")
>>> print(render(r"$$\int_a^b sin(x)dx$$"))
<img src="http://chart.apis.google.com/chart?cht=tx&chl=%5Cint_a%5Eb%20sin%28x%29dx" />
>>> markmin2html(r"use backslash: \[\[[[mess\[[ag\]]e link]]\]]")
@@ -1494,17 +1495,17 @@ if __name__ == '__main__':
pre { background-color: #E0E0E0; padding: 5px; }
</style>""")[1:]
print html % dict(title="Markmin markup language",
print(html % dict(title="Markmin markup language",
style=style,
body=markmin2html(__doc__, pretty_print=True))
body=markmin2html(__doc__, pretty_print=True)))
elif sys.argv[1:2] == ['-t']:
from timeit import Timer
loops = 1000
ts = Timer("markmin2html(__doc__)", "from markmin2html import markmin2html")
print 'timeit "markmin2html(__doc__)":'
print('timeit "markmin2html(__doc__)":')
t = min([ts.timeit(loops) for i in range(3)])
print "%s loops, best of 3: %.3f ms per loop" % (loops, t / 1000 * loops)
print("%s loops, best of 3: %.3f ms per loop" % (loops, t / 1000 * loops))
elif len(sys.argv) > 1:
fargv = open(sys.argv[1], 'r')
try:
@@ -1523,15 +1524,15 @@ if __name__ == '__main__':
else:
markmin_style = ""
print html % dict(title=sys.argv[1], style=markmin_style,
body=markmin2html(markmin_text, pretty_print=True))
print(html % dict(title=sys.argv[1], style=markmin_style,
body=markmin2html(markmin_text, pretty_print=True)))
finally:
fargv.close()
else:
print "Usage: " + sys.argv[0] + " -h | -t | file.markmin [file.css|@path_to/css]"
print "where: -h - print __doc__"
print " -t - timeit __doc__ (for testing purpuse only)"
print " file.markmin [file.css] - process file.markmin + built in file.css (optional)"
print " file.markmin [@path_to/css] - process file.markmin + link path_to/css (optional)"
print("Usage: " + sys.argv[0] + " -h | -t | file.markmin [file.css|@path_to/css]")
print("where: -h - print __doc__")
print(" -t - timeit __doc__ (for testing purpuse only)")
print(" file.markmin [file.css] - process file.markmin + built in file.css (optional)")
print(" file.markmin [@path_to/css] - process file.markmin + link path_to/css (optional)")
run_doctests()