Hi Dan, Thanks for your reply,
> A role can be applied to any item except list items. (See the user guide > for details about roles). To deal with that exception, you can try one of > these approaches: > > * Put the role on the whole list and just repeat the items that are shared > * Put the role on the phrase around the text of the list item and filter > it out the parent item using XSL > * Move the content of the list item to a block inside the list item where > you can apply a role > > I was able to get the role for the whole list to work. Can you give me an example of the last two methods as well as setting a role for a given row of a table? > > Btw, if you go with the role approach, I recommend using a common prefix > to namespace the value. For instance: > > [role="if-windows"] > == Installing on Windows > > If you are using Asciidoctor, you can write this as: > > [.if-windows] > == Installing on Windows > > That also makes it easier to find the role name :) > I agree, that will make things cleaner and easier to find and change in the xsl. Thanks! Russ > > > On Thu, Jul 9, 2015 at 9:27 AM, russurquhart1 <[email protected] > <javascript:>> wrote: > >> Hi Dan, >> >> As far as the deferred method goes, this is EXACTLY what i am trying to >> do! >> >> My company's documentation format is like a subset of DocBook, with some >> specialized, elements, etc. They are similar enough that i can take DocBook >> generated files and run them through an xsl transform i wrote to convert >> them to our internal format. >> >> As much of our documentation is similar, except for certain parts, we >> have taken to using, as DocBook would call it 'profiling', certain parts of >> text. (We call it 'filtering', but the same idea, marked up conditional >> text.) >> >> With that said, i need to know how, if possible, this can be applied to >> listitems, rows of a table, and inline text like the applying a role >> attribute to a Phrase element? >> >> Also, while i can work with the role attribute having the set value, is >> there a way to assign a different attribute name (like any of the Common >> Attributes of DocBook) to get the set value? >> >> This functionality is really important for us so it would be neat to see >> if this is doable! >> >> Thanks, >> >> Russ >> >> >> On Wednesday, July 8, 2015 at 7:37:23 PM UTC-5, Dan Allen wrote: >> >>> 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] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> 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 > On Friday, July 10, 2015 at 3:51:14 AM UTC-5, Dan Allen wrote: > > Excellent! > > > With that said, i need to know how, if possible, this can be applied to > listitems, rows of a table, and inline text like the applying a role > attribute to a Phrase element? > > A role can be applied to any item except list items. (See the user guide > for details about roles). To deal with that exception, you can try one of > these approaches: > > * Put the role on the whole list and just repeat the items that are shared > * Put the role on the phrase around the text of the list item and filter > it out the parent item using XSL > * Move the content of the list item to a block inside the list item where > you can apply a role > > > while i can work with the role attribute having the set value, is there > a way to assign a different attribute name (like any of the Common > Attributes of DocBook) to get the set value? > > It's been possible since day #1 in both AsciiDoc Python and Asciidoctor to > customize the output. In your template, you can read an arbitrary block > attribute name and output any XML attribute you want. > > Btw, if you go with the role approach, I recommend using a common prefix > to namespace the value. For instance: > > [role="if-windows"] > == Installing on Windows > > If you are using Asciidoctor, you can write this as: > > [.if-windows] > == Installing on Windows > > That also makes it easier to find the role name :) > > Good luck! > > -Dan > > On Thu, Jul 9, 2015 at 9:27 AM, russurquhart1 <[email protected] > <javascript:>> wrote: > >> Hi Dan, >> >> As far as the deferred method goes, this is EXACTLY what i am trying to >> do! >> >> My company's documentation format is like a subset of DocBook, with some >> specialized, elements, etc. They are similar enough that i can take DocBook >> generated files and run them through an xsl transform i wrote to convert >> them to our internal format. >> >> As much of our documentation is similar, except for certain parts, we >> have taken to using, as DocBook would call it 'profiling', certain parts of >> text. (We call it 'filtering', but the same idea, marked up conditional >> text.) >> >> With that said, i need to know how, if possible, this can be applied to >> listitems, rows of a table, and inline text like the applying a role >> attribute to a Phrase element? >> >> Also, while i can work with the role attribute having the set value, is >> there a way to assign a different attribute name (like any of the Common >> Attributes of DocBook) to get the set value? >> >> This functionality is really important for us so it would be neat to see >> if this is doable! >> >> Thanks, >> >> Russ >> >> >> On Wednesday, July 8, 2015 at 7:37:23 PM UTC-5, Dan Allen wrote: >> >>> 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] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> 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.
