mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Added support for removing duplicates from LRF TOC
This commit is contained in:
parent
f0d5eac2f4
commit
f5d53e6d33
@ -657,6 +657,10 @@ class TableOfContents(object):
|
|||||||
if not hasattr(textBlock.parent, 'objId'):
|
if not hasattr(textBlock.parent, 'objId'):
|
||||||
raise LrsError, "TOC destination must be appended to a container with an objID"
|
raise LrsError, "TOC destination must be appended to a container with an objID"
|
||||||
|
|
||||||
|
for tl in self.tocEntries:
|
||||||
|
if tl.label == tocLabel:
|
||||||
|
return
|
||||||
|
|
||||||
self.tocEntries.append(TocLabel(tocLabel, textBlock))
|
self.tocEntries.append(TocLabel(tocLabel, textBlock))
|
||||||
textBlock.tocLabel = tocLabel
|
textBlock.tocLabel = tocLabel
|
||||||
|
|
||||||
|
89
src/libprs500/ebooks/lrf/txt/demo/demo.txt
Normal file
89
src/libprs500/ebooks/lrf/txt/demo/demo.txt
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
Demonstration of `txt2lrf`
|
||||||
|
==========================
|
||||||
|
|
||||||
|
`txt2lrf` provides a convenient way to create LRF files with good formatting.
|
||||||
|
`txt2lrf` recognizes a simple markup language called *markdown*.
|
||||||
|
|
||||||
|
The idea is to provide a lightweight markup that can be used to create
|
||||||
|
TXT files that can be read by themselves or automatically converted to LRF.
|
||||||
|
[{@name=toc}]()
|
||||||
|
|
||||||
|
<br /><br />
|
||||||
|
|
||||||
|
///Table of Contents///
|
||||||
|
|
||||||
|
|
||||||
|
Text formatting
|
||||||
|
---------------
|
||||||
|
**Bold** and *italic* text is easily specified.
|
||||||
|
|
||||||
|
> Blockquotes are also very simple to specify.
|
||||||
|
> This is a basic blockquote paragraph. I absolutely
|
||||||
|
> love block quotes don't you?
|
||||||
|
|
||||||
|
This is a preformatted code block. No formatting rules are applied to text in this block and it is rendered in a monospaced font.
|
||||||
|
|
||||||
|
|
||||||
|
For details on the text formatting syntax visit
|
||||||
|
|
||||||
|
http://daringfireball.net/projects/markdown/syntax
|
||||||
|
___
|
||||||
|
[Table of Contents](#toc)
|
||||||
|
|
||||||
|
Lists
|
||||||
|
-----
|
||||||
|
Both ordered and unordered lists are supported.
|
||||||
|
|
||||||
|
|
||||||
|
### Unordered lists
|
||||||
|
|
||||||
|
+ What a
|
||||||
|
+ *nice*
|
||||||
|
+ list
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Ordered lists
|
||||||
|
|
||||||
|
1. One
|
||||||
|
2. Two
|
||||||
|
3. Three
|
||||||
|
|
||||||
|
**Note:** Nested lists are not supported
|
||||||
|
|
||||||
|
___
|
||||||
|
[Table of Contents](#toc)
|
||||||
|
|
||||||
|
Tables
|
||||||
|
------
|
||||||
|
|
||||||
|
Simple tables are easily generated
|
||||||
|
|
||||||
|
| |* Col 1 *|* Col 2 *|
|
||||||
|
|* Row 1 *| (1, 1) | (1, 2) |
|
||||||
|
|* Row 2 *| (2, 1) | (2, 2) |
|
||||||
|
|
||||||
|
**Note:** Nested tables are not supported
|
||||||
|
|
||||||
|
___
|
||||||
|
[Table of Contents](#toc)
|
||||||
|
|
||||||
|
Images
|
||||||
|
------
|
||||||
|
|
||||||
|
`txt2lrf` also has support for inline images like
|
||||||
|
 this one.
|
||||||
|
|
||||||
|
___
|
||||||
|
[Table of Contents](#toc)
|
||||||
|
|
||||||
|
Automatic TOC Creation
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
By inserting `///Table of Contents///` into the text at some point
|
||||||
|
a table of contents is automatically generated with links that point
|
||||||
|
to all headings underlined with `-------`.
|
||||||
|
|
||||||
|
___
|
||||||
|
[Table of Contents](#toc)
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user