Skip to content

toc algorithm fixes and clarifications #179

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

Closed
mattgarrish opened this issue Dec 14, 2019 · 1 comment
Closed

toc algorithm fixes and clarifications #179

mattgarrish opened this issue Dec 14, 2019 · 1 comment

Comments

@mattgarrish
Copy link
Member

mattgarrish commented Dec 14, 2019

Some more issues with the toc algorithm that need fixing based on discussions @iherman and I have been having:

  • toc.entries is not set to null after processing the first list in the root element, which allows other lists to be joined. Step 3 needs to set the value to null if branches is empty (i.e., the root list is finished).
  • the tests in 5.2 to exclude branches without a name or any entries also needs to be applied before adding the item to the root toc.entries in 5.3. As it is, the root can contain completely empty entries if a list item doesn't have a link or a sublist in it.
  • step 6.2.2 refers to checking the reading order and resources, which predates our adding the compiled uniqueResources list to the internal representation. We should make reference to this processed list instead.
  • the algorithm should return toc or null at the end. It sort of ends abruptly by only stating that a toc without entries is unusable
  • some statements are type heavy (e.g., "the map in current_toc_branch") and could be made more readable by omitting, since there's no need to repeat the type of value in the variable
  • step 6.2 has some incorrectly formatted variable names
  • the algorithm isn't purely event driven, as it's possible to exit an element when walking the dom without first descending through it. We should consider adding a clarifying note
  • example 71 says both entries are in current_toc_branch prior to merging, but the first is in the stack
@iherman
Copy link
Member

iherman commented Dec 15, 2019

To make it clear: these issues came up while implementing the algorithm.

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

No branches or pull requests

2 participants