Repository navigation
postprocess book v2 for entities in code blocks - #755
Conversation
|
So this is moderately less hacky than the solution in #740, because at least it's happening on the backend rather than via javascript. But I have the same concerns as there that this is going to hit false positives. I guess an interesting exercise would be to do the regex substitution on a downloaded copy of the ebook, render the results to text, and then diff the results. Eyeballing that diff should give us a sense of what's improving and what's regressing. I suspect it will be a net gain, but I think it's worth trying to verify that. |
|
Of course, this is a hack and I expect it to be reverted sometimes in the future. I checked where the double escaping appears in the html output from Atlas. This patch does not cover all the cases because it only checks |
Right now Atlas seems to badly handle html entities in code block so we fix it when importing it into the site. This hopefully fixes git#753.
|
OK, the new simpler version of the patch covers all the cases I detected. |
|
Thanks for working on this. I was thinking we'd match real I will still look forward to one day reverting it, though. :) |
|
Yes, the number of new issues will decrease a lot. This is really an annoying part of the way the book is edited. Thank you very much for taking care. |
|
I just rebuilt the copy of the book on the deployed site. Some cases are improved, but there are a few that aren't. E.g., look at https://git-scm.com/book/en/v2/Git-and-Other-Systems-Migrating-to-Git#TFS. The problem is that the incoming HTML looks like: There are several cases that look like that, so we can probably just match that whole nasty sequence. |
|
Hmm, looks like there are more cases than that (e.g., on that same page are some where the middle |
|
Argh... I failed on this. The html generation is utterly broken. |
|
I think I have something close to working with: as my regex. |
|
a simple > grep -E '&<' *.html | wc -l
95whereas > grep -E '&</code>(<code class=".">)?([gl]t)(</code>)?<code class="[^p]">;' *.html | wc -l
1Something is missing in the regex. We also have wrongly escaped '&', for instance in 1-git-server.html: |
|
Oops, sorry, the regex I shared is where I was trying to debug the alternate classes. The final I'll see if I can expand it to handle |
|
OK, with 893725d this now looks good to me. (That's all built on your commit here, and I'll merge it all in as one). |
|
OK. Thanks. |
This pulls in #755, along with my fixups on top. * fixup-pr-755: genbook2: match broken '&amp;' escaping genbook2: find &gt; inside split <code> blocks genbook2: simplify html fixup postprocess book v2 for entities in code blocks
Right now Atlas seems to badly handle html entities in code block so we
fix it when importing it into the site. This hopefully fixes #753.