Re: Elements for presenting multiple language variants in a code example

Bob Stayton <[email protected]>
Newsgroups gmane.text.docbook.apps
Message-ID <[email protected]>
Hi Peter,

I believe what you are looking for is the mode="class.value" feature of 
the DocBook XSL stylesheets.  That mode generates each class attribute, 
and can be customized without needing to customize the element's main 
template.  It is described here:

http://www.sagehill.net/docbookxsl/HtmlCustomEx.html#CustomClassValues

Let me know if this isn't sufficient for your needs.

Bob Stayton
[email protected]

On 2/24/2020 8:13 PM, Peter Desjardins wrote:
> I'm trying to design a set of elements that I can render as a single
> code example with multiple programming language variants. I'd like to
> style this in HTML so that the example selectively hides all but one
> example variant.
>
> I need to pass some indication of the programming language to the
> output HTML so that the styling can select one or another variant. For
> example, a <div class="informalexample java"> element could be
> distinguished from a <div class="informalexample python"> element.
>
> The elements I'm using so far:
>
> - example
>      - title
>      - informalexample
>          @role = java
>          - programlisting
>          - calloutlist
>      - informalexample
>          @role = python
>          - programlisting
>          - calloutlist
>
> By default, the role attributes on the informalexample elements are
> not passed through to the div elements for the informalexamples.
>
> I could customize the template for informalexample to do what I need,
> but I'm wondering if there's a build-in way to do this.
>
> Has anyone found a good way to present multiple variants of an example
> and offer readers a choice in the output presentation?
>
> Thanks!
>
> Peter
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.