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

review attrib.js #457

Closed
pkra opened this issue Aug 13, 2024 · 5 comments
Closed

review attrib.js #457

pkra opened this issue Aug 13, 2024 · 5 comments
Assignees
Milestone

Comments

@pkra
Copy link
Member

pkra commented Aug 13, 2024

It looks a bit like label, cf. #452.

@pkra pkra added this to the 2024 milestone Aug 13, 2024
@pkra pkra self-assigned this Aug 13, 2024
@pkra
Copy link
Member Author

pkra commented Aug 13, 2024

I think downstream actually needs something sooner rather than later (to identify attrib output, e.g., in book prefaces).

@pkra pkra modified the milestones: 2024, 2025 Jan 7, 2025
@pkra
Copy link
Member Author

pkra commented Jan 8, 2025

It looks a bit like label, cf. #452.

To clarify: attrib.js currently has 3 cases

  • general: span in the parent
  • if parent is disp-quote, we create a footer, then span in the footer
  • if parent is figure, span in the figcaption (with the assumption there always is one)

I think downstream actually needs something sooner rather than later (to identify attrib output, e.g., in book prefaces).

This refers to the fact that the general case doesn't really deserve that name.

To step back: we only have 466 occurrences of attrib across all publications right now.

Of those, 245 are case 3 (figures with photo credits) in 2 older books (mbk103, clrm067, which were both pretty special cases in themselves).

The second case (disp-quote) occurs 163 times, almost always via \epigraph.

So the "general" case is just 58 cases. One is a hack for a verse (in an MCL) and the rest seems to come down to \aufm, cf. https://github.com/AmerMathSoc/texml/blob/5b62cf9ad9171063a843345cc99e82bfa36b3046/lib/perl/TeX/Interpreter/LaTeX/Class/amsclass.pm#L1122

Now as mentioned earlier, \aufm macro shows up pretty consistently at the end of book prefaces as well as some articles (NOTI letter-likes). (Doing this research brings up some questions around aufm output which I'll file on the texml end.)


Regarding the OP, I still agree that this is similar to the label.js situation. Ideally, attrib.js would just create a span (and importantly: add a data attribute which is currently missing). Then we'd need a good pattern to smoothly handle the other cases. The latter seems like the main challenge.

@pkra
Copy link
Member Author

pkra commented Jan 8, 2025

(Doing this research brings up some questions around aufm output which I'll file on the texml end.)

I could answer them myself. Older books have markup where aufm creates an attrib after a paragraph without opening a new paragraph. But texml does that nowadays (see the link above).

@pkra
Copy link
Member Author

pkra commented Jan 8, 2025

Then we'd need a good pattern to smoothly handle the other cases. The latter seems like the main challenge.

first idea:

    recurseTheDomRedirected = (htmlParentNode, xmlnode) => {
        this.recurseTheDom(htmlParentNode, xmlnode);
        xmlnode.remove();
    };

@pkra
Copy link
Member Author

pkra commented Jan 8, 2025

Initial refactoring looks good but extending this pattern to label is proving more complex. To be continued.

@pkra pkra closed this as completed in 3d8c2b7 Jan 9, 2025
pkra added a commit that referenced this issue Jan 9, 2025
Fixes a regression from #457 which injected the attrib's footer
before the main recursion, thus moving it to the beginning
of the the blockquote.
- disp-quote.js
  - ensure footer is last element in blockquote.
- test
  - article.xml: add test cases
  - element-disp-quote.js: add tests

Fixes #463
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant