This commit is contained in:
Kovid Goyal 2008-02-29 18:16:57 +00:00
parent 9018fe3eff
commit 14c8f810dc
2 changed files with 13 additions and 7 deletions

View File

@ -16,7 +16,7 @@
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
'''''' ''''''
import sys, glob, mechanize, time, subprocess, os, shutil import sys, glob, mechanize, time, subprocess, os, shutil, re
from tempfile import NamedTemporaryFile from tempfile import NamedTemporaryFile
from xml.etree.ElementTree import parse, tostring, fromstring from xml.etree.ElementTree import parse, tostring, fromstring
@ -257,6 +257,7 @@ def generate_cli_docs():
def create_html_interface(src='libprs500.qhp'): def create_html_interface(src='libprs500.qhp'):
root = parse(src).getroot() root = parse(src).getroot()
print
toc = root.find('filterSection').find('toc') toc = root.find('filterSection').find('toc')
def is_leaf(sec): def is_leaf(sec):
@ -266,7 +267,8 @@ def create_html_interface(src='libprs500.qhp'):
def process_branch(branch, toplevel=False): def process_branch(branch, toplevel=False):
parent = [] parent = []
for sec in branch.findall('section'): for sec in branch.findall('section'):
html = '<li class="||||">\n<a target="content" href="%s">%s</a>\n</li>\n'%(sec.attrib['ref'], sec.attrib['title']) title = re.sub('&(?!amp;)', '&amp;', sec.attrib['title'])
html = '<li class="||||">\n<a target="content" href="%s">%s</a>\n</li>\n'%(sec.attrib['ref'], title)
lc = 'toplevel' if toplevel else 'nottoplevel' lc = 'toplevel' if toplevel else 'nottoplevel'
html=html.replace('||||', '%s ||||'%lc) html=html.replace('||||', '%s ||||'%lc)
@ -314,8 +316,12 @@ if __name__ == '__main__':
if args[0] == 'all': if args[0] == 'all':
fargs = [opts] fargs = [opts]
elif len(args) > 1: elif len(args) > 1:
func = eval(args[0])
fargs = args[1:] fargs = args[1:]
if func is None: if func is None:
print >>sys.stderr, 'Unknown target', sys.argv(1) print >>sys.stderr, 'Unknown target', sys.argv(1)
sys.exit(1) sys.exit(1)
sys.exit(func(*fargs)) sys.exit(func(*fargs))
else:
parser.print_help()
sys.exit(1)

View File

@ -2,7 +2,7 @@
"http://www.w3.org/TR/html4/loose.dtd"> "http://www.w3.org/TR/html4/loose.dtd">
<html> <html>
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script> <script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script>
<link rel="stylesheet" href="http://dev.jquery.com/view/trunk/plugins/treeview/jquery.treeview.css" type="text/css"> <link rel="stylesheet" href="http://dev.jquery.com/view/trunk/plugins/treeview/jquery.treeview.css" type="text/css">
<link rel="stylesheet" href="styles/common.css" type="text/css"> <link rel="stylesheet" href="styles/common.css" type="text/css">