Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Has anyone experienced problems doing conditional processing using asciidoctorj through the asciidoctor-gradle plugin (1.5.3)? I'm passing attributes through successfully in my gradle script so that this works:
Attribute is {myattrib}. So I can see the attribute value. But this doesn't work: ifdef::myattrib[Shouldn't this work?] Even if I do this, it doesn't work: ifdef::myattrib[Shouldn't this work?] ifndef::myattrib[Neither of these work] It's like the conditional processing doesn't work at all. Is there something I need to do in the task configuration other than just pass the attributes? Thanks! Andy |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Administrator
|
I recommend consulting / trying it with the Gradle examples. If you want further assistance, you'll need to provide more context so that we can help you debug. What do your task configuration look like? Which version of Gradle? Which version of AsciidoctorJ? Which version of the Gradle plugin? etc Cheers, -Dan On Wed, May 9, 2018 at 10:43 AM, apj68 [via Asciidoctor :: Discussion] <[hidden email]> wrote: Has anyone experienced problems doing conditional processing using asciidoctorj through the asciidoctor-gradle plugin (1.5.3)? I'm passing attributes through successfully in my gradle script so that this works:Attribute is {myattrib}. ... [show rest of quote] Dan Allen | @mojavelinux | https://twitter.com/mojavelinux |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Ok, sorry about that! In the process of creating a simplified script that illustrates my problem, things got a little better... :) What wasn't working in my original was both `ifeval` and `ifdef` but I only posted about `ifdef`. Now `ifdef` works so I must have a problem in my source document in that case.
However, `ifeval` still isn't working so that's what I need help with. Here's the script: build.gradle: import org.asciidoctor.gradle.AsciidoctorTask apply plugin: "maven" apply plugin: "java" buildscript{ repositories { jcenter() } dependencies { classpath "org.asciidoctor:asciidoctor-gradle-plugin:1.5.3" } } apply plugin: 'org.asciidoctor.convert' asciidoctorj { version = '1.5.2' } asciidoctor { sourceDir = file("src") doFirst{ attributes = project.properties } } gradle.properties: projcode=cm src/sample.adoc: Sample document. Attribute is {projcode}. ifeval::["{projcode}"=="cm"}] If `projcode == cm` then you should see this. endif::[] ifdef::projcode[project was defined as {projcode}] ifndef::projcode[project was not defined] And here's the output (extracted from the HTML, etc): Sample document. Attribute is cm. project was defined as cm Is there something wrong with my `ifeval` syntax? Asciidoctor's the best - thanks for all your work! Andy |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
I don't think you need to add quotes to`ifeval`. Just `ifeval::[{projcode}==cm}]` or `ifeval::[{projcode}=="cm"}]` should do the trick.
Btw, the last version of AsciidoctorJ is 1.5.6, you should update your build if you can. |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Administrator
|
The problem is that there's an stray closing curly brace in the expression. ifeval::["{projcode}"=="cm"}] It should be ifeval::["{projcode}"=="cm"] We do recommend enclosing the attribute reference in quotes when you're comparing it to another string, so that part is correct. -Dan On Sat, May 12, 2018 at 1:16 PM, abelsromero [via Asciidoctor :: Discussion] <[hidden email]> wrote: I don't think you need to add quotes to`ifeval`. Just `ifeval::[{projcode}==cm}]` or `ifeval::[{projcode}=="cm"}]` should do the trick. Dan Allen | @mojavelinux | https://twitter.com/mojavelinux |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Omigosh.... so sorry about the goose chase! I thought I was going to have to say it worked in the sample but not in my actual case but in fact, I had the same typo in both places so all is well everywhere...
![]() Thanks so much for your help! Andy |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Administrator
|
No problem. Glad to help! Sometimes finding the right path just requires an extra set of eyes. Cheers, -Dan On Mon, May 14, 2018 at 11:06 AM, apj68 [via Asciidoctor :: Discussion] <[hidden email]> wrote: Omigosh.... so sorry about the goose chase! I thought I was going to have to say it worked in the sample but not in my actual case but in fact, I had the same typo in both places so all is well everywhere... Dan Allen | @mojavelinux | https://twitter.com/mojavelinux |
Free forum by Nabble | Edit this page |