Elements for presenting multiple language variants in a code example
Peter Desjardins <[email protected]>
| Newsgroups | gmane.text.docbook.apps |
|---|---|
| Message-ID | <CAMmOXbaRjsPL0mDfu+NhhvfW2-rPt7Ae+q1YS0p4WcmpTJgAhQ@mail.gmail.com> |
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