Closed jeremyschlatter closed 3 months ago
Dear @jeremyschlatter, thank you very much for the fix of yet another Ubuntu 24.04 update leftover! Looks great, will merge now.
PS: The easiest way to create the eBook is via Docker, see comments at the end of https://github.com/rrthomas/hpmor/blob/main/Dockerfile .
Hello! Thanks for putting so much work into formatting HPMOR nicely. I'm re-reading it in ebook format in Apple Books right now and really enjoying it.
I noticed some stray markup in chapter 23:
"plus .5minus 1"
clearly doesn't belong there. I looked into it and you can see the source of this markup in the original latex:https://github.com/rrthomas/hpmor/blob/9ecaeba555c45578b8ce2c8f5df1605bb386fc76/chapters/hpmor-chapter-023.tex#L125-L140
The problem happens in
step_3.py
, which tries to remove this markup completely:https://github.com/rrthomas/hpmor/blob/9ecaeba555c45578b8ce2c8f5df1605bb386fc76/scripts/ebook/step_3.py#L53-L54
But because the regex uses a minimal quantifier instead of a greedy one, it only matches
"\vskip 1\baselineskip"
, stopping at the first"\baselineskip"
instead of the one at the end of the line. This leaves the errant bit of markup in the text:Which, because it does not start with a backslash, ends up inserted into the content.
The fix is simple: remove the
'?'
, turning the".*"
into a greedy match instead of a minimal match. This matches to the end of the last"\baselineskip"
, completely removing this bit of markup from the text as intended.Note: I only made this change because of the issue in chapter 23, but it also comes up in a few other places. Here's the full diff of tmp/hpmor-epub-3-flatten-mod.tex. I think these are all good changes, but I'm not sure. I'm not that familiar with the markup and I haven't figured out how to fully render the ebook yet to check how it looks: