Coverage for markupmirror.markup.base : 100%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
"""Basic interface for markup converter classes.
An example converter could look like this::
class ExampleMarkup(BaseMarkup):
def convert(self, markup): return markup.replace("example", "markup")
"""
def get_name(cls): """Returns lowercase markup name, without the "Markup" part.
Class naming convention is ``<Markup-Type>Markup``. """
"""Main conversion method. Must be implemented in subclasses."""
"""Called before ``convert``. Can be used to separate the main conversion through a third-party library (e.g. Markdown) from additional logic.
"""
"""Called after ``convert``. Similar to ``before_convert``."""
"""Main entry point. Calls ``before_convert``, ``convert`` and ``after_convert`` in that order.
""" self.after_convert(self.convert(self.before_convert(markup))))
"""Pool for markup converters.
Each markup class, subclassing ``markupmirror.markup.base.BaseMarkup``, must register to this pool using ``register_markup`` defined below.
"""
"""Registers a markup converter class.
``markup`` must be a subclass of ``BaseMarkup`` and may not be registered already.
""" # check for correct subclassing "Markups must be subclasses of " "markupmirror.markup.base.BaseMarkup. %r is not." % markup)
"""Unregisters a markup converter with the name ``markup_name``. Fails silently if no converter was registered by that name.
Alternatively you can also use the ``del`` operator::
del markup_pool['restructuredtext']
"""
"""Tests if a markup converter with the name ``markup_name`` is already registered with the markup pool.
Alternatively you can also use the ``in`` operator, like with a dictionary::
if 'restructuredtext' in markup_pool: pass
"""
"""Returns one markup converter by name. Raises ``KeyError`` if no converter was registered by ``markup_name``.
Alternatively you can also use the ``[]`` accessor, like with a dictionary::
markup = markup_pool['restructuredtext']
"""
|