Ben Kurtovic 5 лет назад
Родитель
Сommit
708bee59e1
6 измененных файлов: 10 добавлений и 9 удалений
  1. +1
    -1
      docs/changelog.rst
  2. +1
    -0
      mwparserfromhell/nodes/__init__.py
  3. +2
    -2
      mwparserfromhell/nodes/extras/__init__.py
  4. +3
    -3
      mwparserfromhell/parser/__init__.py
  5. +1
    -1
      mwparserfromhell/parser/tokenizer.py
  6. +2
    -2
      mwparserfromhell/wikicode.py

+ 1
- 1
docs/changelog.rst Просмотреть файл

@@ -8,7 +8,7 @@ Unreleased
(`changes <https://github.com/earwig/mwparserfromhell/compare/v0.5.2...develop>`__):

- 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`,
:meth:`.Wikicode.remove`, etc.) when passed an empty section as an argument.
(`#212 <https://github.com/earwig/mwparserfromhell/issues/212>`_)


+ 1
- 0
mwparserfromhell/nodes/__init__.py Просмотреть файл

@@ -56,6 +56,7 @@ class Node(StringMixIn):

def __children__(self):
return
# pylint: disable=unreachable
yield # pragma: no cover (this is a generator that yields nothing)

def __strip__(self, **kwargs):


+ 2
- 2
mwparserfromhell/nodes/extras/__init__.py Просмотреть файл

@@ -21,8 +21,8 @@
# 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


+ 3
- 3
mwparserfromhell/parser/__init__.py Просмотреть файл

@@ -55,8 +55,8 @@ class Parser(object):

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
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
: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.
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
:mod:`contexts.EXT_LINK_URI <.contexts>` to prevent the URL itself
from becoming an :class:`.ExternalLink`.


+ 1
- 1
mwparserfromhell/parser/tokenizer.py Просмотреть файл

@@ -455,7 +455,7 @@ class Tokenizer(object):
else:
self._parse_free_uri_scheme()
invalid = ("\n", " ", "[", "]")
punct = tuple(",;\.:!?)")
punct = tuple(",;\\.:!?)")
if self._read() is self.END or self._read()[0] in invalid:
self._fail_route()
tail = ""


+ 2
- 2
mwparserfromhell/wikicode.py Просмотреть файл

@@ -56,7 +56,7 @@ class Wikicode(StringMixIn):

@staticmethod
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
if restrict and isinstance(node, restrict):
return
@@ -276,7 +276,7 @@ class Wikicode(StringMixIn):
self._nodes = value

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]

def set(self, index, value):


Загрузка…
Отмена
Сохранить