-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Distinguish mutiple HTML5 footnote section ids #8770
Conversation
I was sure I tested it after fixing the indexing, but apparently not; sorry! I've also realized that this might not round-trip, so I'll take a look into the reader code to see what that side of it all needs. One second. |
f429969
to
ad75fa8
Compare
Looks like the HTML reader doesn't make any effort to read the generated section, even when it just has the old |
We should not produce duplicate ids, so this is definitely something that needs fixing. |
I (rightfully) don't have merge permissions, so was under the impression that this was ready but in your court at this point. Or am I missing a stage of the contribution process? |
Sorry for the delay -- I just can't keep up sometimes! This looks good, except that I'd suggest a more focused test. You've basically duplicated the old writer test with a new option. But most of this new test isn't testing the new feature. Simplest option would be to use a command test (see test/command directory) to test just this. |
No worries! Just didn't want there to be something you were waiting on from my end, which I didn't know about; it's not breaking any of my current workflows and won't break anything in the near future, so I'd definitely rather do it right than do it fast.
Ah, yeah, that would be better. I didn't know how the tests were structured, found one spot with a lot of data, and then just monkey-coded something to match. I'll be rather busy the next week or two, but as I get time I'll write up something more properly targeted. |
@ag-eitilt this is not far from being merge-able -- just needs a rebase and some tests. |
I'll be honest, I took a vacation and promptly forgot I had done this much until your merge lifted it up through the morass of my email inbox. Now that I know about it again, I do definitely want to get this polished up for merging, so I'll fix the test up and try to get something pushed this weekend. Sorry for the delay! |
Yeah, the command tests were definitely better than what I did initially; thanks for pointing me to them! I'm a bit less happy about moving the Again, sorry I disappeared like that, especially after I apparently pinged you about the same. I can read the thread and mostly remember writing my side of it, but I don't actually remember anything about writing the code in the original patch... Memory's a weird thing. |
@jgm, @ag-eitilt ; Bumping this issue as this PR seems fine to be merged now, but got kinda forgotten. I guess we are all too busy these days. Thanks for getting this done. |
@ag-eitilt do you plan to rebase this? |
Sorry, I was seeing the "has no conflicts" marker, and not thinking about the fact that the tests might have gotten stale. They are indeed passing, though; I'll squash it all down since most of these are merge commits, and apparently the line length of the auto-generated text for that is too long. |
The first (and often only) `<aside id=footnotes>` block remains unchanged, however any additional blocks from `--reference-location` are distinguished as `#footnotes-2`, `#footnotes-3`, and so on. No other existing writer seems to implement per-section IDs, including HTML4.
70f6d33
to
bd7dce7
Compare
Many thanks! Looks good. |
Thanks! |
The HTML5 writer generates an
<aside>
tag grouping all footnotes written to a particular location, and gives it a#footnotes
ID for ease of navigation. However, it gives that same ID for every<aside>
if the footnotes occur in multiple locations within the file (--reference-location=block
or=section
). This PR adds a counter to the writer state to track how many footnote-blocks have been written, and uses that to uniquely identify each<aside>
.The first ID remains simply
#footnotes
for backwards compatibility with incoming links and for cases where only a single<aside>
is needed, but all following ones are given a suffix#footnotes-2
,#footnotes-3
, and so on (one-indexed to match the individual-note numbering style). As far as I could tell, none of the other writers supporting--reference-location
give the blocks a presumed-unique ID, and while it seems like that would be a good feature to add support for in the HTML4 format defined in the same file, I've not made that change since I don't know if there's some use case which expects that lack of ID for some reason.I didn't see any good way to test this without creating a new output -- and continuing to test endnotes is definitely important -- so I hope the naming pattern I used (modeled on the
dokuwiki_*.*
tests) and the entry in the testrunner are acceptable.