Quellcode durchsuchen

rewrite Caveats

>not supported, since they cannot be represented in the node tree.
It's not that they cannot be represented, it's that they would have to be evaluated.
tags/v0.5
Larivact vor 7 Jahren
committed by GitHub
Ursprung
Commit
2d89f611be
1 geänderte Dateien mit 10 neuen und 9 gelöschten Zeilen
  1. +10
    -9
      README.rst

+ 10
- 9
README.rst Datei anzeigen

@@ -115,12 +115,18 @@ Likewise, use ``unicode(code)`` in Python 2.

Caveats
-------
mwparserfromhell generates an abstract syntax tree instead of HTML.
While the MediaWiki parser generates HTML, mwparserfromhell acts as an interface to
the source code. mwparserfromhell therefore is unaware of template definitions since
if it would substitute templates with their output you could no longer change the templates.
This has several implications:

* Crossed constructs like ``{{echo|''Hello}}, world!''`` are not supported,
since they cannot be represented in the node tree. We compromise by treating
the first node (i.e. the template) as plain text, parsing only the italics.
* Start and end tags generated by templates aren't recognized e.g. ``<b>foobar{{bold-end}}``.

* Templates adjacent to external links e.g. ``http://example.com{{foo}}`` are
considered part of the link.

* Crossed constructs like ``{{echo|''Hello}}, world!''`` are not supported.
We compromise by treating the first node as plain text.

The current workaround for cases where you are not interested in text
formatting is to pass ``skip_style_tags=True`` to ``mwparserfromhell.parse()``.
@@ -129,11 +135,6 @@ This has several implications:
A future version of mwparserfromhell will include multiple parsing modes to get
around this restriction.

* Templates adjacent to external links e.g. ``http://example.com{{foo}}`` are
considered part of the link, since mwparserfromhell does not know the
definition of templates and even if it did the template could only be
partially part of the link which also couldn't be represented in the AST.

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



Laden…
Abbrechen
Speichern