View Single Post
Old 09-16-2017, 12:29 AM   #1
AlanHK
Guru
AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.
 
AlanHK's Avatar
 
Posts: 681
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
Generate TOC and linebreaks

I often have books with chapter heads like:

<h2>One<br/>Chapter Title</h2>

If I do "Generate TOC" that makes a TOC entry named
"OneChapter Title"

i.e., just deletes the linebreak.
When rewrapping lines, normally you replace a linebreak with a space. You don't join words together.

I can of course manually edit spaces or punctuation, but could this be made automatic? Then if I have to regenerate the TOC and then the HTML TOC from it, I don't have to make the same corrections again.

Ideally, make it an option: "Replace <br/> with" any character(s), default space. or none as now (some book headings have blank lines for spacing).
Also should collapse multiple <br/>, and ignore any at the beginning or end of the text.

Could extend this idea to more general transformations: e.g to add words, like if the pages have just numbers, <h2>1</h2>, but you want the TOC to have "Chapter 1".

But the handling of breaks now does need to be addressed.


Just thought of a workaround:
Replace "<br/>" with " <br/>", generate TOC. Though space at line end doesn't affect HTML unless monospaced, I'd normally clean that up.
But wouldn't work if I wanted to have colons or dashes.

Last edited by AlanHK; 09-16-2017 at 12:32 AM.
AlanHK is offline   Reply With Quote