gutenbergtools / ebookmaker

The Project Gutenberg tool to generate EPUBs and other ebook formats.
GNU General Public License v3.0
78 stars 17 forks source link

Updates to HtmlTemplates.py #189

Closed gbnewby closed 1 year ago

gbnewby commented 1 year ago

Reworked HtmlTemplates.py so we can more easily extract headers for other consumers. No functional changes.

eshellman commented 1 year ago

better to branch off v12 (dev) branch. Not clear what you are trying to do.

gbnewby commented 1 year ago

Done. I don't see what conflict it is complaining about, though - can you identify & resolve?

The purpose is to expose plain strings (variables) that can be used by dopush and workflow, on the pglaf.org server.

There might be a few more further changes to expose more of the HTML header material. Basically, my goal is to have static variables containing plain strings exposed to other consumers of the module. That way, they can be extracted very easily, without for example needing to supply an entire 'dc' object to populate the non-static variables.

eshellman commented 1 year ago

deconflict looks reallu hard, suggest to start over. the maybe the plain text with boilerplate will be what you want - I implemented that today, almost ready to commit to v12

gbnewby commented 1 year ago

Are you substantially done with v12 edits to HtmlTemplates.py? If so I'll apply those changes... if you're still working with it, I can wait. The changes involved a lot of lines, but almost no logic or procedural changes.

eshellman commented 1 year ago

yes. just remember the same template needs to work for txt, html and epub presentation on a variety of screen sizes. So for example, I had to add whitespace to get the txt to look right. And that's why there's no css in the templates.

On Jul 11, 2023, at 6:20 PM, Greg Newby @.***> wrote:

Are you substantially done with v12 edits to HtmlTemplates.py? If so I'll apply those changes... if you're still working with it, I can wait. The changes involved a lot of lines, but almost no logic or procedural changes.

— Reply to this email directly, view it on GitHub https://github.com/gutenbergtools/ebookmaker/pull/189#issuecomment-1631583452, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHCGMOWJVYFN2BW5WTVKFDXPXGTBANCNFSM6AAAAAA2DAJ54U. You are receiving this because you commented.

eshellman commented 1 year ago

ok. Avoid putting CSS in the template as you seem to have done for #189 as we'll likely need to tweak for pdf

eshellman commented 1 year ago

@gbnewby OK, I think I understand what you want. you want headera, headerb, headera_copy and headerb_copy to be importable strings. I can make that change quickly. I'm not sure why you use re.sub instead of f-strings, but I'm guessing your python is pre-3.6?

gbnewby commented 1 year ago

Cool. Yes, please do - that way you can make stylistic decisions.

I annotated HtmlTemplates.py -- attached. That shows the strings that I think should be externalized. HtmlTemplates-annotated.zip

Also I'm attaching the current canonical headera, headera_copy, headerb and headerb_copy files (text and HTML versions - words are supposed to be identical). It's absolutely fine to instead use the words already in ebm, and these files are just so you can see that they don't contain surrounding HTML. current.zip

Thanks for this. It is a major step in avoiding inconsistency in headers/footers - hard to overstate how much this will simplify avoiding inconsistencies.

eshellman commented 1 year ago

closed in favor of #c5631d761627257f403188f8dee925b5cb61dfb8

found a bug in some other stuff so no release today