Bug 735548 - Conditional text does not work
Summary: Conditional text does not work
Alias: None
Product: Publican
Classification: Community
Component: publican
Version: 2.3
Hardware: Unspecified
OS: Windows
Target Milestone: ---
Assignee: Ruediger Landmann
QA Contact: Ruediger Landmann
Depends On:
TreeView+ depends on / blocked
Reported: 2011-09-03 12:45 UTC by eric@christensenplace.us
Modified: 2012-03-13 01:05 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2012-03-13 01:05:50 UTC

Attachments (Terms of Use)

Description eric@christensenplace.us 2011-09-03 12:45:58 UTC
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:


...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-13 01:05:50 UTC
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 condition="beta">
Only in the Beta version.
<para condition="beta,GA">
In the Beta and GA versions.

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.

Note You need to log in before you can comment on or make changes to this bug.