Use callback to detect redfam.section
Detecting redfam-Sections via RegExp caused some false positives due to wrong formated things in wikisyntax. See Task Related Task: [https://fs.golderweb.de/index.php?do=details&task_id=78 FS#78]
This commit is contained in:
16
redfam.py
16
redfam.py
@@ -341,6 +341,22 @@ class RedFamParser( RedFam ):
|
||||
else:
|
||||
return False
|
||||
|
||||
@classmethod
|
||||
def is_section_redfam_cb( cls, heading ):
|
||||
"""
|
||||
Used as callback for wikicode.get_sections in redpage.parse to
|
||||
select sections which are redfams
|
||||
"""
|
||||
# Because of strange behavior in some cases, parse heading again
|
||||
# (Task FS#77)
|
||||
heading = mwparser.parse( str( heading ) )
|
||||
|
||||
# Make sure we have min. two wikilinks in heading to assume a redfam
|
||||
if len( heading.filter_wikilinks() ) >= 2:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
@classmethod
|
||||
def parser( cls, text, page, isarchive=False ):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user