diff --git a/CHANGELOG b/CHANGELOG index 98a1f96..289c413 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,6 +2,10 @@ v0.4 (unreleased): - Added a script to test for memory leaks in scripts/memtest.py. - Added a script to do releases in scripts/release.sh. +- skip_style_tags can now be passed to mwparserfromhell.parse() (previously, + only Parser().parse() allowed it). +- Fixed a parser bug involving nested tags. +- Updated and fixed some documentation. v0.3.3 (released April 22, 2014): diff --git a/docs/changelog.rst b/docs/changelog.rst index 3ce507e..21f0629 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -9,6 +9,10 @@ Unreleased - Added a script to test for memory leaks in :file:`scripts/memtest.py`. - Added a script to do releases in :file:`scripts/release.sh`. +- *skip_style_tags* can now be passed to :py:func:`mwparserfromhell.parse() + <.parse_anything>` (previously, only :py:meth:`.Parser.parse` allowed it). +- Fixed a parser bug involving nested tags. +- Updated and fixed some documentation. v0.3.3 ------ diff --git a/mwparserfromhell/parser/__init__.py b/mwparserfromhell/parser/__init__.py index 67f6eeb..8bac295 100644 --- a/mwparserfromhell/parser/__init__.py +++ b/mwparserfromhell/parser/__init__.py @@ -56,6 +56,13 @@ class Parser(object): def parse(self, text, context=0, skip_style_tags=False): """Parse *text*, returning a :py:class:`~.Wikicode` object tree. + 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, :py:class:`~.ExternalLink`\ 's + :py:attr:`~.ExternalLink.url` setter sets *context* to + :py:mod:`contexts.EXT_LINK_URI <.contexts>` to prevent the URL itself + from becoming an :py:class:`~.ExternalLink`. + If *skip_style_tags* is ``True``, then ``''`` and ``'''`` will not be parsed, but instead will be treated as plain text. """ diff --git a/mwparserfromhell/utils.py b/mwparserfromhell/utils.py index c6fd627..fd54ad0 100644 --- a/mwparserfromhell/utils.py +++ b/mwparserfromhell/utils.py @@ -45,14 +45,7 @@ def parse_anything(value, context=0, skip_style_tags=False): :py:class:`~.Template`, such as :py:meth:`wikicode.insert() <.Wikicode.insert>` or setting :py:meth:`template.name <.Template.name>`. - 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, :py:class:`~.ExternalLink`\ 's :py:attr:`~.ExternalLink.url` - setter sets *context* to :py:mod:`contexts.EXT_LINK_URI <.contexts>` to - prevent the URL itself from becoming an :py:class:`~.ExternalLink`. - - If *skip_style_tags* is ``True``, then ``''`` and ``'''`` will not be - parsed, but instead will be treated as plain text. + Additional arguments are passed directly to :py:meth:`.Parser.parse`. """ from .parser import Parser from .wikicode import Wikicode