Move parsing of redfams from RedPageParser to RedFamParser.parser so RedPageParse won't do anything with redfams
except for returning a generator of text-sections
This commit is contained in:
23
redfam.py
23
redfam.py
@@ -325,6 +325,7 @@ class RedFamParser( RedFam ):
|
||||
self._status )
|
||||
|
||||
@classmethod
|
||||
@deprecated
|
||||
def is_sectionheading( cls, line ):
|
||||
"""
|
||||
Checks wether given line is a red_fam section heading
|
||||
@@ -339,6 +340,28 @@ class RedFamParser( RedFam ):
|
||||
else:
|
||||
return False
|
||||
|
||||
@classmethod
|
||||
def parser( cls, text, pageid, isarchive=False ):
|
||||
"""
|
||||
Handles parsing of redfam section
|
||||
|
||||
@param text Text of RedFam-Section
|
||||
@type text wikicode or mwparser-parseable
|
||||
"""
|
||||
|
||||
# Parse heading with mwparse if needed
|
||||
if not isinstance( text, mwparser.wikicode.Wikicode ):
|
||||
text = mwparser.parse( text )
|
||||
|
||||
# Extract heading text
|
||||
heading = next( text.ifilter_headings() ).title
|
||||
|
||||
# Extract beginnig and maybe ending
|
||||
(beginning, ending) = RedFamParser.extract_dates( text, isarchive )
|
||||
|
||||
# Create the RedFam object
|
||||
RedFamParser( heading, pageid, isarchive, beginning, ending )
|
||||
|
||||
@classmethod
|
||||
def extract_dates( cls, text, isarchive=False ):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user