CDSoft / panda

Panda is a Pandoc Lua filter that works on internal Pandoc's AST. Panda is heavily inspired by [abp](http:/cdelord.fr/abp) reimplemented as a Pandoc Lua filter.
https://cdelord.fr/panda
GNU General Public License v3.0
43 stars 5 forks source link

Conditionals only work when in separate paragraphs. #8

Closed bandel65 closed 9 months ago

bandel65 commented 2 years ago

This works:

::: {.if myTest=test}
Using the syntax from test.md, this should appear because myTest is set to "test".
:::

It renders as:

Using the syntax from test.md, this should appear because myTest is set to “test”.

...but, this does not - it renders the block as plain text:

Here is some text and...
::: {.if myFlag=true}
This should appear because myFlag is set to true.
:::
Oh, and more text.

It renders as:

Here is some text and. . . ::: {.if myFlag=true} This should appear because myFlag is set to true. ::: Oh, and more text.

This greatly diminishes the utility of conditionals.

CDSoft commented 2 years ago

Conditionals are only implemented for blocks (i.e. separate paragraphs). I guess this could be done for Span inlines too. The syntax for pandoc should be something like this:

Here is some text and... [This should appear because myFlag is set to true.]{.if myFlag=true} Oh, and more text.

or

Here is some text and...
[This should appear because myFlag is set to true.]{.if myFlag=true}
Oh, and more text.
bandel65 commented 2 years ago

It’d be really useful. For example:

The test was run on {{date}} at {{site}}. The test [passed.]{.if testPassed=true} [failed.]{.if testPassed=false}

Sure, you could do that with blocks, but then you’re repeating the entire paragraph. And I’m really lazy. ;-)

From: CDSoft @.> Sent: Friday, November 5, 2021 10:30 AM To: CDSoft/panda @.> Cc: Bill Andel @.>; Author @.> Subject: [External] Re: [CDSoft/panda] Conditionals only work when in separate paragraphs. (Issue #8)

Conditionals are only implemented for Div blocks (i.e. separate paragraphs). I guess this could be done for Span inlines too. The syntax for pandoc should be something like this:

Here is some text and... [This should appear because myFlag is set to true.]{.if myFlag=true} Oh, and more text.

or

Here is some text and...

[This should appear because myFlag is set to true.]{.if myFlag=true}

Oh, and more text.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/CDSoft/panda/issues/8#issuecomment-962082505, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AWKXBGNEPO4N6YI45JAZALLUKQIBHANCNFSM5HMOOWHQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

CDSoft commented 2 years ago

Done.