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

Autogenerate IDs in a way consistent with section IDs #2

Closed
mojavelinux opened this issue Oct 2, 2022 · 0 comments
Closed

Autogenerate IDs in a way consistent with section IDs #2

mojavelinux opened this issue Oct 2, 2022 · 0 comments
Assignees
Labels
bug Something isn't working v1.0.0-alpha.2 v1.0.0
Milestone

Comments

@mojavelinux
Copy link
Member

This extension autogenerates an ID for each tabset, then uses that value as a prefix to autogenerate an ID for each tab. The ID is necessary in order for the behavior (JavaScript) to correlate the tab's label and content.

The extension is currently using a home-grown strategy to autogenerate the ID. This introduces an inconsistency compared to how IDs for sections are generated. Instead, the extension should delegate to Section.generate_id to generate the ID.

The extension should compute the ID of a tabset as follows:

  • the value of idprefix attribute (default _)
  • the string literal "tabset"
  • the 1-based occurrence of a tabset in the document

The extension should compute the ID of a tab as follows:

  • the ID of the tabset
  • the value of the idseparator attribute (default _)
  • the result of converting label to an ID using Section.generate_id (using the idprefix already established)

By default, the ID of the first tabset is _tabset1. Assuming the first tab in that tabset has the label "First Tab", its ID would be _tabset1_first_tab. If idprefix= and idseparator=-, then the ID of the first tabset is tabset1 and the first tab is tabset1-first-tab.

@mojavelinux mojavelinux added the bug Something isn't working label Oct 2, 2022
@mojavelinux mojavelinux self-assigned this Oct 2, 2022
@mojavelinux mojavelinux added this to the v1.0.x milestone Oct 2, 2022
mojavelinux added a commit to mojavelinux/asciidoctor-tabs that referenced this issue Oct 2, 2022
…ner consistent with section ID generation
mojavelinux added a commit to mojavelinux/asciidoctor-tabs that referenced this issue Oct 2, 2022
…ner consistent with section ID generation
mojavelinux added a commit to mojavelinux/asciidoctor-tabs that referenced this issue Oct 2, 2022
…ner consistent with section ID generation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working v1.0.0-alpha.2 v1.0.0
Projects
None yet
Development

No branches or pull requests

1 participant