Bug 919486

Summary: RFE: Support all DocBook conditionals
Product: [Community] Publican Reporter: Stephen Gordon <sgordon>
Component: publicanAssignee: Jeff Fearn <jfearn>
Status: CLOSED CURRENTRELEASE QA Contact: tools-bugs <tools-bugs>
Severity: unspecified Docs Contact: Zac Dover <zdover>
Priority: unspecified    
Version: 3.1CC: aigao, jfearn, r.landmann, thildred, xma
Target Milestone: 3.2Keywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: 3.2.0 Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-08-09 00:49:26 EDT Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On:    
Bug Blocks: 913281    

Description Stephen Gordon 2013-03-08 10:54:43 EST
Description of problem:

I have been working of late to see how feasible it is to build documentation from the openstack-manuals project using Publican, allowing us to single source while working with the upstream community. At this time I am looking at using a pre-build script to perform some transformations on the XML to allow this but some of these seem like they should/could be unnecessary.

One thing I have noticed is that the project uses the "os" conditional in some guides to support downstream projects in building documentation output specific to a single operating system. I would like to see support for the "os" conditional in publican.

My interim plan is to convert these attributes to "condition" which is supported by publican in pre-build scripting.

Version-Release number of selected component (if applicable):

Comment 1 Stephen Gordon 2013-04-22 08:02:19 EDT
Reflecting on this request further I suspect the precursor would be support for setting more than one profiling condition from publican.cfg (currently you can *set* more than one but only the last one found is used when processing the XML). Not sure how feasible this is in the current publican code base.
Comment 2 Jeff Fearn 2013-04-22 18:55:05 EDT
It just needs an extra if statement in XmlClean::prune_xml and to store 'os' in $Publican->{config}

You might be better off storing it in the 'arch' conditional, which isn't strictly correct but it would be easy to regex back to 'os' later on if you have a chance of using 'condition'.
Comment 3 Jeff Fearn 2013-06-17 00:50:33 EDT
Assuming two conditions means OR.


a section for 'fu' or 'bar'.

<section condition="fu;bar">

a section for 'bang'

<section condition="bang">

In the publican.cfg

condition: 'fu;bang'

Both the above sections would be included.

[Dev Note]
XmlClean.pm, sub prune_xml, put all attrs from http://www.sagehill.net/docbookxsl/Profiling.html in an array, loop, split, loop, compare, FTW.
Comment 4 Jeff Fearn 2013-07-11 01:34:49 EDT
Docs need to be updated!

Previously we supported arch and conditional, this has been expanded to the full list.

arch audience condition conformance lang** os revision revisionflag role security status userlevel vendor wordsize

Previously the profiling allowed 1 option to be set. e.g.:

arch: "i386"

The logic has been changed so that multiple conditions can be set. e.g.

arch: "i386;x86_64"

Where the ';' means OR.

The XML supports the same OR logic, e.g.

<para security="minimal;maximal">

** lang is special, it's always used in Publican and it gets set implicitly.

To ssh://git.fedorahosted.org/git/publican.git
   1bc3841..1b8f230  HEAD -> devel
Comment 5 Ruediger Landmann 2013-07-11 02:02:14 EDT
(In reply to Jeff Fearn from comment #4)
> Docs need to be updated!

Zac, can you take this one too please?
Comment 6 Jeff Fearn 2013-07-18 03:56:43 EDT
*** Bug 733577 has been marked as a duplicate of this bug. ***
Comment 7 Tim Hildred 2013-07-23 05:20:33 EDT
The os attribute works as expected.
Comment 8 Tim Hildred 2013-07-23 05:20:52 EDT
However, unless I'm missing something, "audience" does not.

I have in my publican.cfg:
audience: dudes

But, when I add something like this to a book:
<section audience='dudes'>

I get this when I build it:
Beginning work on en-US
DTD Validation failed: 
Introduction.xml:16: validity error : No declaration for attribute audience of element section
Comment 9 Tim Hildred 2013-07-23 05:49:31 EDT
I tried examples of each of these:

arch audience condition conformance lang** os revision revisionflag role security status userlevel vendor wordsize

They all work except for audience, as stated in comment #8.

Comment 10 Jeff Fearn 2013-07-23 18:31:55 EDT
Changing to verified as audience is a DocBook 5 common attribute and will correctly fail when used in DocBook 4 content.
Comment 11 Jeff Fearn 2013-08-09 00:49:26 EDT
The fix for this bug has been shipped in publican 3.2.0