mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-20 10:34:30 +00:00
docs: Fix MediaWiki manual page download failing
- Removed an unnecessary and dangerous optimization which was added earlier. Fixes #1369 Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
fc3151a17c
commit
b168599106
@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
import re
|
import re
|
||||||
import urllib.request
|
import urllib.request
|
||||||
from subprocess import PIPE, Popen
|
|
||||||
|
|
||||||
MANUAL_PAGE_URL = "https://wiki.debian.org/FreedomBox/Manual/{}?action=show&mimetype=text%2Fdocbook"
|
MANUAL_PAGE_URL = "https://wiki.debian.org/FreedomBox/Manual/{}?action=show&mimetype=text%2Fdocbook"
|
||||||
|
|
||||||
@ -29,7 +28,9 @@ manual_pages = []
|
|||||||
to_remove = ['QuickStart', 'GettingHelp', 'Developer']
|
to_remove = ['QuickStart', 'GettingHelp', 'Developer']
|
||||||
|
|
||||||
|
|
||||||
def write_manual_pages():
|
def list_manual_pages():
|
||||||
|
"""Fetch the list of manual pages and write them to a file.
|
||||||
|
"""
|
||||||
pattern = 'FreedomBox/Manual/\w+'
|
pattern = 'FreedomBox/Manual/\w+'
|
||||||
lst = list(urllib.request.urlopen(MANUAL_INDEX_RAW_URL))
|
lst = list(urllib.request.urlopen(MANUAL_INDEX_RAW_URL))
|
||||||
global manual_pages
|
global manual_pages
|
||||||
@ -45,19 +46,12 @@ def write_manual_pages():
|
|||||||
def fetch_manual_pages_in_docbook_format():
|
def fetch_manual_pages_in_docbook_format():
|
||||||
for page in manual_pages:
|
for page in manual_pages:
|
||||||
url = MANUAL_PAGE_URL.format(page)
|
url = MANUAL_PAGE_URL.format(page)
|
||||||
p1 = Popen(['wget', '--quiet', '-O', '-', url], stdout=PIPE)
|
filename = '{}.raw.xml'.format(page)
|
||||||
p2 = Popen(['xmllint', '--format', '-'], stdin=p1.stdout, stdout=PIPE)
|
urllib.request.urlretrieve(url, filename)
|
||||||
p1.stdout.close()
|
|
||||||
with open('{}.raw.xml'.format(page), 'w') as docbook:
|
|
||||||
p3 = Popen(
|
|
||||||
['egrep', '-v', 'linkend|Category|Commons|HELP|Back to'],
|
|
||||||
stdin=p2.stdout, stdout=docbook)
|
|
||||||
p2.stdout.close()
|
|
||||||
p3.communicate()
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
write_manual_pages()
|
list_manual_pages()
|
||||||
fetch_manual_pages_in_docbook_format()
|
fetch_manual_pages_in_docbook_format()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user