mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-15 15:49:36 +02:00
Bug 1370 - mw2html: Filipino pages present.
Now excludes links containing /xx/, /xxx/ and /xx_XX/. Case sensitive, otherwise we exclude /FAQ/ and /SC4/
This commit is contained in:
parent
de9579dbe9
commit
b4d6f5f03a
@ -343,11 +343,13 @@ def html_remove_image_history(doc):
|
||||
def html_remove_translation_links(doc):
|
||||
"""
|
||||
Remove translation links (the international flags).
|
||||
We identify them by the pattern for a 2 letter language code, /[\s\S][\s\S][/"]
|
||||
We identify them by the pattern for a 2 or 3 letter language code, /[a-z]{2,3}[/"]
|
||||
in the URL.
|
||||
The second version deals with links like /pt_PT and /zh_CN
|
||||
We are case sensitive, so as not to treat FAQ as a language code.
|
||||
"""
|
||||
doc = re.sub(r'<a href="[^"]+/[\s\S][\s\S][/"][\s\S]+?</a>', r'<!--Removed Translation Flag-->', doc)
|
||||
doc = re.sub(r'<a href="[^"]+/[\s\S][\s\S]_[\s\S][\s\S][/"][\s\S]+?</a>', r'<!--Removed Translation Flag2-->', doc)
|
||||
doc = re.sub(r'<a href="[^"]+/[a-z]{2,3}[/"][\s\S]+?</a>', r'<!--Removed Translation Flag-->', doc)
|
||||
doc = re.sub(r'<a href="[^"]+/[a-z]{2}_[A-Z]{2}[/"][\s\S]+?</a>', r'<!--Removed Translation Flag2-->', doc)
|
||||
return doc
|
||||
|
||||
def monobook_hack_skin_html(doc):
|
||||
|
Loading…
x
Reference in New Issue
Block a user