View Single Post
Old 05-26-2007, 03:53 PM   #61
EatingPie
Blueberry!
EatingPie puts his or her pants on both legs at a time.EatingPie puts his or her pants on both legs at a time.EatingPie puts his or her pants on both legs at a time.EatingPie puts his or her pants on both legs at a time.EatingPie puts his or her pants on both legs at a time.EatingPie puts his or her pants on both legs at a time.EatingPie puts his or her pants on both legs at a time.EatingPie puts his or her pants on both legs at a time.EatingPie puts his or her pants on both legs at a time.EatingPie puts his or her pants on both legs at a time.EatingPie puts his or her pants on both legs at a time.
 
EatingPie's Avatar
 
Posts: 888
Karma: 133343
Join Date: Mar 2007
Device: Sony PRS-500 (RIP); PRS-600 (Good Riddance); PRS-505; PRS-650; PRS-350
Post Pielrf - Text to LRF Tool

HarryT suggested I post a little info about my new utility pielrf for converting e-books in text form to LRF format. I designed pielrf with Guteberg and OCR books in mind.

Pielrf duplicates the look of Sony Connect EBooks, while incorporating ease of use, and full control over options. It includes much-requested features easy table of contents, chapterization, top-of-page headers, and curly quotes.

Most books only take a few minutes of preparation.

You can download pielrf from the follwing thread.
Here's a few basics

RUNNING THE PROGRAM
pielrf -i infile.txt -o outfile.lrf -t "Book Title" -a "Author Name"
This will generate a basic LRF file, with a single "Table of Contents" entry, flowed paragraphs, curly-quotes and page headers.

EDITING THE INPUT FILE

If you want a Table of Contents and Chapters, it takes just ONE WORD(!!) in your book's text file!
<chapter>
If your book is like this...

Chapter One
...Some Text
...
Chapter Two
...Some More Text
Just do this...

<chapter>Chapter One
...Some Text
...
<chapter>Chapter Two
...Some More Text
Both chapters are added to the Reader's Table of Contents, as well as a "Table of Contents" page. "Chapter One" and "Chapter Two" are also made headers for their respective chapters.

That's the only editing needed, and the rest is done automatically.

One Addition tag allows you to add text and vertical spacing on the TOC page.
<toctext>
Putting it on a line by itself adds a blank line to the TOC. Following it with text, similar to "<chapter>," adds that text to the TOC page.

HTML FOR TYPOGRAPHY

Unlike BookDesigner, you need to edit the input text file separately and add typographic HTML tags by hand before running pielrf. While, for example, BookDesigner lets you highlight text and select "Italics," here, you would add the HTML tags "<i>" and "</i>" yourself.

The file does not have to be actual HTML (although it can be), you can add these tags to any plain text file.

Recognized Tags

<CENTER></CENTER> - Centered Text
<I></I> - Italics
<B></B> - Bold
<SUB></SUB> - Subscript
<SUP></SUP> - Superscript
<BR> - Line Break (Vertical Whitespace)
<P> - Paragraph (Use With "-b html" Command Line Switch)
<H1></H1>
<H2></H2>
<H3></H3> - Heading (Bold+Large Font) Tags (all resolve to same font size)

You can combine tags like "<center>" and "<h1>" for example, with the only limit being bold and italics -- its one or the other, so you won't get bold-italic text.

FEATURES

+ Table of Contents Menu and Page via the <chapter> tag.
+ Top-of-Page headers
+ Curly (typographic) quotes.
+ Paragraph auto-flow.
+ Can make whole book Bold to increase contrast.
+ Understands HTML tags <i></i>, <b></b>, <center></center>, <sub></sub>, <sup></sup>, <p></p>, <h1></h1>-<h3></h3>.
+ Understands ALL HTML Ampersand tags - &amp;, &pound, &uumlat, etc.
+ Paragraphs can be delimited by tabs, spaces, vertical whitespace.
+ Font size / weight (bold) can be controlled from command line.
+ Ability to control almost everything else from the command line too!

OPTION OVERLOAD

You can control just about every option regarding layout. The defaults should work just fine, and all you need to provide are the input and output files, and a title and author. But to see the options just type:
pielrf -h
I provide a couple of examples in the next post.

-Pie

Last edited by EatingPie; 05-26-2007 at 09:29 PM. Reason: Sheesh, I'm typo king.
EatingPie is offline   Reply With Quote