Use TOC to find out headline #11
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
In some books, headlines are not in
<h1>
-<h6>
tags, but in<p>
tags or whatever. With the TOC we still can extract the last headline.EPUB 2: OPF file:
<spine toc="[ID]">
–<manifest><item id="[ID]" href="toc.ncx" […]
EPUB 3: OPF file:
<guide><reference type="toc" href="xhtml/inhalt.xhtml" […]
(optional)Idea: Grab the href to the TOC in
zip::list_spine()
and inject the headlines insearch::cleanup_text()
, if we can't identify them in the usual way. Where do we store the href? Maybe we need a class, or a struct with metadata.zip::list_spine()
is called fromsearch::search()
.search::cleanup_text()
is called fromsearch::search()
. We could return the TOC fromlist_spine()
. We would need a new type for that. Something like:We could parse the TOC from
search()
and pass ID→headline pairs tocleanup_text()
. If there is no ID (The href points to the file without#
), leave the ID empty.In
cleanup_text()
we search for the tag with the ID and replace it with the headline. If the ID is empty, we add the headline at the top.