summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@suse.cz>2010-11-05 15:23:44 +0100
committerJan Holesovsky <kendy@suse.cz>2010-11-05 15:23:44 +0100
commit31c7e54ff143053c8cdc791a0e9328841a70d194 (patch)
tree6d749aa89a5f68fb5676212bb8172c6ec7ce9d8b
parent46765b21fdd0bfb1fb1edb0ce8b61585ac1d6f0a (diff)
Do not write heading starts with every char_data.
-rwxr-xr-xhelpcontent2/to-wiki/convall.py9
-rwxr-xr-xhelpcontent2/to-wiki/wikiconv2.py22
2 files changed, 19 insertions, 12 deletions
diff --git a/helpcontent2/to-wiki/convall.py b/helpcontent2/to-wiki/convall.py
index cc02822e0d..25e01ea63f 100755
--- a/helpcontent2/to-wiki/convall.py
+++ b/helpcontent2/to-wiki/convall.py
@@ -27,11 +27,10 @@ for title in titles:
try:
file = open(outfile,"r")
except:
- print "Processing: "+infile
- if not os.system(command):
- # print "Failed: "+command
- # sys.exit(1)
- pass
+ #print "Processing: "+infile
+ if os.system(command) != 0:
+ print "Failed: "+command
+ sys.exit(1)
continue
print "Warning: Skipping: "+command
file.close()
diff --git a/helpcontent2/to-wiki/wikiconv2.py b/helpcontent2/to-wiki/wikiconv2.py
index 1a1a173cdb..fbd3cb9198 100755
--- a/helpcontent2/to-wiki/wikiconv2.py
+++ b/helpcontent2/to-wiki/wikiconv2.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-import sys
+import sys, signal
import xml.parsers.expat
root="source/"
@@ -416,12 +416,7 @@ class cparagraph:
def char_data(self, data):
if not self.parser_state or not len(data.strip()):
return
- text=""
- if self.heading:
- text = heading(self.depth) + " " + data + " "+heading(self.depth)
- else:
- text = data
- self.objects.append(ctext(text))
+ self.objects.append(ctext(data))
#self.wikitext = self.wikitext + text
def print_all(self):
@@ -432,6 +427,10 @@ class cparagraph:
print text.encode('ascii','replace')
return
+ # mark this as the heading
+ if self.objects.len() > 0 and self.heading:
+ print heading(self.depth)
+
for i in self.objects:
try:
raise i
@@ -447,6 +446,10 @@ class cparagraph:
if len(self.wikitext):
print self.wikitext
+ # end of the heading mark
+ if self.objects.len() > 0 and self.heading:
+ print heading(self.depth)
+
def get_all(self):
for i in self.objects:
try:
@@ -494,6 +497,11 @@ def loadallfiles(filename):
title = line.split(";")
titles.append(title)
+def signal_handler(signal, frame):
+ sys.snderr.write( "You pressed Ctrl+C!" )
+ sys.exit(1)
+signal.signal(signal.SIGINT, signal_handler)
+
if len(sys.argv) < 2:
print "wikiconv2.py <inputfile.xph>"
sys.exit(1)