summaryrefslogtreecommitdiff
path: root/helpcontent2/to-wiki
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@suse.cz>2010-11-09 01:11:40 +0100
committerJan Holesovsky <kendy@suse.cz>2010-11-09 01:11:40 +0100
commitfbcf041a6b4649349261da565da6b096576caed8 (patch)
treeaa1ae4292a4036003412246c7a53ea69e3b5eee5 /helpcontent2/to-wiki
parent588fcbf2e6db68199235afcc6951588ffcd487c4 (diff)
One more column to alltitles.csv - human readable name.
To be used in the 'embed' link targets.
Diffstat (limited to 'helpcontent2/to-wiki')
-rwxr-xr-xhelpcontent2/to-wiki/convall.py2
-rwxr-xr-xhelpcontent2/to-wiki/getalltitles.py42
-rwxr-xr-xhelpcontent2/to-wiki/wikiconv2.py6
3 files changed, 32 insertions, 18 deletions
diff --git a/helpcontent2/to-wiki/convall.py b/helpcontent2/to-wiki/convall.py
index 25e01ea63f..f1daefb72c 100755
--- a/helpcontent2/to-wiki/convall.py
+++ b/helpcontent2/to-wiki/convall.py
@@ -8,7 +8,7 @@ def loadallfiles(filename):
global titles
file=open(filename,"r")
for line in file:
- title = line.split(";")
+ title = line.split(";", 2)
titles.append(title)
loadallfiles("alltitles.csv")
diff --git a/helpcontent2/to-wiki/getalltitles.py b/helpcontent2/to-wiki/getalltitles.py
index 97e2649ee8..a6d7d036d7 100755
--- a/helpcontent2/to-wiki/getalltitles.py
+++ b/helpcontent2/to-wiki/getalltitles.py
@@ -29,15 +29,22 @@ def make_unique(title):
replace_text_list = [
["$[officename]","LibreOffice"],
["%PRODUCTNAME","LibreOffice"],
- ['"+"',"plus"],
- ['"*"',"star"],
- ['"-"',"minus"],
- ['"/"',"slash"],
- ['"^"',"cap"],
+ ['"+"',"Plus"],
+ ['"*"',"Star"],
+ ['"-"',"Minus"],
+ ['"/"',"Slash"],
+ ['"^"',"Cap"],
[')','_'],
['(','_'],
['\\','_'],
- ['/','_']
+ ['/','_'],
+ ['&',"and"],
+ [';','_']
+ ]
+
+replace_readable_list = [
+ ["$[officename]","{{ProductName}}"],
+ ["%PRODUCTNAME","{{ProductName}}"]
]
modules_list = [
@@ -57,18 +64,25 @@ def get_module(text):
return i[1]
return ""
-def replace_text(text):
- for i in replace_text_list:
+def replace_text(text, replace_list):
+ for i in replace_list:
if text.find(i[0]) >= 0:
text = text.replace(i[0],i[1])
return text
+def wiki_text(text):
+ return replace_text(text, replace_text_list)
+
+def readable_text(text):
+ return replace_text(text, replace_readable_list)
+
def start_element(name, attrs):
- global parsing, istitle
+ global parsing, istitle, title
if not parsing:
return
if name == 'title':
istitle=True
+ title = ""
def end_element(name):
global parsing, istitle
@@ -82,7 +96,7 @@ def char_data(data):
global title, parsing
if not istitle:
return
- title = replace_text(data)
+ title = title + data
def parsexhp(filename):
global parsing, title
@@ -96,12 +110,12 @@ def parsexhp(filename):
p.Parse(buf)
file.close()
if len(title):
- title=get_module(filename)+"/"+title
- title = title.replace(" ","_")
+ readable_title = readable_text(title)
+ title = get_module(filename) + "/" + wiki_text(title)
+ title = title.replace(" ", "_")
title = make_unique(title)
alltitles.append(title)
- print filename+";"+title
- title=""
+ print filename + ";" + title + ";" + readable_title
if len(sys.argv) < 2:
print "getalltitles.py <directory>"
diff --git a/helpcontent2/to-wiki/wikiconv2.py b/helpcontent2/to-wiki/wikiconv2.py
index 27d91edafc..03a5a51084 100755
--- a/helpcontent2/to-wiki/wikiconv2.py
+++ b/helpcontent2/to-wiki/wikiconv2.py
@@ -401,7 +401,7 @@ class cparagraph:
self.parent.child_parsing = False
if not self.parser_state:
return
- if self.filter_section != "" and name == 'varable':
+ if self.filter_section != "" and name == 'variable':
self.parser_state = False
global end_eles
@@ -495,9 +495,9 @@ def parsexhp(filename):
def loadallfiles(filename):
global titles
- file=open(filename,"r")
+ file = open(filename, "r")
for line in file:
- title = line.split(";")
+ title = line.split(";", 2)
titles.append(title)
def signal_handler(signal, frame):