mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Merge from trunk
This commit is contained in:
commit
f550395add
@ -133,7 +133,11 @@ class DetectStructure(object):
|
|||||||
|
|
||||||
|
|
||||||
def elem_to_link(self, item, elem, counter):
|
def elem_to_link(self, item, elem, counter):
|
||||||
text = xml2text(elem)
|
text = xml2text(elem).strip()
|
||||||
|
if not text:
|
||||||
|
text = elem.get('title', '')
|
||||||
|
if not text:
|
||||||
|
text = elem.get('alt', '')
|
||||||
text = text[:100].strip()
|
text = text[:100].strip()
|
||||||
id = elem.get('id', 'calibre_toc_%d'%counter)
|
id = elem.get('id', 'calibre_toc_%d'%counter)
|
||||||
elem.set('id', id)
|
elem.set('id', id)
|
||||||
|
@ -472,8 +472,12 @@ class EbookViewer(MainWindow, Ui_EbookViewer):
|
|||||||
if path != self.current_page:
|
if path != self.current_page:
|
||||||
self.pending_anchor = frag
|
self.pending_anchor = frag
|
||||||
self.load_path(path)
|
self.load_path(path)
|
||||||
elif frag:
|
else:
|
||||||
|
if frag:
|
||||||
self.view.scroll_to(frag)
|
self.view.scroll_to(frag)
|
||||||
|
else:
|
||||||
|
# Scroll to top
|
||||||
|
self.view.scroll_to('#')
|
||||||
else:
|
else:
|
||||||
open_url(url)
|
open_url(url)
|
||||||
|
|
||||||
|
@ -377,7 +377,7 @@ They are XPath expressions that match tags in the intermediate XHTML produced by
|
|||||||
how to construct XPath expressions. Next to each option is a button that launches a wizard to help with the creation
|
how to construct XPath expressions. Next to each option is a button that launches a wizard to help with the creation
|
||||||
of basic XPath expressions. The following simple example illustrates how to use these options.
|
of basic XPath expressions. The following simple example illustrates how to use these options.
|
||||||
|
|
||||||
Suppose you have an input document taht results in XHTML that look like this:
|
Suppose you have an input document that results in XHTML that look like this:
|
||||||
|
|
||||||
.. code-block:: html
|
.. code-block:: html
|
||||||
|
|
||||||
@ -418,6 +418,25 @@ This will result in an automatically generated two level Table of Contents that
|
|||||||
Not all output formats support a multi level Table of Contents. You should first try with EPUB Output. If that
|
Not all output formats support a multi level Table of Contents. You should first try with EPUB Output. If that
|
||||||
works, then try your format of choice.
|
works, then try your format of choice.
|
||||||
|
|
||||||
|
Using images as chapter titles when converting HTML input documents
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
|
Suppose you want to use an image as your chapter title, but still want |app| to be able to automatically generate a Table of Contents for you from the chapter titles.
|
||||||
|
Use the following HTML markup to achieve this
|
||||||
|
|
||||||
|
.. code-block:: html
|
||||||
|
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
<h2>Chapter 1</h2>
|
||||||
|
<p>chapter 1 text...</p>
|
||||||
|
<h2 title="Chapter 2"><img src="chapter2.jpg" /></h2>
|
||||||
|
<p>chapter 2 text...</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
Set the :guilabel:`Level 1 TOC` setting to ``//h:h2``. Then, for chapter two, |app| will take the title from the value of the ``title`` attribute on the ``<h2>`` tag, since the tag has no text.
|
||||||
|
|
||||||
How options are set/saved for Conversion
|
How options are set/saved for Conversion
|
||||||
-------------------------------------------
|
-------------------------------------------
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user