diff options
author | Arne Schwabe <arne@rfc2549.org> | 2014-12-11 19:46:21 +0100 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2014-12-11 19:46:21 +0100 |
commit | dc212f486c5916afdd271bf38ac34f1dd95090de (patch) | |
tree | 86a3345b7ae2fac0939310acd5f627320823e9c9 /main/misc/genFAQ.py | |
parent | 7b71a54867ff276163f57388b10b904d5868c4da (diff) |
Update FAQ generation script
--HG--
extra : rebase_source : f87df64acd2c565529fe21ae0806bf1774df9afe
Diffstat (limited to 'main/misc/genFAQ.py')
-rwxr-xr-x | main/misc/genFAQ.py | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/main/misc/genFAQ.py b/main/misc/genFAQ.py index 09381caa..e5c6d328 100755 --- a/main/misc/genFAQ.py +++ b/main/misc/genFAQ.py @@ -4,6 +4,7 @@ import codecs import xml.dom.minidom as dom import os.path +import re faqpath = "/Users/arne/oss/ics-openvpn.wiki" @@ -29,7 +30,20 @@ def getString(strid,lang): ostr = ostr.replace("\\n","<p>") return ostr -def genPage(faqdom,lang): +def genPage(javafile, lang): + #{R.string.faq_howto_title, R.string.faq_howto}, + out ="" + out+= header + for l in javafile: + m = re.search("\{.*R.string.([a-z_]+),.*R.string.([a-z_]+)\}", l) + if m: + (title, body) = m.groups() + + out += "== %s ==\n" % getString(title,lang) + out += "%s\n" % getString(body,lang) + return out + +def genPageXML(faqdom,lang): out ="" #out+="#summary %s\n" % getString("faq_summary",lang) @@ -75,13 +89,14 @@ def main(): loadstrres("src/main/res/values/strings.xml","default") - faqdom = dom.parse("src/main/res/layout/faq.xml") + #faqdom = dom.parse("src/main/res/layout/faq.xml") + faqdom = open("src/main/java/de/blinkt/openvpn/fragments/FaqFragment.java").readlines() faq= genPage(faqdom,"default") open(faqpath + "/FAQ.wiki","w").write(faq) for directory in os.listdir("src/main/res"): - if directory.startswith("values-") and directory.find("-sw")==-1: + if directory.startswith("values-") and directory.find("-sw")==-1 and not directory.startswith("values-v"): lang = directory.split("-",1)[1] print lang loadstrres("src/main/res/values-%s/strings.xml" % lang,lang) |