mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
This commit is contained in:
parent
2c5802676d
commit
158137ff5c
@ -25,7 +25,7 @@
|
||||
<p>
|
||||
The interface is divided into various sections:
|
||||
</p>
|
||||
<ul>
|
||||
<ul id="toc">
|
||||
<li><a href="#actions">Actions</a></li>
|
||||
<li><a href="#catalogs">Catalogs</a></li>
|
||||
<li><a href="#search_sort">Search & Sort</a></li>
|
||||
|
@ -10,40 +10,37 @@
|
||||
<filterAttribute>libprs500</filterAttribute>
|
||||
|
||||
<toc>
|
||||
<section ref="start.html" title="Start" />
|
||||
|
||||
<section ref="gui.html" title="The Graphical User Interface">
|
||||
<section ref="gui.html#actions" title="Actions" />
|
||||
<section ref="gui.html#catalogs" title="Catalogs" />
|
||||
<section ref="gui.html#search_sort" title="Search & Sort" />
|
||||
<section ref="gui.html#configuration" title="Configuration" />
|
||||
<section ref="gui.html#book_details" title="Book Details" />
|
||||
<section ref="gui.html#jobs" title="Jobs" />
|
||||
<section ref="gui.html" title="Graphical User Interface">
|
||||
<section ref="#actions" title="Actions" />
|
||||
<section ref="#catalogs" title="Catalogs" />
|
||||
<section ref="#search_sort" title="Search & Sort" />
|
||||
<section ref="#configuration" title="Configuration" />
|
||||
<section ref="#book_details" title="Book Details" />
|
||||
<section ref="#jobs" title="Jobs" />
|
||||
</section>
|
||||
|
||||
<section ref="cli-index.html" title="The Command Line Interface">
|
||||
<section ref="cli-any2lrf.html" title="any2lrf" />
|
||||
<section ref="cli-epub2lrf.html" title="epub2lrf" />
|
||||
<section ref="cli-html2lrf.html" title="html2lrf" />
|
||||
<section ref="cli-index.html" title="Command Line Interface">
|
||||
<section ref="cli-isbndb.html" title="isbndb" />
|
||||
<section ref="cli-librarything.html" title="librarything" />
|
||||
<section ref="cli-lit2lrf.html" title="lit2lrf" />
|
||||
<section ref="cli-lrf-meta.html" title="lrf-meta" />
|
||||
<section ref="cli-lrf2html.html" title="lrf2html" />
|
||||
<section ref="cli-lrf2lrs.html" title="lrf2lrs" />
|
||||
<section ref="cli-lrs2lrf.html" title="lrs2lrf" />
|
||||
<section ref="cli-mobi2lrf.html" title="mobi2lrf" />
|
||||
<section ref="cli-mobi2oeb.html" title="mobi2oeb" />
|
||||
<section ref="cli-opf-meta.html" title="opf-meta" />
|
||||
<section ref="cli-pdf2lrf.html" title="pdf2lrf" />
|
||||
<section ref="cli-pdfreflow.html" title="pdfreflow" />
|
||||
<section ref="cli-rtf-meta.html" title="rtf-meta" />
|
||||
<section ref="cli-rtf2lrf.html" title="rtf2lrf" />
|
||||
<section ref="cli-mobi2lrf.html" title="mobi2lrf" />
|
||||
<section ref="cli-lrf-meta.html" title="lrf-meta" />
|
||||
<section ref="cli-lit2lrf.html" title="lit2lrf" />
|
||||
<section ref="cli-lrf2lrs.html" title="lrf2lrs" />
|
||||
<section ref="cli-index.html" title="index" />
|
||||
<section ref="cli-web2lrf.html" title="web2lrf" />
|
||||
<section ref="cli-lrs2lrf.html" title="lrs2lrf" />
|
||||
<section ref="cli-txt2lrf.html" title="txt2lrf" />
|
||||
<section ref="cli-web2disk.html" title="web2disk" />
|
||||
<section ref="cli-web2lrf.html" title="web2lrf" />
|
||||
<section ref="cli-opf-meta.html" title="opf-meta" />
|
||||
<section ref="cli-html2lrf.html" title="html2lrf" />
|
||||
<section ref="cli-rtf2lrf.html" title="rtf2lrf" />
|
||||
<section ref="cli-librarything.html" title="librarything" />
|
||||
<section ref="cli-epub2lrf.html" title="epub2lrf" />
|
||||
<section ref="cli-rtf-meta.html" title="rtf-meta" />
|
||||
<section ref="cli-pdf2lrf.html" title="pdf2lrf" />
|
||||
<section ref="cli-lrf2html.html" title="lrf2html" />
|
||||
<section ref="cli-any2lrf.html" title="any2lrf" />
|
||||
<section ref="cli-mobi2oeb.html" title="mobi2oeb" />
|
||||
</section>
|
||||
|
||||
<section ref="faq.html" title="Frequently Asked Questions">
|
||||
<section ref="faq.html#Whatdevicesdoeslibprs500support" title="What devices does libprs500 support?" />
|
||||
<section ref="faq.html#Whatformatsdoeslibprs500readmetadatafrom" title="What formats does libprs500 read metadata from?" />
|
||||
@ -58,8 +55,7 @@
|
||||
<section ref="faq.html#Iwantsomefeatureaddedtolibprs500.WhatcanIdo" title="I want some feature added to libprs500. What can I do?" />
|
||||
<section ref="faq.html#HowdoIusesomeoftheadvancedfeaturesoftheconversiontools" title="How do I use some of the advanced features of the conversion tools?" />
|
||||
</section>
|
||||
|
||||
</toc>
|
||||
</toc>
|
||||
|
||||
<files>
|
||||
<file>cli-isbndb.html</file>
|
||||
@ -107,7 +103,6 @@
|
||||
<file>images/fetch_news.png</file>
|
||||
<file>images/cli.png</file>
|
||||
</files>
|
||||
|
||||
</filterSection>
|
||||
|
||||
</QtHelpProject>
|
||||
</QtHelpProject>
|
@ -16,14 +16,14 @@
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
''''''
|
||||
|
||||
import sys, glob, mechanize, time, subprocess, os, re, shutil
|
||||
import sys, glob, mechanize, time, subprocess, os, shutil
|
||||
from tempfile import NamedTemporaryFile
|
||||
from xml.etree.ElementTree import parse, tostring, fromstring, Element
|
||||
from BeautifulSoup import BeautifulSoup
|
||||
from xml.etree.ElementTree import parse, tostring, fromstring
|
||||
|
||||
# Load libprs500 from source copy
|
||||
sys.path[0:1] = [os.path.dirname(os.path.dirname(os.getcwdu()))]
|
||||
sys.path.insert(1, os.path.dirname(os.path.dirname(os.getcwdu())))
|
||||
|
||||
from libprs500.ebooks.BeautifulSoup import BeautifulSoup
|
||||
from libprs500.linux import entry_points
|
||||
|
||||
def browser():
|
||||
@ -33,24 +33,30 @@ def browser():
|
||||
opener.addheaders = [('User-agent', 'Mozilla/5.0 (X11; U; i686 Linux; en_US; rv:1.8.0.4) Gecko/20060508 Firefox/1.5.0.4')]
|
||||
return opener
|
||||
|
||||
def update_manifest(src='libprs500.qhp'):
|
||||
root = parse(src).getroot()
|
||||
def update_manifest(src):
|
||||
root = fromstring(src)
|
||||
files = root.find('filterSection').find('files')
|
||||
attrs = files.attrib.copy()
|
||||
files.clear()
|
||||
files.attrib = attrs
|
||||
files.text = '\n%12s'%' '
|
||||
files.tail = '\n%4s'%' '
|
||||
|
||||
for f in glob.glob('*.html')+glob.glob('styles/*.css')+glob.glob('images/*'):
|
||||
if f.startswith('preview') or f in ('navtree.html', 'index.html'):
|
||||
continue
|
||||
files.append(fromstring('<file>%s</file>'%f))
|
||||
el = fromstring('<file>%s</file>'%f)
|
||||
el.tail = '\n%12s'%' '
|
||||
files.append(el)
|
||||
el.tail = '\n%8s'%' '
|
||||
|
||||
raw = tostring(root, 'UTF-8').replace('<file>', '\n <file>')
|
||||
raw = raw.replace('</files>', '\n </files>')
|
||||
raw = raw.replace('</filterSection>', '\n\n </filterSection>')
|
||||
open(src, 'wb').write(raw+'\n')
|
||||
return tostring(root, 'UTF-8').decode('UTF-8')
|
||||
|
||||
|
||||
def validate():
|
||||
def validate(file=None):
|
||||
br = browser()
|
||||
for f in glob.glob('*.html'):
|
||||
files = [file] if file is not None else glob.glob('*.html')
|
||||
for f in files:
|
||||
if f.startswith('preview-'):
|
||||
continue
|
||||
print 'Validating', f
|
||||
@ -90,45 +96,87 @@ def compile_help():
|
||||
subprocess.call((QTA, '-collectionFile', 'libprs500.qhc'))
|
||||
|
||||
|
||||
def populate_section(secref, items, src='libprs500.qhp'):
|
||||
root = parse(src).getroot()
|
||||
def populate_section(secref, items, src):
|
||||
root = fromstring(src)
|
||||
toc = root.find('filterSection').find('toc')
|
||||
sec = None
|
||||
|
||||
for c in toc.findall('section'):
|
||||
if c.attrib['ref'] == secref:
|
||||
sec = c
|
||||
break
|
||||
if secref is None:
|
||||
sec = toc
|
||||
ss = '\n%8s'%' '
|
||||
ls = '\n%12s'%' '
|
||||
else:
|
||||
for c in toc.findall('section'):
|
||||
if c.attrib['ref'] == secref:
|
||||
sec = c
|
||||
break
|
||||
ss = '\n%12s'%' '
|
||||
ls = '\n%16s'%' '
|
||||
|
||||
attr = sec.attrib.copy()
|
||||
attr = sec.attrib.copy()
|
||||
tail = sec.tail
|
||||
sec.clear()
|
||||
sec.attrib = attr
|
||||
sec.text = '\n%16s'%' '
|
||||
sec.tail = tail
|
||||
sec.text = ls
|
||||
secs = ['<section ref="%s" title="%s" />\n'%i for i in items]
|
||||
sec.tail = '\n\n%12s'%' '
|
||||
sec.tail = ss
|
||||
for i in secs:
|
||||
el = fromstring(i)
|
||||
sec.append(el)
|
||||
if secs.index(i) == len(secs)-1:
|
||||
el.tail = '\n%12s'%' '
|
||||
else:
|
||||
el.tail = '\n%16s'%' '
|
||||
|
||||
el.tail = ss if i is secs[-1] else ls
|
||||
|
||||
raw = tostring(root, 'UTF-8')
|
||||
|
||||
open(src, 'wb').write(raw)
|
||||
return raw.decode('UTF-8')
|
||||
|
||||
def populate_faq(src='libprs500.qhp'):
|
||||
def populate_faq(src):
|
||||
soup = BeautifulSoup(open('faq.html').read().decode('UTF-8'))
|
||||
items = []
|
||||
toc = soup.find('div', id="toc")
|
||||
for a in toc('a', href=True):
|
||||
items.append(('faq.html%s'%a['href'], a.string))
|
||||
|
||||
populate_section('faq.html', items, src=src)
|
||||
return populate_section('faq.html', items, src=src)
|
||||
|
||||
def generate_cli_docs(src='libprs500.qhp'):
|
||||
def populate_cli(src):
|
||||
cmds = []
|
||||
for f in glob.glob('cli-*.html'):
|
||||
cmds.append(f[4:].rpartition('.')[0])
|
||||
|
||||
items = [('cli-%s.html'%i, i) for i in cmds]
|
||||
return populate_section('cli-index.html', items, src)
|
||||
|
||||
def populate_toc(src):
|
||||
soup = BeautifulSoup(open('start.html', 'rb').read().decode('UTF-8'))
|
||||
sections = []
|
||||
for a in soup.find(id='toc').findAll('a'):
|
||||
sections.append((a['href'], a.string))
|
||||
|
||||
return populate_section(None, sections, src)
|
||||
|
||||
def populate_gui(src):
|
||||
soup = BeautifulSoup(open('gui.html', 'rb').read().decode('UTF-8'))
|
||||
sections = []
|
||||
for a in soup.find(id='toc').findAll('a'):
|
||||
sections.append((a['href'], a.string))
|
||||
|
||||
return populate_section('gui.html', sections, src)
|
||||
|
||||
def qhp():
|
||||
src = open('libprs500.qhp', 'rb').read().decode('UTf-8')
|
||||
src = update_manifest(src)
|
||||
src = populate_toc(src)
|
||||
src = populate_gui(src)
|
||||
src = populate_faq(src)
|
||||
src = populate_cli(src)
|
||||
|
||||
root = fromstring(src)
|
||||
root.find('filterSection').find('toc')[-1].tail = '\n%8s'%' '
|
||||
root.find('filterSection').find('toc').tail = '\n\n%8s'%' '
|
||||
|
||||
open('libprs500.qhp', 'wb').write(tostring(root, encoding='UTF-8'))
|
||||
|
||||
def generate_cli_docs():
|
||||
documented_cmds = []
|
||||
undocumented_cmds = []
|
||||
|
||||
@ -175,7 +223,7 @@ def generate_cli_docs(src='libprs500.qhp'):
|
||||
name = '%s<br />%s'%(lgf, shf)
|
||||
help = sanitize_text(opt.help) if opt.help else ''
|
||||
res.append('<tr><td class="option">%s</td><td>%s</td></tr>'%(name, help))
|
||||
return '\n'.join(res)
|
||||
return '\n%8s'%' ' + ('\n%8s'%' ').join(res)
|
||||
|
||||
|
||||
gh = [group_html(None, None, parser.option_list)]
|
||||
@ -184,8 +232,8 @@ def generate_cli_docs(src='libprs500.qhp'):
|
||||
gh.append(group_html(title, desc, olist))
|
||||
|
||||
if ''.join(gh).strip():
|
||||
body += '\n<h2 class="sectionHeading">[options]</h2>\n'
|
||||
body += '\n<table class="option_table">\n%s\n</table>\n'%'\n'.join(gh)
|
||||
body += '\n <h2 class="sectionHeading">[options]</h2>\n'
|
||||
body += '\n <table class="option_table">\n%s\n </table>\n'%'\n'.join(gh)
|
||||
output.write(template.replace('%body', body))
|
||||
|
||||
uc_html = '\n<ul class="cmdlist">\n%s</ul>\n'%'\n'.join(\
|
||||
@ -202,9 +250,7 @@ def generate_cli_docs(src='libprs500.qhp'):
|
||||
open('cli-index.html', 'wb').write(template.replace('%body', body))
|
||||
|
||||
|
||||
cmds = [i[0] for i in documented_cmds]
|
||||
items = [('cli-%s.html'%i, i) for i in cmds]
|
||||
populate_section('cli-index.html', items, src=src)
|
||||
|
||||
|
||||
|
||||
|
||||
@ -242,9 +288,9 @@ def create_html_interface(src='libprs500.qhp'):
|
||||
|
||||
|
||||
def all(opts):
|
||||
clean()
|
||||
generate_cli_docs()
|
||||
populate_faq()
|
||||
update_manifest()
|
||||
qhp()
|
||||
create_html_interface()
|
||||
compile_help()
|
||||
if opts.validate:
|
||||
@ -254,7 +300,7 @@ def all(opts):
|
||||
|
||||
if __name__ == '__main__':
|
||||
from libprs500 import OptionParser
|
||||
parser = OptionParser()
|
||||
parser = OptionParser(usage='%prog [options] target [arguments to target]')
|
||||
parser.add_option('--validate', default=False, action='store_true',
|
||||
help='Validate all HTML files against their DTDs.')
|
||||
opts, args = parser.parse_args()
|
||||
@ -267,6 +313,8 @@ if __name__ == '__main__':
|
||||
fargs = []
|
||||
if args[0] == 'all':
|
||||
fargs = [opts]
|
||||
elif len(args) > 1:
|
||||
fargs = args[1:]
|
||||
if func is None:
|
||||
print >>sys.stderr, 'Unknown target', sys.argv(1)
|
||||
sys.exit(1)
|
||||
|
@ -13,6 +13,33 @@
|
||||
|
||||
|
||||
<body>
|
||||
<h1 class="documentHeading">libprs500 User Manual</h1>
|
||||
<p>
|
||||
<b>libprs500</b> is an e-book library manager. It can view, convert and catalog e-books
|
||||
in most of the major e-book formats. It can also talk to a few e-book reader devices. It can
|
||||
go out to the internet and fetch metadata for your books. It can download newspapers and convert
|
||||
them into e-books for convenient reading. It is cross platform, running on Linux, Windows and OS X.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
To get started you should use the <a href="gui.html">Graphical User Interface</a>. It can be launched
|
||||
using its icon or the command <span class="cmd">libprs500</span>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
For advanced usage you should check out the <a href="cli-index.html">Command Line Interface</a>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
You may find the list of <a href="faq.html">Frequently Asked Questions</a> useful as well.
|
||||
</p>
|
||||
|
||||
<h2>Table of Contents</h2>
|
||||
<ul id="toc">
|
||||
<li><a href="gui.html">Graphical User Interface</a></li>
|
||||
<li><a href="cli-index.html">Command Line Interface</a></li>
|
||||
<li><a href="faq.html">Frequently Asked Questions</a></li>
|
||||
</ul>
|
||||
|
||||
<hr />
|
||||
<div class="footer">
|
||||
|
Loading…
x
Reference in New Issue
Block a user