View Single Post
Old 02-10-2018, 10:20 AM   #44
elibrarian
Imperfect Perfectionist
elibrarian ought to be getting tired of karma fortunes by now.elibrarian ought to be getting tired of karma fortunes by now.elibrarian ought to be getting tired of karma fortunes by now.elibrarian ought to be getting tired of karma fortunes by now.elibrarian ought to be getting tired of karma fortunes by now.elibrarian ought to be getting tired of karma fortunes by now.elibrarian ought to be getting tired of karma fortunes by now.elibrarian ought to be getting tired of karma fortunes by now.elibrarian ought to be getting tired of karma fortunes by now.elibrarian ought to be getting tired of karma fortunes by now.elibrarian ought to be getting tired of karma fortunes by now.
 
elibrarian's Avatar
 
Posts: 697
Karma: 863576
Join Date: Dec 2011
Location: Ølstykke, Denmark
Device: none
Quote:
Originally Posted by KevinH View Post
Unfortunately, I parse the nav to get the titles for all of the other xhtml docs. I suppose, I could translate "Table of Contents" or "Navigation" or something along those lines and then use the primary language to look up a good title and place that there.
I've come up with this python-regex during my experiments:

Code:
found = re.search(r'(?<=<h1>).*?(?=<\/h1>)',html)
if found is not None:
	html = re.sub(r'\<title>(.+?)\<\/title\>', r'<title>' + found.group(0) + '</title>', html)
It works for me, because I routinely cut up my books in one file per chapter, but if it could be run on the nav only, you could get round the language problem.

Quote:
Originally Posted by KevinH View Post
Since epub:type tags can be used on the body and div tags and does not require a section tag, there might be a way to add epub:type chapter (and its role) if there way some way to determine if it is actually a chapter and not an index, or new volume or something else.
Quote:
Originally Posted by KevinH View Post
Which epub:type attributes do you use most frequently?
Depends on the book, but since I only do fiction, it's more or less limited to part and chapter, cover, titlepage, noteref, footnote, endnote, toc (and sometimes foreword, dedication etc.)

Quote:
Originally Posted by KevinH View Post
Do you always add section tags or instead put the on the body and divs?
I usually put the "-matter'-tags in body and the rest in section. I don't think there's an established practise.

Quote:
Originally Posted by KevinH View Post
Can you point me at a few (public domain) epubs that show good examples of the proper use of epub:type semantics inside xhtml files?
I'll try to find some. But since "the authorities" - whoever that may be - haven't established any practise, I don't think I can find any files that are THE solution.

Regards,

Kim
elibrarian is offline   Reply With Quote