Add backlinks to elements in solutions sections#2610
Add backlinks to elements in solutions sections#2610skiadas wants to merge 5 commits intoPreTeXtBook:masterfrom
Conversation
|
I haven't looked closely at this, but I note that it touches on a lot of delciate code that ensures heading levels elevate correctly. Like, not following an I used the Firefox headingsMap extension a lot when we put all that together. It highlights when headings are out of line like that. There are still things that it won't catch, that need manual eyes. For example, if there are adjacent headings that should be One of the complications is that the heading level of something where it is born might be (for example) 3. But then when that thing appears somewhere else, like in a "solutions" page, it may need a different heading level. |
I'm as confident as I can be I suppose. So the first two commits add new "tests", then the moving around is done on the 3rd and 4th commit, and my guide throughout that process was a before- and after- diff of the sample-article build with the publication-crc settings, and observing that the versions are identical (except for the obviously different compile-time timestamp). So at least on the sample-article source code the results of the refactoring should be identical to the before state. Then the last commit, which adds the backlinks, simply surrounds the title part with an anchor tag (does this need any accessibility extras btw?). The algorithm for determining what heading level to use has remained unaffected as far as I can tell, in the mode="hN" template. But yes it's a biggish change, which is why I wanted as many eyes on it as possible. Are there other projects that I should use as test cases, beyond the sample article? |
|
If you were doing diffs on the output HTML from the sample article, that is great. It has all of the complicated cases from when this was tested before, and no other projects were used in testing at that time. If you didn't see any "hN" changing their level, I'd be confident things are good in that front. If it's not much trouble, if you can post the sample article build somewhere public, I'd look at the accessibility question you asked. |
|
Let's see if this works: https://skiadas.github.io/temp-sample-backlinks/derivatives.html |
@Alex-Jordan Did you have a chance to review this by any chance? |
7eb70e8 to
47e3431
Compare
|
Back to this one, since it seems to have gotten hung up. Like @Alex-Jordan, the refactoring of hN values looks pretty involved and will take more study. But Claude Code likes it (based on before/after testing), so I have confidence. I may also take a close look at the hN levels, perhaps after this goes in. Why is there a new section about literate programming? What is it testing? Commits with new source material should be rotated to be last when making a PR, so I can do before/after testing easily without them. Next comment will be from Claude Code. aria-label could be added now, but I won't let this sit just for that. And CSS could be an add-on, especially if some This rebases nicely on master, so you could do that, make any edits and move the new source material commit to the tip, and force-push. The review is lengthy, but it looks like it'll be a good guide for me once I hop in to look more carefully. |
|
I reviewed this PR after rebasing on current master (clean, no conflicts). I built the sample article HTML before and after, with the literate-programming section and exercisegroup introduction changes removed from the source so the diff would isolate XSL-driven changes only. The refactoring is behavior-preserving. With identical source, only solutions pages and pages containing inline The backlinks work correctly. Exercise, project, and task headings in all solutions sections get Some concerns:
The refactoring itself is solid -- funneling all heading generation through Claude Opus 4.6, acting as a review assistant for Rob Beezer |
|
Not so long after all - I got a much longer tour through the changes, which will help me, and not add much here. Also, the "full URLS" is not a real problem. |
|
It's been a while so I don't fully recall the details, but I think both of the new examples I added were because they appeared to me as cases that the algorithm I was going to refactor would possibly affect but that were not covered in the examples yet, so it made sense to add them before the refactoring so they could be used to test the refactoring didn't change them: The Should I just remove both example cases? I can add |
|
Let's leave the literate programming stuff, that'll be good to have. The I put examples on first commit, develop new code, then with an interactive rebase I put them last so I can test without them. Too many spurious numbering and ToC changes otherwise. I'll wait on the aria-label. Apologies for taking so long on this, I'm trying to finally get on top of my backlog. |
47e3431 to
631d55a
Compare
|
OK I think I've rebased it correctly? The aria-label now should say something like "Back to 2.4.1.". I'm not sure how feasible it is to specify what the back-referenced element is (solution, heading etc)? |
|
Thanks, @skiadas, for the changes (and so quickly!). That was a lot of detailed work to put all of this together. I've run tests by hand, and they look good. Claude Code confirms that it looks good, and found a stray colon, which I have silently fixed. That report is next. |
|
I rebased the force-pushed version on current master (clean, no conflicts) and ran three before/after HTML build comparisons of the sample article. Test 1: First two commits only (hN refactor + heading-generic helper). The only differences are build timestamps. The refactoring is perfectly behavior-preserving — zero changes to any heading tag, class, level, or content across all pages and knowls. Test 2: First four commits (adds backlinks + aria-label). Nine files differ, all expected: four solutions pages gain backlinks, three born pages with inline
This addresses the accessibility concern from the earlier review. Test 3: All five commits (adds literate programming section). Many files differ due to section renumbering (30→31, etc.). The new section itself renders correctly — fragments display with angle-bracket notation and the
Claude Opus 4.6, acting as a review assistant for Rob Beezer |
|
Nicely done. Merged with new commit messages. Will put on |
This should be addressing #2606 but also includes a fair amount of refactoring: