[publican-list] Please help: conditional text works in reverse and ignores actual condition tags

Ruediger Landmann r.landmann at redhat.com
Thu Aug 11 23:29:33 UTC 2011


On 07/22/2011 06:15 PM, Jessica [Hart] Tomechak wrote:
> Hello all, I have been using Publican to create html and PDF output for about 3 months. I can not get conditional tagging to work. When I add a condition: anything line to the publican.cfg, every XML element in my book that has any condition="whatever" attribute is EXcluded from the document.
> For example, my publican.cfg might contain this:
> condition: v1.1
> And my XML files might contain these:
> <section condition="v1.1">  ...</section>
> <phrase condition="comments">  ...</phrase>
> When I build the file, both the section and the phrase are omitted from the output. This occurs no matter what value I assign to condition in publican.cfg, whether it's a comma-delimited list, whether it includes dots or underscores, whether it's enclosed in double quotes, or whether the value is omitted entirely, like this:
> condition:
> ...if the condition: line is present, all conditional-tagged content is omitted, regardless of the actual conditional tag value. This occurs when using Publican on Windows and on Ubuntu.
> Any advice would be much appreciated.

Hi Jessica -- first up, sorry for the very, very long delay in getting 
back to you.

I've just tested this on Publican 2.6 on Fedora, and can't reproduce the 
issue. Could you please test the basic mechanism for me, and see if the 
same thing happens on your installations?

1. Create a new book:

publican create --name Conditions

2. Change into the new directory that Publican created

3. Edit the en-US/Chapter.xml file to include these lines immediately 
after the para that contains "This is a test paragraph":

<para condition="alpha">
Only in the Alpha version.
</para>
<para condition="beta">
Only in the Beta version.
</para>
<para condition="beta,GA">
In the Beta and GA versions.
</para>

4. Build the book:

publican build --formats html-single --langs en-US

5. Look at the built HTML file: tmp/en-US/html-single/index.html -- you 
should see all three new paragraphs in the page. ("Only in the Alpha 
version. Only in the Beta version. In the Beta and GA versions.")

6. Edit the publican.cfg file to add the line:

condition: alpha

7. Rebuild the book:

publican build --formats html-single --langs en-US

8. Look at the built HTML file: tmp/en-US/html-single/index.html -- only 
the first of the three new paragraphs should now appear. You should not 
see "Only in the Beta version. In the Beta and GA versions.

9. Repeat steps 6-8 with "condition: beta" in the publican.cfg file, 
then "condition: GA". The text in the built HTML should change each time.



Let me know if any of this works for you; and if it doesn't, what 
version of Publican you tried.

Cheers
Rudi








More information about the publican-list mailing list