Skip to content

Comments

Check if div has content before indexing#24

Open
7o7omootsqwn wants to merge 1 commit intocysouw:mainfrom
7o7omootsqwn:guard-empty-divs
Open

Check if div has content before indexing#24
7o7omootsqwn wants to merge 1 commit intocysouw:mainfrom
7o7omootsqwn:guard-empty-divs

Conversation

@7o7omootsqwn
Copy link

Thank you for your work on pandoc-ling.

This commit just adds a guard in the function processDiv which checks that a Div has content inside it before indexing into the content array. This makes the filter compatible with Divs that have no content inside them, which are supported by pandoc's model (though a bit of a strange corner case), and which I sometimes use in my own filters as placeholders for Block like elements which I calculate elsewhere then substitute into the document, e.g.

::: {.block-element}
:::

With the current code, if pandoc-ling is run before this substitution occurs, it attempts to index into the Div's content and fails.

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

Successfully merging this pull request may close these issues.

1 participant