Russ, There are two strategies for selecting conditional content, immediate or deferred.
Martin pointed you to the documentation for a feature in the AsciiDoc syntax that implements the immediate strategy. In this scenario, the content is filtered by the parser using a preprocessor conditional directive prior to generating the output (much like you find in languages like C). As a result, you won't see any sign of the directive in the output document. It effectively throws away any lines that don't meet the specified condition. If you took this approach, your input would look as follows: ifdef::windows[] == Installation on Windows ... endif::[] ifdef::linux[] == Installation on Linux ... endif::[] And your output would depend on which attribute you set. Let's assume you set the `linux` attribute. In the output, you would see: <section> <title>Installation on Linux</title> ... </section> If you'd rather defer the condition, then you could pass this information to DocBook using a role. Every block in AsciiDoc supports an arbitrary role attribute. If you followed this approach, your input would look as follows: [.windows] == Installation on Windows ... [.linux] == Installation on Linux ... NOTE: `.windows` is shorthand for role=windows. You'd get the following in the output: <section role="windows"> <title>Installation on Windows</title> ... </section> You'd have to change the DocBook processor / viewer to look for the `role` attribute instead of the `os` attribute. Those are just the options supported out of the box. It's important to understand that you can create any output you want with Asciidoctor if you are willing to supply custom templates or create your own converter. Here's an example template file for the section block that you could use as a starting point: https://github.com/asciidoctor/asciidoctor-backends/blob/master/slim/docbook45/section.xml.slim While working on the Mallard converter, I did pick up on the need for a deferred conditional attribute that can be interpreted by the viewer and have since considered adding an additional built-in attribute for it. Something like: [when=windows] == Installation Windows If you use custom templates or your own converter, of course you could implement this yourself. Hope that helps! Cheers, -Dan On Wed, Jul 8, 2015 at 3:28 PM, russurquhart1 <[email protected]> wrote: > Hi, > > I saw this, but doesn't that kind of filter one or the other to the given > output? (I.e. leave out that text when we output to this or that format?) > > Will this put both the ifdef and ifndef strings into the DocBook generated > output? That was what i was looking for. When i tried this example, on the > webpage you mentioned, the DocBook that was generated only had on ifndef > text, with no attribute set. I was trying to get both, with attributes set > in the DocBook output. > > > > > On Wednesday, July 8, 2015 at 3:59:36 PM UTC-5, rappard wrote: >> >> > In an effort to get more users on board here at my company, i need to >> know >> > if there is an easy way to do the following in asciidoc? >> > >> > [Martin: snip examples] >> > >> > We tend to use a LOT of this type of conditional text, is there a way >> to do >> > this elegantly in asciidoc? >> >> "Canonical" reference: >> http://asciidoc.org/userguide.html, section 21.3.2 (Conditional >> Inclusion Macros) >> >> Examples: >> http://mrhaki.blogspot.com/2014/08/awesome-asciidoc-using-conditional.html >> >> Hope this helps, >> >> Martin >> > -- > You received this message because you are subscribed to the Google Groups > "asciidoc" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/asciidoc. > For more options, visit https://groups.google.com/d/optout. > -- Dan Allen | http://google.com/profiles/dan.j.allen -- You received this message because you are subscribed to the Google Groups "asciidoc" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/asciidoc. For more options, visit https://groups.google.com/d/optout.
