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

Cross-referencing package #1366

Closed
wants to merge 5 commits into from

Conversation

Omikhleia
Copy link
Member

@Omikhleia Omikhleia commented Apr 15, 2022

Rationale for this PR:

What this packages proposes:

  • Generic cross-references, with a LaTeX-inspired syntax (\label, \ref, \pageref...).
  • An API for other packages or classes to support it (that is, register their own numbering items): here applied to the book class and footnotes package.

If it makes it into the distribution, I intend it as a replacement for my own "omirefs" package (it's the exact same code, the only change here being the documentation, using our new autodoc stuffs).

As for the TOC, it requires one or more re-run(s) of SILE. It doesn't come with tests (until we have a clean way to automate those re-runs), nevertheless, FWIW:

  • Its own package documentation uses it.
  • I used it in my own package and class documentations
  • I used it in my book project... Including a gamebook-like chapter (of the "Choose Your Own Adventure" type).

@alerque alerque added enhancement Software improvement or feature request modules:packages Issue relates to core or 3rd party packages labels Apr 15, 2022
@alerque alerque added this to the v0.13.0 milestone Apr 18, 2022
classes/book.lua Outdated Show resolved Hide resolved
classes/book.lua Outdated Show resolved Hide resolved
Copy link
Member

@alerque alerque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we're 99% of the way towards making this package independent so it doesn't need to touch the class or other packages. Lets get it all the way there before merging. I've spent days recently trying to untangle other packages so they can be used in isolation and/or are idempotent to load. I think that's going to be a requirement for new core packages going forward and this one only needs minor tweaks to get there.

packages/footnotes.lua Outdated Show resolved Hide resolved
@alerque alerque modified the milestones: v0.13.0, v0.13.x Jun 1, 2022
@alerque alerque modified the milestones: v0.13.0, v0.13.x Jun 9, 2022
@alerque alerque modified the milestones: v0.13.x, v0.14.x Jun 24, 2022
@alerque alerque self-assigned this Jul 14, 2022
@Omikhleia Omikhleia mentioned this pull request Jul 23, 2022
7 tasks
@Omikhleia Omikhleia force-pushed the labelrefs-package branch from fbf09cb to edf4313 Compare July 30, 2022 17:33
@Omikhleia
Copy link
Member Author

Omikhleia commented Jul 30, 2022

Update: Rebased on current master at this date (7925d45) and upgraded to 0.14 API.

Caveat: In the manual, this is not working very well any longer, but for two root causes which IMHO are unrelated:

  • the same package can be (re)initialized multiple times (i.e. re-instantiated in class:loadPackage), e.g. infonodes gets initialized 2 or 3 times in the manual, leading to Attempted to set the same function hook twice warnings very early when processing the manual).
  • Autodoc is quite broken and/or is messing up (so here, tableofcontents re-register its commands, and labelrefs' tocentry override is disabled.

@Omikhleia
Copy link
Member Author

The same package can be (re)initialized multiple times (i.e. re-instantiated in class:loadPackage), e.g. infonodes gets initialized 2 or 3 times in the manual, leading to Attempted to set the same function hook twice warnings very early when processing the manual).

Here, each time a package loads another one on which it is dependent, with self.class:loadPackage(), then a new instance is created.

@Omikhleia
Copy link
Member Author

Omikhleia commented Aug 17, 2022

I am refactoring this as an "external" luarocks package.

@Omikhleia Omikhleia closed this Aug 17, 2022
@Omikhleia
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Software improvement or feature request modules:packages Issue relates to core or 3rd party packages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Referring to a section
2 participants