Detecting improperly terminated conditionals

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Detecting improperly terminated conditionals

oddhack
We have some very heavily conditionalized documents, and it's not uncommon for contributors to improperly terminate a conditional in a way that makes the rest of the document  build incorrectly as a result (for example, using ifdef::condition[] where endif::condition[] is needed, or just leaving out the endif:: completely). This seems like something straightforward for asciidoctor to detect at end of processing - presumably it's got some sort of stack of conditions and if the stack isn't empty at document end, something is wrong in the markup. Is there some way to do this already, or is it a feature request there would be any appetite for? Ideally asciidoctor -v would emit an ERROR, or at least a WARN, about this.
Reply | Threaded
Open this post in threaded view
|

Re: Detecting improperly terminated conditionals

mojavelinux
Administrator
@oddhack,

This seems very similar to what we did for unterminated blocks. Since we were able to solve that, I think we can solve this one too. Please file an issue and I'll look into it.

Best,

-Dan

On Mon, Jan 20, 2020 at 8:53 AM oddhack [via Asciidoctor :: Discussion] <[hidden email]> wrote:
We have some very heavily conditionalized documents, and it's not uncommon for contributors to improperly terminate a conditional in a way that makes the rest of the document  build incorrectly as a result (for example, using ifdef::condition[] where endif::condition[] is needed, or just leaving out the endif:: completely). This seems like something straightforward for asciidoctor to detect at end of processing - presumably it's got some sort of stack of conditions and if the stack isn't empty at document end, something is wrong in the markup. Is there some way to do this already, or is it a feature request there would be any appetite for? Ideally asciidoctor -v would emit an ERROR, or at least a WARN, about this.


If you reply to this email, your message will be added to the discussion below:
https://discuss.asciidoctor.org/Detecting-improperly-terminated-conditionals-tp7510.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML


--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux