Преглед изворни кода

Add note on caveats [ci skip]

tags/v0.4.4
Ben Kurtovic пре 8 година
родитељ
комит
11da09105d
3 измењених фајлова са 36 додато и 0 уклоњено
  1. +18
    -0
      README.rst
  2. +17
    -0
      docs/caveats.rst
  3. +1
    -0
      docs/index.rst

+ 18
- 0
README.rst Прегледај датотеку

@@ -114,6 +114,24 @@ saving the page!) by calling ``str()`` on it::

Likewise, use ``unicode(code)`` in Python 2.

Caveats
-------

An inherent limitation in wikicode prevents us from generating complete parse
trees in certain cases. For example, the string ``{{echo|''Hello}}, world!''``
produces the valid output ``<i>Hello, world!</i>`` in MediaWiki, assuming
``{{echo}}`` is a template that returns its first parameter. But since
representing this in mwparserfromhell's node tree would be impossible, we
compromise by treating the first node (i.e., the template) as plain text,
parsing only the italics.

The current workaround for cases where you are not interested in text
formatting is to pass ``skip_style_tags=True`` to ``mwparserfromhell.parse()``.
This treats ``''`` and ``'''`` like plain text.

A future version of mwparserfromhell will include multiple parsing modes to get
around this restriction.

Integration
-----------



+ 17
- 0
docs/caveats.rst Прегледај датотеку

@@ -0,0 +1,17 @@
Caveats
=======

An inherent limitation in wikicode prevents us from generating complete parse
trees in certain cases. For example, the string ``{{echo|''Hello}}, world!''``
produces the valid output ``<i>Hello, world!</i>`` in MediaWiki, assuming
``{{echo}}`` is a template that returns its first parameter. But since
representing this in mwparserfromhell's node tree would be impossible, we
compromise by treating the first node (i.e., the template) as plain text,
parsing only the italics.

The current workaround for cases where you are not interested in text
formatting is to pass *skip_style_tags=True* to :func:`mwparserfromhell.parse`.
This treats ``''`` and ``'''`` like plain text.

A future version of mwparserfromhell will include multiple parsing modes to get
around this restriction.

+ 1
- 0
docs/index.rst Прегледај датотеку

@@ -41,6 +41,7 @@ Contents
:maxdepth: 2

usage
caveats
integration
changelog
API Reference <api/modules>


Loading…
Откажи
Сачувај