[devhelp] attic: remove trail spaces
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devhelp] attic: remove trail spaces
- Date: Tue, 22 May 2018 09:57:15 +0000 (UTC)
commit 7ad3da2aee667b4f72d078173d32b2335cc8da8d
Author: Sébastien Wilmet <swilmet gnome org>
Date: Tue May 22 11:50:25 2018 +0200
attic: remove trail spaces
attic/html2funcs.py | 4 ++--
attic/html2xml.py | 36 ++++++++++++++++++------------------
attic/man2xml.py | 36 ++++++++++++++++++------------------
3 files changed, 38 insertions(+), 38 deletions(-)
---
diff --git a/attic/html2funcs.py b/attic/html2funcs.py
index 433cb24..0fe179c 100755
--- a/attic/html2funcs.py
+++ b/attic/html2funcs.py
@@ -29,7 +29,7 @@ class HTMLParser (htmllib.HTMLParser):
if self.link[:2] == "..":
return
-
+
if self.is_a and self.link:
self.a.append ((data, self.link))
@@ -55,7 +55,7 @@ for file in files:
print "parsing", file
links = parse_file (dirname + "/" + file, bookname)
-
+
for link in links:
if not link in funcs:
funcs.append (link)
diff --git a/attic/html2xml.py b/attic/html2xml.py
index 697c1cd..9fd27a3 100755
--- a/attic/html2xml.py
+++ b/attic/html2xml.py
@@ -17,7 +17,7 @@ def walk (dict, level=0, parent=None):
list = dict['order']
else:
list = dict.keys()
-
+
for key in list:
if key in ['name', 'order', 'link']:
continue
@@ -26,14 +26,14 @@ def walk (dict, level=0, parent=None):
link = dict[key]['link']
else:
link = ""
-
+
if level:
print '*' * level, key, '-', link
else:
print key, '-', link
walk (dict[key], level + 1, dict)
-
+
class BookParser (sgmllib.SGMLParser):
def __init__ (self):
sgmllib.SGMLParser.__init__ (self)
@@ -50,32 +50,32 @@ class BookParser (sgmllib.SGMLParser):
if attr[0] == "href":
self.link = attr[1]
break
-
+
if tag in ['dd', 'ul']:
self.parents.append (self.last)
self.level = self.level + 1
-
+
def unknown_endtag (self, tag):
if tag == 'a':
self.is_a = 0
-
+
if tag in ['dd', 'ul']:
self.level = self.level - 1
self.parents.pop()
-
+
def handle_data (self, data):
data = string.strip (data)
if not data or data in [ ">", "<" ]:
return
-
+
if self.first:
self.dict['name'] = data
self.first = 0
return
-
+
if data == self.dict['name'] or data in [ "Next Page", "Previous Page", "Home", "Next"]:
return
-
+
if len (self.parents) == 0:
dict = self.dict
elif len (self.parents) == 1:
@@ -86,18 +86,18 @@ class BookParser (sgmllib.SGMLParser):
dict = self.dict[self.parents[0]][self.parents[1]][self.parents[2]]
else:
dict = None
-
+
if self.is_a:
if dict == None:
return
-
+
if not dict.has_key (data):
- dict[data] = {}
+ dict[data] = {}
if not dict.has_key ('order'):
dict['order'] = []
dict['order'].append (data)
dict[data]['link'] = self.link
-
+
self.last = data
def parse_book (url):
@@ -110,7 +110,7 @@ def parse_book (url):
else:
print "Error; Can't find an index :("
raise SystemExit
-
+
fd = open (filename)
p = BookParser()
p.feed (fd.read())
@@ -131,16 +131,16 @@ for chap in dict['order']:
for sub in dict[chap]['order']:
if not does_dict_have_keys (dict[chap][sub], ['link']):
print ' <sub name="%s" link="%s">' % (sub, dict[chap][sub]['link'])
-
+
for sub2 in dict[chap][sub]['order']:
print ' <sub name="%s" link="%s"/>' % (sub2, dict[chap][sub][sub2]['link'])
print ' </sub>'
else:
print ' <sub name="%s" link="%s"/>' % (sub, dict[chap][sub]['link'])
-
+
print ' </sub>'
print
-
+
print '</chapters>'
print
print '</book>'
diff --git a/attic/man2xml.py b/attic/man2xml.py
index 18d78d8..8499eb9 100755
--- a/attic/man2xml.py
+++ b/attic/man2xml.py
@@ -4,21 +4,21 @@ import os.path
import string
# Add $GNOME_PATH/man too
-MAN_PATH = ["/usr/man", "/usr/share/man", "/usr/local/man"]
+MAN_PATH = ["/usr/man", "/usr/share/man", "/usr/local/man"]
MAN_SUBS = ["man1", "man2", "man3", "man4", "man5",
"man6", "man7", "man8", "man9"]
-MAN_NAME = { "man1" : "Applications",
- "man2" : "System Calls",
+MAN_NAME = { "man1" : "Applications",
+ "man2" : "System Calls",
"man3" : "Library Functions",
- "man4" : "Devices",
- "man5" : "Configuration Files",
+ "man4" : "Devices",
+ "man5" : "Configuration Files",
"man6" : "Games",
- "man7" : "Conventions",
- "man8" : "System Administration",
+ "man7" : "Conventions",
+ "man8" : "System Administration",
"man9" : "Kernel Routines"}
-# 1. Get a list of all mandirs
+# 1. Get a list of all mandirs
chapters = []
for mandir in MAN_PATH:
dir_list = os.listdir (mandir)
@@ -26,7 +26,7 @@ for mandir in MAN_PATH:
if os.path.isdir (mandir + "/" + dir) and dir in MAN_SUBS:
chapters.append (mandir + "/" + dir)
-# 2. Get a list of all manpages
+# 2. Get a list of all manpages
man_pages = {}
funcs = []
for mandir in chapters:
@@ -36,25 +36,25 @@ for mandir in chapters:
name, section = string.split (file, ".", 1)
if section[-3:] == ".gz":
section = section[:-3]
-
+
man = os.path.basename (mandir)
filename = mandir + "/" + file
-
+
# Check out section 2* and 3*, but not 3pm
if section in ['2', '3'] and section[-2:] != "pm":
# Remove perl funtions
if string.find (name, "::") == -1:
funcs.append ((name, filename))
-
+
# Does the the dict have the key?
if not man_pages.has_key (man):
man_pages[man] = []
-
+
if name == "." or not name:
continue
-
+
man_pages[man].append ((name, filename))
-
+
# 3. Print out xml
print '<?xml version="1.0"?>'
print '<book title="Man pages">'
@@ -69,7 +69,7 @@ for chap in chapters:
name = os.path.basename (chap)
if not man_pages.has_key (name):
continue
-
+
if name in written:
continue
written.append (name)
@@ -77,7 +77,7 @@ for chap in chapters:
print ' <chapter name="%s">' % MAN_NAME[name]
list = man_pages[name]
list.sort()
-
+
for name, page in list:
print ' <sub name="%s" link="%s"/>' % (name, page)
print ' </chapter>'
@@ -96,4 +96,4 @@ print '</functions>'
print
print '</book>'
-
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]