summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@suse.cz>2010-11-05 14:04:27 +0100
committerJan Holesovsky <kendy@suse.cz>2010-11-05 14:04:27 +0100
commitc3760ab69952dec6b62c21efa9ea743f8e81940f (patch)
tree7addfa29635b6395388ebbdcb5bc252ac790b535
parent962aaaced4539cc648cdd8236c36dadd4e77a871 (diff)
Update the help -> wiki conversion scripts to work inside helpcontent2.
-rwxr-xr-xhelpcontent2/help-to-wiki.py36
-rwxr-xr-xhelpcontent2/to-wiki/convall.py2
-rwxr-xr-xhelpcontent2/to-wiki/getalltitles.py22
-rwxr-xr-xhelpcontent2/to-wiki/wikiconv2.py2
4 files changed, 49 insertions, 13 deletions
diff --git a/helpcontent2/help-to-wiki.py b/helpcontent2/help-to-wiki.py
new file mode 100755
index 0000000000..5ed0e6c1c7
--- /dev/null
+++ b/helpcontent2/help-to-wiki.py
@@ -0,0 +1,36 @@
+#!/usr/bin/env python
+
+import sys, os
+
+# FIXME do proper modules from getalltitles & wikiconv2
+# [so far this is in fact just a shell thing]
+
+def create_wiki_dirs():
+ dirs = [
+ "Basic",
+ "Calc",
+ "Chart",
+ "Draw",
+ "All",
+ "Impress",
+ "Math",
+ "Writer"
+ ]
+
+ try:
+ os.mkdir( "wiki" )
+ except:
+ sys.stdout.write( "wiki already generated - the wiki/ subdir exists\n" )
+ sys.exit( 1 )
+
+ for i in dirs:
+ try:
+ os.mkdir( "wiki/" + i )
+ except:
+ pass
+
+# do the work
+create_wiki_dirs()
+
+os.system( "python to-wiki/getalltitles.py source/text > alltitles.csv" )
+os.system( "python to-wiki/convall.py source/text" )
diff --git a/helpcontent2/to-wiki/convall.py b/helpcontent2/to-wiki/convall.py
index bb0483fed5..cc02822e0d 100755
--- a/helpcontent2/to-wiki/convall.py
+++ b/helpcontent2/to-wiki/convall.py
@@ -20,7 +20,7 @@ for title in titles:
try:
outfile = "wiki/"+title[1].strip()
infile = title[0].strip()
- command = "python wikiconv2.py "+infile+" > "+outfile
+ command = "python to-wiki/wikiconv2.py "+infile+" > "+outfile
except:
continue
diff --git a/helpcontent2/to-wiki/getalltitles.py b/helpcontent2/to-wiki/getalltitles.py
index cb0527e88b..50ca03dc7d 100755
--- a/helpcontent2/to-wiki/getalltitles.py
+++ b/helpcontent2/to-wiki/getalltitles.py
@@ -41,25 +41,25 @@ replace_text_list = [
]
modules_list = [
- "sbasic",
- "scalc",
- "schart",
- "sdraw",
- "shared",
- "simpress",
- "smath",
- "swriter"
+ ["sbasic","Basic"],
+ ["scalc","Calc"],
+ ["schart","Chart"],
+ ["sdraw","Draw"],
+ ["shared","All"],
+ ["simpress","Impress"],
+ ["smath","Math"],
+ ["swriter","Writer"]
]
def get_module(text):
for i in modules_list:
- if text.find(i) >=0:
- return i
+ if text.find(i[0]) >=0:
+ return i[1]
return ""
def replace_text(text):
for i in replace_text_list:
- if text.find(i[0]) >= 0:
+ while text.find(i[0]) >= 0:
text = text.replace(i[0],i[1])
return text
diff --git a/helpcontent2/to-wiki/wikiconv2.py b/helpcontent2/to-wiki/wikiconv2.py
index 11dfb97cd2..4f884e617b 100755
--- a/helpcontent2/to-wiki/wikiconv2.py
+++ b/helpcontent2/to-wiki/wikiconv2.py
@@ -3,7 +3,7 @@
import sys
import xml.parsers.expat
-root="helpcontent2/source/"
+root="source/"
titles = [[]]