Allow simple challenge callouts without accordion blocks#718
Open
alex-ball wants to merge 1 commit intocarpentries:mainfrom
Open
Allow simple challenge callouts without accordion blocks#718alex-ball wants to merge 1 commit intocarpentries:mainfrom
alex-ball wants to merge 1 commit intocarpentries:mainfrom
Conversation
Differentiate between content that occurs after accordion blocks in a challenge fenced div and content that occurs inside a challenge fenced div with no accordion blocks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The accordion lua filter for challenge blocks is set up to transform a structure like this:
into a structure like this:
But it does this (in effect) by taking away all the content up to the last inner block, and assuming that whatever is left must be a debrief discussion. This does not take into account the possibility that there were no inner blocks to begin with, and means that
is transformed into
This PR changes that behaviour so the filter will only put the content at the end of a div.challenge into a div.discussion if at least one div.challenge has already been added to the challenge train; otherwise it will just add the current div.challenge to the train unaltered. I have done this with an additional local Boolean, as I think this is marginally more efficient in Lua than checking for an empty pandoc.List with
next(...) == nilbut I'm prepared to be corrected on that.I have added a unit test for this behaviour, which the old code fails and the new code passes.
Fixes #672.