Bug 735548

Summary: Conditional text does not work
Product: [Community] Publican Reporter: eric <eric>
Component: publicanAssignee: Ruediger Landmann <r.landmann>
Status: CLOSED WORKSFORME QA Contact: Ruediger Landmann <rlandman>
Severity: high Docs Contact:
Priority: unspecified    
Version: 2.3CC: mmcallis, r.landmann, rlandman
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Windows   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-03-12 21:05:50 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description eric@christensenplace.us 2011-09-03 08:45:58 EDT
Description of problem:
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.



Version-Release number of selected component (if applicable): 2.3
Comment 1 Ruediger Landmann 2012-03-12 21:05:50 EDT
This came up on the mailing list too; copying my response from there.

I don't think this is a problem on any recent version of Publican; if it is, please reopen.

============================
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.