From 3dbf0bc9bb896d53916b83b28e5b31a541219b86 Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Fri, 21 Sep 2012 22:41:34 -0400 Subject: [PATCH] Fix heading/link code stripping; add WIKILINK contexts to documentation. --- mwparserfromhell/nodes/heading.py | 2 +- mwparserfromhell/nodes/wikilink.py | 4 ++-- mwparserfromhell/parser/contexts.py | 5 +++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/mwparserfromhell/nodes/heading.py b/mwparserfromhell/nodes/heading.py index 97878b2..8f389d3 100644 --- a/mwparserfromhell/nodes/heading.py +++ b/mwparserfromhell/nodes/heading.py @@ -45,7 +45,7 @@ class Heading(Node): yield self.title, child def __strip__(self, normalize, collapse): - return self.title + return self.title.strip_code(normalize, collapse) def __showtree__(self, write, get, mark): write("=" * self.level) diff --git a/mwparserfromhell/nodes/wikilink.py b/mwparserfromhell/nodes/wikilink.py index 7619590..73f2a8d 100644 --- a/mwparserfromhell/nodes/wikilink.py +++ b/mwparserfromhell/nodes/wikilink.py @@ -50,8 +50,8 @@ class Wikilink(Node): def __strip__(self, normalize, collapse): 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): write("[[") diff --git a/mwparserfromhell/parser/contexts.py b/mwparserfromhell/parser/contexts.py index 8187c6f..9d41870 100644 --- a/mwparserfromhell/parser/contexts.py +++ b/mwparserfromhell/parser/contexts.py @@ -46,6 +46,11 @@ Local (stack-specific) contexts: * :py:const:`ARGUMENT_NAME` * :py:const:`ARGUMENT_DEFAULT` +* :py:const:`WIKILINK` + + * :py:const:`WIKILINK_TITLE` + * :py:const:`WIKILINK_TEXT` + * :py:const:`HEADING` * :py:const:`HEADING_LEVEL_1`