mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-15 15:49:36 +02:00
Script to pull manual no longer includes the translations.
This commit is contained in:
parent
793f52aeab
commit
79309f6df4
@ -250,6 +250,8 @@ def pre_html_transform(doc, url):
|
||||
if config.remove_history:
|
||||
doc = html_remove_image_history(doc)
|
||||
|
||||
doc = html_remove_translation_links(doc)
|
||||
|
||||
return doc
|
||||
|
||||
def pos_html_transform(doc, url):
|
||||
@ -335,6 +337,16 @@ def html_remove_image_history(doc):
|
||||
doc = re.sub(r'<h2>Image links</h2>[\s\S]+?</ul>', r'', doc)
|
||||
return 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][/"]
|
||||
in the URL.
|
||||
"""
|
||||
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)
|
||||
return doc
|
||||
|
||||
def monobook_hack_skin_html(doc):
|
||||
"""
|
||||
Hacks Monobook HTML output: use CSS ids for hacked skin.
|
||||
@ -625,6 +637,10 @@ def url_to_filename(url):
|
||||
L[4] = L[4][len('title='):]
|
||||
L[2] = L[2][:-len('index.php')]
|
||||
|
||||
if lpath[-1]=='man':
|
||||
L[2] += '/' + INDEX_HTML
|
||||
|
||||
|
||||
L[2] = L[2].strip('/')
|
||||
|
||||
#don't sanitize / for path
|
||||
@ -933,15 +949,8 @@ def run(out=sys.stdout):
|
||||
elif filename.endswith('.css'):
|
||||
(doc, new_urls) = parse_css(doc, url)
|
||||
|
||||
# Enqueue URLs that we haven't yet spidered.
|
||||
for u in new_urls:
|
||||
if normalize_url(u) not in complete:
|
||||
# Strip off any #section link.
|
||||
if '#' in u:
|
||||
u = u[:u.index('#')]
|
||||
pending.add(u)
|
||||
|
||||
# Save document changes to disk
|
||||
# The unmodified file already exists on disk.
|
||||
update = False
|
||||
text_ext = ('txt', 'html', 'rtf', 'css', 'sgml', 'xml')
|
||||
for ext in text_ext:
|
||||
@ -958,6 +967,14 @@ def run(out=sys.stdout):
|
||||
out.write(url + '\n => ' + filename + '\n\n')
|
||||
n += 1
|
||||
|
||||
# Enqueue URLs that we haven't yet spidered.
|
||||
for u in new_urls:
|
||||
if normalize_url(u) not in complete:
|
||||
# Strip off any #section link.
|
||||
if '#' in u:
|
||||
u = u[:u.index('#')]
|
||||
pending.add(u)
|
||||
|
||||
conn.close()
|
||||
print "connection to", domain, "closed."
|
||||
out.write(str(n) + ' files saved\n')
|
||||
|
Loading…
x
Reference in New Issue
Block a user