Replace underscores in article titles
Remove underscores in article titles and replace with spaces to have canonical state for all articles Therefore we need to split title and posible anchors in heading parser Related Task: [https://fs.golderweb.de/index.php?do=details&task_id=114 FS#114]
This commit is contained in:
@@ -280,8 +280,21 @@ class RedFamParser( RedFam ):
|
|||||||
# (Task FS#77)
|
# (Task FS#77)
|
||||||
heading = mwparser.parse( str( heading ) )
|
heading = mwparser.parse( str( heading ) )
|
||||||
|
|
||||||
# Save destinations of wikilinks in headings
|
articlesList = []
|
||||||
return [ str( link.title ) for link in heading.ifilter_wikilinks() ]
|
for link in heading.ifilter_wikilinks():
|
||||||
|
article = str( link.title )
|
||||||
|
|
||||||
|
# Split in title and anchor part
|
||||||
|
article = article.split("#", 1)
|
||||||
|
# Replace underscores in title with spaces
|
||||||
|
article[0] = article[0].replace("_", " ")
|
||||||
|
# Rejoin title and anchor
|
||||||
|
article = "#".join(article)
|
||||||
|
|
||||||
|
# Add to list
|
||||||
|
articlesList.append(article)
|
||||||
|
|
||||||
|
return articlesList
|
||||||
|
|
||||||
def add_beginning( self, beginning ):
|
def add_beginning( self, beginning ):
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user