@@ -8,7 +8,7 @@ Unreleased | |||||
(`changes <https://github.com/earwig/mwparserfromhell/compare/v0.5.2...develop>`__): | (`changes <https://github.com/earwig/mwparserfromhell/compare/v0.5.2...develop>`__): | ||||
- Fixed manual construction of Node objects, previously unsupported. | - Fixed manual construction of Node objects, previously unsupported. | ||||
(`#214 <https://github.com/earwig/mwparserfromhell/issues/214>`_) | |||||
(`#214 <https://github.com/earwig/mwparserfromhell/issues/214>`_) | |||||
- Fixed :class:`.Wikicode` transformation methods (:meth:`.Wikicode.replace`, | - Fixed :class:`.Wikicode` transformation methods (:meth:`.Wikicode.replace`, | ||||
:meth:`.Wikicode.remove`, etc.) when passed an empty section as an argument. | :meth:`.Wikicode.remove`, etc.) when passed an empty section as an argument. | ||||
(`#212 <https://github.com/earwig/mwparserfromhell/issues/212>`_) | (`#212 <https://github.com/earwig/mwparserfromhell/issues/212>`_) | ||||
@@ -56,6 +56,7 @@ class Node(StringMixIn): | |||||
def __children__(self): | def __children__(self): | ||||
return | return | ||||
# pylint: disable=unreachable | |||||
yield # pragma: no cover (this is a generator that yields nothing) | yield # pragma: no cover (this is a generator that yields nothing) | ||||
def __strip__(self, **kwargs): | def __strip__(self, **kwargs): | ||||
@@ -21,8 +21,8 @@ | |||||
# SOFTWARE. | # SOFTWARE. | ||||
""" | """ | ||||
This package contains objects used by :class:`.Node`\ s, but that are not nodes | |||||
themselves. This includes template parameters and HTML tag attributes. | |||||
This package contains objects used by :class:`.Node`\\ s, but that are not | |||||
nodes themselves. This includes template parameters and HTML tag attributes. | |||||
""" | """ | ||||
from .attribute import Attribute | from .attribute import Attribute | ||||
@@ -55,8 +55,8 @@ class Parser(object): | |||||
Actual parsing is a two-step process: first, the text is split up into a | Actual parsing is a two-step process: first, the text is split up into a | ||||
series of tokens by the :class:`.Tokenizer`, and then the tokens are | series of tokens by the :class:`.Tokenizer`, and then the tokens are | ||||
converted into trees of :class:`.Wikicode` objects and :class:`.Node`\ s by | |||||
the :class:`.Builder`. | |||||
converted into trees of :class:`.Wikicode` objects and :class:`.Node`\\ s | |||||
by the :class:`.Builder`. | |||||
Instances of this class or its dependents (:class:`.Tokenizer` and | Instances of this class or its dependents (:class:`.Tokenizer` and | ||||
:class:`.Builder`) should not be shared between threads. :meth:`parse` can | :class:`.Builder`) should not be shared between threads. :meth:`parse` can | ||||
@@ -79,7 +79,7 @@ class Parser(object): | |||||
If given, *context* will be passed as a starting context to the parser. | If given, *context* will be passed as a starting context to the parser. | ||||
This is helpful when this function is used inside node attribute | This is helpful when this function is used inside node attribute | ||||
setters. For example, :class:`.ExternalLink`\ 's | |||||
setters. For example, :class:`.ExternalLink`\\ 's | |||||
:attr:`~.ExternalLink.url` setter sets *context* to | :attr:`~.ExternalLink.url` setter sets *context* to | ||||
:mod:`contexts.EXT_LINK_URI <.contexts>` to prevent the URL itself | :mod:`contexts.EXT_LINK_URI <.contexts>` to prevent the URL itself | ||||
from becoming an :class:`.ExternalLink`. | from becoming an :class:`.ExternalLink`. | ||||
@@ -455,7 +455,7 @@ class Tokenizer(object): | |||||
else: | else: | ||||
self._parse_free_uri_scheme() | self._parse_free_uri_scheme() | ||||
invalid = ("\n", " ", "[", "]") | invalid = ("\n", " ", "[", "]") | ||||
punct = tuple(",;\.:!?)") | |||||
punct = tuple(",;\\.:!?)") | |||||
if self._read() is self.END or self._read()[0] in invalid: | if self._read() is self.END or self._read()[0] in invalid: | ||||
self._fail_route() | self._fail_route() | ||||
tail = "" | tail = "" | ||||
@@ -56,7 +56,7 @@ class Wikicode(StringMixIn): | |||||
@staticmethod | @staticmethod | ||||
def _get_children(node, contexts=False, restrict=None, parent=None): | def _get_children(node, contexts=False, restrict=None, parent=None): | ||||
"""Iterate over all child :class:`.Node`\ s of a given *node*.""" | |||||
"""Iterate over all child :class:`.Node`\\ s of a given *node*.""" | |||||
yield (parent, node) if contexts else node | yield (parent, node) if contexts else node | ||||
if restrict and isinstance(node, restrict): | if restrict and isinstance(node, restrict): | ||||
return | return | ||||
@@ -276,7 +276,7 @@ class Wikicode(StringMixIn): | |||||
self._nodes = value | self._nodes = value | ||||
def get(self, index): | def get(self, index): | ||||
"""Return the *index*\ th node within the list of nodes.""" | |||||
"""Return the *index*\\ th node within the list of nodes.""" | |||||
return self.nodes[index] | return self.nodes[index] | ||||
def set(self, index, value): | def set(self, index, value): | ||||