diff --git a/src/libprs500/ebooks/lrf/pylrs/pylrs.py b/src/libprs500/ebooks/lrf/pylrs/pylrs.py index a298c2ed84..06ecda8238 100644 --- a/src/libprs500/ebooks/lrf/pylrs/pylrs.py +++ b/src/libprs500/ebooks/lrf/pylrs/pylrs.py @@ -657,6 +657,10 @@ class TableOfContents(object): if not hasattr(textBlock.parent, '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)) textBlock.tocLabel = tocLabel diff --git a/src/libprs500/ebooks/lrf/txt/demo/demo.txt b/src/libprs500/ebooks/lrf/txt/demo/demo.txt new file mode 100644 index 0000000000..a8c6579412 --- /dev/null +++ b/src/libprs500/ebooks/lrf/txt/demo/demo.txt @@ -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}]() + +

+ +///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](../../html/demo/small.jpg) 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) +