fnp
/
librarian.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Experimental DAISY builder.
[librarian.git]
/
scripts
/
fn_qualifiers_list_from_redmine.py
diff --git
a/scripts/fn_qualifiers_list_from_redmine.py
b/scripts/fn_qualifiers_list_from_redmine.py
old mode 100644
(file)
new mode 100755
(executable)
index
020b119
..
66b00cc
--- a/
scripts/fn_qualifiers_list_from_redmine.py
+++ b/
scripts/fn_qualifiers_list_from_redmine.py
@@
-5,16
+5,17
@@
This scripts reads the table of footnote qualifiers from Redmine
and produces contents of fn_qualifiers.py – a list of valid qualifiers.
"""
This scripts reads the table of footnote qualifiers from Redmine
and produces contents of fn_qualifiers.py – a list of valid qualifiers.
"""
+from __future__ import print_function, unicode_literals
from lxml import etree
from lxml import etree
-from
urllib2
import urlopen
+from
six.moves.urllib.request
import urlopen
url = 'http://redmine.nowoczesnapolska.org.pl/projects/wl-publikacje/wiki/Lista_skr%C3%B3t%C3%B3w'
parser = etree.HTMLParser()
tree = etree.parse(urlopen(url), parser)
url = 'http://redmine.nowoczesnapolska.org.pl/projects/wl-publikacje/wiki/Lista_skr%C3%B3t%C3%B3w'
parser = etree.HTMLParser()
tree = etree.parse(urlopen(url), parser)
-print
"""\
+print
(
"""\
# -*- coding: utf-8
\"""
List of standard footnote qualifiers.
# -*- coding: utf-8
\"""
List of standard footnote qualifiers.
@@
-24,12
+25,12
@@
do not edit it.
from __future__ import unicode_literals
from __future__ import unicode_literals
-FN_QUALIFIERS = {"""
.encode('utf-8'
)
+FN_QUALIFIERS = {""")
for td in tree.findall('//td'):
for td in tree.findall('//td'):
- print
(" '%s': '%s'," % (
+ print
(
(" '%s': '%s'," % (
td[0].text.replace('\\', '\\\\').replace("'", "\\'"),
td[0].tail.strip(' -').replace('\\', '\\\\').replace("'", "\\'")
td[0].text.replace('\\', '\\\\').replace("'", "\\'"),
td[0].tail.strip(' -').replace('\\', '\\\\').replace("'", "\\'")
- ))
.encode('utf-8'
)
+ )))
-print
""" }""".encode('utf-8'
)
+print
(""" }"""
)