-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement HTML autogeneration #580
base: master
Are you sure you want to change the base?
Implement HTML autogeneration #580
Conversation
Autogenerated TOC needs '#' before IDs. |
This is current behavior in GG1, and just my opinion, but the /* */ markup insertion of |
Overall very nice, passed W3C check, and pphtml only reported "missing h1 element". Is there a way to designate the h1 text? Using h1 markup doesn't work. |
Thanks - I'll take a look at that |
I agree, at least as far as my own PPing is concerned. However, I would prefer for now to mimic the GG1 behavior, and only consider removing it in future if there is substantial support for such a move. It's possible that in the same way the PPer can change /& to /P to get poetry markup instead of default /* behavior, that we might consider if a /T (for Table) markup might be useful. I'm not sure how much, if any help it could be, but it could be worth investigating. For tables, it sounds like you'd probably prefer it if you changed the /.../ to /X...X/, which just puts a |
Good catch - I've neglected to code that. I think GG1 assumes the first bit of text that isn't an illo, etc. is the title. I'm extracting that in GG2 to display in the dialog "title" field and the HTML header, but forgot to add the h1 markup in. Thanks. |
Pushed commit to fix points raised in @rtonsing's review |
1. Convert body - handles block markup
If user has copy of header.txt in GGprefs, then if it is a full header, just use it, but if it's not, then insert it at the end of the default header.
Replace with em or span, or keep as marked up, based on radio buttons in dialog.
Replace TITLE in header with the best guess at the title of the book. Replace BOOKLANG with the main language code.
If not, then spans/anchors are still inserted in HTML, but no text is shown.
If pagenum span is not already within a paragraph, then enclose it in paragraph markup.
Improve pagemark positions early so they don't get caught just inside the end of a para. Then the chapter div can enclose them if appropriate.
Especially in indexes with lots of linked page numbers. Wrap at a space after a close tag, not after an open tag.
Also add `#` before auto-toc link IDs. Discovered in @rtonsing's review
425caf2
to
e61ee54
Compare
This does not do everything that a PPer needs to consider when creating the HTML file, but it attempts to do the basic autogeneration of the HTML in the same way as GG1. There will usually be further work to be done, especially of the frontmatter, tables, illustrations, etc., which really require human input. Under most circumstances the output should be valid HTML, but if there are two chapters with the same number/title, (e.g. if a project contains two books in one document) it is possible to get duplicate IDs, which again will need human intervention.
Tasks done by autogeneration:
<i>
converted to<em class="italic">
Unlike GG1, I think you can use Undo fairly safely after HTML generation.