summaryrefslogtreecommitdiff
path: root/main/misc
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2015-05-08 10:39:43 +0200
committerArne Schwabe <arne@rfc2549.org>2015-06-15 09:09:20 +0200
commit15941530f484ec49038642b660102d512893a737 (patch)
tree701b122df0b1fda8ee6d5bc5b21906a2b7f91999 /main/misc
parent519e2d26b74b47fbe19da4ad632d1f9d56648aac (diff)
generate FAQ for github, not good yet but better than nothing.
Diffstat (limited to 'main/misc')
-rwxr-xr-xmain/misc/genFAQ.py56
-rw-r--r--main/misc/header.html44
2 files changed, 81 insertions, 19 deletions
diff --git a/main/misc/genFAQ.py b/main/misc/genFAQ.py
index d4ddf032..d69a5e6b 100755
--- a/main/misc/genFAQ.py
+++ b/main/misc/genFAQ.py
@@ -5,16 +5,12 @@ import codecs
import xml.dom.minidom as dom
import os.path
import re
+import HTMLParser
-faqpath = "/Users/arne/oss/ics-openvpn.wiki"
+faqpath = "/Users/arne/software/icsopenvpn.ghpages"
-header="""
-<wiki:comment>
-This page is autogenerated. Do not edit
-</wiki:comment>
-= Frequently aksed questions =
-"""
+template = open("misc/header.html").read()
def getString(strid,lang):
ostr=""
@@ -28,6 +24,7 @@ def getString(strid,lang):
ostr = ostr.replace("\\\"","\"")
ostr = ostr.replace("\\'","'")
ostr = ostr.replace("\\n","<p>")
+ ostr= HTMLParser.HTMLParser().unescape(ostr)
return ostr
def genPage(javafile, lang):
@@ -46,19 +43,40 @@ def genPage(javafile, lang):
(ver1, ver2, title, body) = m.groups()
verHeader = getVerHeader(ver1.strip(), ver2.strip(), lang)
- out += "== %s ==\n" % getString(title,lang)
+ section = """<h2>
+ <a name="%(titleid)s"></a>
+ %(title)s
+ <a href="#%(titleid)s" class="section_anchor"> </a>
+ </h2>
+ %(verinfo)s
+ %(content)s
+ """
+
+
if verHeader:
- out += "_%s_\n" % verHeader
-
- out += "%s\n" % getString(body,lang)
+ verinfo += "<small><i>%s</i></small> <br/>\n" % verHeader
+ else:
+ verinfo =""
+
+ content = "%s\n" % getString(body,lang)
if body == "faq_system_dialogs_title":
- out += "%s\n" % getString("faq_system_dialog_xposed",lang)
+ content += "%s\n" % getString("faq_system_dialog_xposed",lang)
+
- elif header:
+ c = {'titleid': title,
+ 'title': getString(title,lang),
+ 'verinfo': verinfo,
+ 'content': content
+ }
+
+ out+=section % c
+
+
+ else:
notmatched = l
- return header + out
+ return out
def getVerHeader(startVersion, endVersion, lang):
if startVersion == "Build.VERSION_CODES.ICE_CREAM_SANDWICH":
@@ -144,7 +162,7 @@ def main():
faqdom = open("src/main/java/de/blinkt/openvpn/fragments/FaqFragment.java").readlines()
faq= genPage(faqdom,"default")
- open(faqpath + "/FAQ.wiki","w").write(faq)
+ open(faqpath + "/FAQ.html","w").write(template % {'content': faq})
for directory in os.listdir("src/main/res"):
if directory.startswith("values-") and directory.find("-sw")==-1 and not directory.startswith("values-v"):
@@ -152,18 +170,18 @@ def main():
print lang
loadstrres("src/main/res/values-%s/strings.xml" % lang,lang)
- langdir= "%s/%s" %(faqpath,lang)
+ langdir= "%s/FAQ-%s" %(faqpath,lang)
if lang=="zh-rCN":
- langdir= "%s/%s" %(faqpath,"zh-Hans")
+ langdir= "%s/FAQ-%s" %(faqpath,"zh-Hans")
elif lang=="zh-rTW":
- langdir= "%s/%s" %(faqpath,"zh-Hant")
+ langdir= "%s/FAQ-%s" %(faqpath,"zh-Hant")
if not os.path.exists(langdir):
os.mkdir(langdir)
faq= genPage(faqdom,lang)
- open("%s/FAQ.wiki" % langdir,"w").write(faq.encode("utf-8"))
+ open("%s.html" % langdir,"w").write(faq.encode("utf-8"))
checkFormatString(lang)
diff --git a/main/misc/header.html b/main/misc/header.html
new file mode 100644
index 00000000..9fe689bf
--- /dev/null
+++ b/main/misc/header.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html>
+
+ <head>
+ <meta charset='utf-8'>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <meta name="description" content="Ics-openvpn : OpenVPN for Android">
+
+ <link rel="stylesheet" type="text/css" media="screen" href="stylesheets/stylesheet.css">
+
+ <title>Ics-openvpn</title>
+ </head>
+
+ <body>
+
+ <!-- HEADER -->
+ <div id="header_wrap" class="outer">
+ <header class="inner">
+ <a id="forkme_banner" href="https://github.com/schwabe/ics-openvpn">View on GitHub</a>
+
+ <h1 id="project_title">Ics-openvpn</h1>
+ <h2 id="project_tagline">OpenVPN for Android</h2>
+ </header>
+ </div>
+
+ <!-- MAIN CONTENT -->
+ <div id="main_content_wrap" class="outer">
+ <section id="main_content" class="inner">
+%(content)s
+ </section>
+ </div>
+
+ <!-- FOOTER -->
+ <div id="footer_wrap" class="outer">
+ <footer class="inner">
+ <p class="copyright">Ics-openvpn maintained by <a href="https://github.com/schwabe">schwabe</a></p>
+ <p>Published with <a href="https://pages.github.com">GitHub Pages</a></p>
+ </footer>
+ </div>
+
+
+
+ </body>
+</html>