mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
This commit is contained in:
parent
9018fe3eff
commit
14c8f810dc
@ -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
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ def update_manifest(src):
|
|||||||
|
|
||||||
def validate(file=None):
|
def validate(file=None):
|
||||||
br = browser()
|
br = browser()
|
||||||
files = [file] if file is not None else glob.glob('*.html')
|
files = [file] if file is not None else glob.glob('*.html')
|
||||||
for f in files:
|
for f in files:
|
||||||
if f.startswith('preview-'):
|
if f.startswith('preview-'):
|
||||||
continue
|
continue
|
||||||
@ -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;)', '&', 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)
|
||||||
|
|
||||||
@ -313,9 +315,13 @@ if __name__ == '__main__':
|
|||||||
fargs = []
|
fargs = []
|
||||||
if args[0] == 'all':
|
if args[0] == 'all':
|
||||||
fargs = [opts]
|
fargs = [opts]
|
||||||
elif len(args) > 1:
|
elif len(args) > 1:
|
||||||
fargs = args[1:]
|
func = eval(args[0])
|
||||||
|
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)
|
@ -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">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user