Skip to content
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

Redefinitions #2343

Merged
merged 4 commits into from
Apr 3, 2024
Merged

Redefinitions #2343

merged 4 commits into from
Apr 3, 2024

Conversation

brucemiller
Copy link
Owner

This PR fixes a problem with definition locking, particularly when preloading. The idea (I think!) should be that redefinitions of locked definitions from raw tex (or style files) should generally be ignored, but those from a binding should be respected, even if it is indirectly loaded from another style file. This wasn't always happening when bindings were preloaded.

Getting this sorted out revealed some un-intended redefinitions. One was the unfortunately named bibliography counter (used for ID's within bibliographies) which is now named @lx@bibliography. And also the function AddToMacro presumably should allow what is effectively a redefinition.

@brucemiller brucemiller requested a review from dginev April 3, 2024 02:16
@brucemiller
Copy link
Owner Author

The actual fix is relatively simple, but awkward to explain & test. I created a rather convoluted test case t/daemon/complex/testlocks. I created the expected output using tools/maketests --xml t/daemon/complex/testlocks. However, the actual testing fails; it looks like it's getting the processing-instructions in random order. @dginev could you have a look?

@dginev
Copy link
Collaborator

dginev commented Apr 3, 2024

Took a look. You've ran into a limitation of the daemon testing setup: when the directories get checked, the testing harness will look for both .spec and .tex input files, which means that you've actually added two separate tests - testlocks.spec and testlocks.tex, both of which will be tested against testlocks.xml. Naturally, one of the two runs has to fail, if the spec does anything non-trivial.

The way I've worked around this with the other daemon tests (which mostly share a small number of input .tex snippets) is to put all sources a directory level up, where the testing harness isn't looking, in t/daemon. So moving that up and changing the source line to:

source = ../testlocks.tex

Should align with the current testing setup. Definitely room to document that somewhere...

@brucemiller
Copy link
Owner Author

Ah, ok, that makes sense; I was just trying to hide the clutter of all the extra style files & bindings. Thanks!

@brucemiller brucemiller changed the title [WiP] Redefinitions Redefinitions Apr 3, 2024
@brucemiller brucemiller merged commit fcfe73d into master Apr 3, 2024
26 checks passed
@brucemiller brucemiller deleted the redefinitions branch April 3, 2024 22:22
teepeemm pushed a commit to teepeemm/LaTeXML that referenced this pull request Oct 29, 2024
* Allow redefinitions of locked from .ltxml bindings and from AddToMacro

* Rename (nonstd) bibliography counter (used for IDs) to @Lx@bibliography, to avoid apparent redefinitions of \thebibliography

* Add (convoluted) test case to test definition locks

* Pearrange testlocks test case file locations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants