View Single Post
Old 10-23-2012, 03:24 PM   #3
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 8,926
Karma: 40404050
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
I think he/she means the opposite. The chapter headings are already "*". So that's what appears in the ToC. I believe they're looking for a way to use the physical individual chapter file (*.html) names to automatically fix the chapter heading and subsequently (I'm guessing) rebuild the ToC with the then corrected names.

Find and Replace with/without regex is the only possible way of automatically generating/changing those chapter headers (and thus the ToC) ... and to my knowledge, there's no provision for search and replace to access (or use) the underlying file's name in an F&R routine.

Although technically, you could use regex on the toc.ncx file ... and as long as the play orders start with 1 and increment by 1 (you can automatically renumber them if not), you could capture the play order with regex and then use that number to build a new <text> entry:

Find:
Code:
<navPoint id="(.*?)" playOrder="(\d+)">\s+<navLabel>\s+<text>.*?</text>
Replace:
Code:
<navPoint id="\1" playOrder="\2"><navLabel><text>Chapter \2</text>
(or something to that effect. I was just winging that example, so be sure to check the toc.ncx to make sure I didn't make some glaring error)

The expression could probably be made a lot cleaner, but I thought someone mentioned that there's issues with \K and look(ahead|behind)s in the latest beta.

NOTE: the above would fix the ToC, but do nothing to the chapter headings.
DiapDealer is offline   Reply With Quote