This commit is contained in:
Frank Smit 2015-10-22 15:27:37 +02:00
parent 5fab654d1d
commit f1cdc35c51
7 changed files with 24 additions and 25 deletions

View File

@ -1,5 +1,5 @@
include README.rst setup.py build_ffi.py THANKS LICENSE.txt
include README.rst setup.py build_ffi.py THANKS LICENSE.txt tox.ini
recursive-include misaka *
recursive-include docs *
recursive-include tests *
recursive-include benchmark *
prune docs/_build

View File

@ -20,7 +20,7 @@ Documentation can be found at: http://misaka.61924.nl/
Installation
------------
Misaka has been tested on CPython 2.7, 3.2, 3.3, 3.4 and PyPy 2.6. It needs
Misaka has been tested on CPython 2.7, 3.2, 3.3, 3.4, 3.5 and PyPy 2.6. It needs
CFFI 1.0 or newer, because of this it will not work on PyPy 2.5 and older.
With pip::
@ -39,16 +39,16 @@ Very simple example:
.. code:: python
from misaka import Markdown, HtmlRenderer
rndr = HtmlRenderer()
md = Markdown(rndr)
print md('some text')
import misaka as m
print m.html('some other text')
Or:
.. code:: python
import misaka as m
print m.html('some other text')
from misaka import Markdown, HtmlRenderer
rndr = HtmlRenderer()
md = Markdown(rndr)
print(md('some text'))

View File

@ -6,8 +6,8 @@ Changelog
Date format is year-month-day.
2.0.0b2 (2015-10-??)
^^^^^^^^^^^^^^^^^^^^
2.0.0 (2015-10-22)
^^^^^^^^^^^^^^^^^^
- Rename ``Markdown.render`` to ``Markdown.__call__``.
- Add a bechmark testcase to chibitest.

View File

@ -14,7 +14,6 @@
import sys
import os
import shlex
import sphinx_rtd_theme
html_theme = 'sphinx_rtd_theme'
@ -62,9 +61,9 @@ author = u'Frank Smit'
# built documents.
#
# The short X.Y version.
version = '2.0.0b2'
version = '2.0.0'
# The full version, including alpha/beta/rc tags.
release = '2.0.0b2'
release = '2.0.0'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.

View File

@ -69,7 +69,7 @@ used to escape the HTML):
class HighlighterRenderer(m.HtmlRenderer):
def blockcode(self, text, lang):
if not lang:
return '\n<pre>{}</code></pre>\n'.format(
return '\n<pre><code>{}</code></pre>\n'.format(
h.escape_html(text.strip()))
lexer = get_lexer_by_name(lang, stripall=True)

View File

@ -47,7 +47,7 @@ def args_to_int(mapping, argument):
deprecation('passing extensions and flags as constants is deprecated')
return argument
elif isinstance(argument, (tuple, list)):
return reduce(op.or_, [mapping[n] for n in argument if n in mapping], 0)
return reduce(op.or_, [mapping[n] for n in set(argument) if n in mapping], 0)
raise TypeError('argument must be a list of strings or an int')

View File

@ -168,8 +168,8 @@ class TestResult(object):
class BenchmarkResult(TestResult):
def __init__(self, func, doc_name=None, passed=False, message=None,
repeated=0, timing=0.0):
self.repeated = repeated
repetitions=0, timing=0.0):
self.repetitions = repetitions
self.timing = timing
TestResult.__init__(self, func, doc_name, passed, message)
@ -177,9 +177,9 @@ class BenchmarkResult(TestResult):
if self.passed:
s = '{:<25} {:>8} {:>16} {:>16}'.format(
self.name(),
self.repeated,
self.repetitions,
readable_duration(self.timing, suffix='/t'),
readable_duration(self.timing / self.repeated, suffix='/op'))
readable_duration(self.timing / self.repetitions, suffix='/op'))
else:
s = '{} ... FAILED'.format(self.name())
@ -253,7 +253,7 @@ class Benchmark(TestCase):
def catch_exception():
message = None
passed = False
repeated = 10
repetitions = 10
timing = 0.0
try:
@ -268,7 +268,7 @@ class Benchmark(TestCase):
break
else:
repeat = 10
repeated += 10
repetitions += 10
timing = default_timer() - start
passed = True
@ -283,7 +283,7 @@ class Benchmark(TestCase):
_get_doc_line(func) or None,
passed,
message,
repeated,
repetitions,
timing)
return catch_exception