Bladeren bron

Fix heading/link code stripping; add WIKILINK contexts to documentation.

tags/v0.1.1
Ben Kurtovic 11 jaren geleden
bovenliggende
commit
3dbf0bc9bb
3 gewijzigde bestanden met toevoegingen van 8 en 3 verwijderingen
  1. +1
    -1
      mwparserfromhell/nodes/heading.py
  2. +2
    -2
      mwparserfromhell/nodes/wikilink.py
  3. +5
    -0
      mwparserfromhell/parser/contexts.py

+ 1
- 1
mwparserfromhell/nodes/heading.py Bestand weergeven

@@ -45,7 +45,7 @@ class Heading(Node):
yield self.title, child yield self.title, child


def __strip__(self, normalize, collapse): def __strip__(self, normalize, collapse):
return self.title
return self.title.strip_code(normalize, collapse)


def __showtree__(self, write, get, mark): def __showtree__(self, write, get, mark):
write("=" * self.level) write("=" * self.level)


+ 2
- 2
mwparserfromhell/nodes/wikilink.py Bestand weergeven

@@ -50,8 +50,8 @@ class Wikilink(Node):


def __strip__(self, normalize, collapse): def __strip__(self, normalize, collapse):
if self.text is not None: if self.text is not None:
return self.text
return self.title
return self.text.strip_code(normalize, collapse)
return self.title.strip_code(normalize, collapse)


def __showtree__(self, write, get, mark): def __showtree__(self, write, get, mark):
write("[[") write("[[")


+ 5
- 0
mwparserfromhell/parser/contexts.py Bestand weergeven

@@ -46,6 +46,11 @@ Local (stack-specific) contexts:
* :py:const:`ARGUMENT_NAME` * :py:const:`ARGUMENT_NAME`
* :py:const:`ARGUMENT_DEFAULT` * :py:const:`ARGUMENT_DEFAULT`


* :py:const:`WIKILINK`

* :py:const:`WIKILINK_TITLE`
* :py:const:`WIKILINK_TEXT`

* :py:const:`HEADING` * :py:const:`HEADING`


* :py:const:`HEADING_LEVEL_1` * :py:const:`HEADING_LEVEL_1`


Laden…
Annuleren
Opslaan