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

AbstractBlock#append() does not dispatch to overwritten append methods (for section/document) #1658

Closed
simon-spinner opened this issue Sep 23, 2022 · 1 comment · Fixed by #1681

Comments

@simon-spinner
Copy link

In https://github.com/asciidoctor/asciidoctor/blob/d352fa7ef051c7fbcf05ae70ac69eedfd4bdc694/lib/asciidoctor/document.rb#L809 the append method is overwritten to update the section numbers when adding a section to a document (similar code exists for sections). Calling append() on a document in JavaScript seems to dispatch to the AbstractBlock version which does not handle updates to section numbers. As a result section numbering and TOC generation does not work as expected when programmtically adding sections to documents. A workaround is to call document["$<<"](section) directly instead

@ggrossetie
Copy link
Member

Indeed, we do not define the append method on the Document object. Would you like to submit a pull request (with a test) to fix this issue?

@ggrossetie ggrossetie modified the milestones: v3.0.x, v2.2.x Oct 31, 2022
ggrossetie added a commit to ggrossetie/asciidoctor.js that referenced this issue Jan 10, 2023
ggrossetie added a commit that referenced this issue Jan 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants