What an excellent point. The WWP has long argued that <exemplum> is
quite useful, and should be permitted places other than in a tagdoc.
Possible solutions and workarounds:
* Customize! Probably the best way to approach this sort of
shortcoming in TEI. And once you've got a nice customization, put
it up at http://wiki.tei-c.org/index.php/Category:Customization.
* Use <code> with its lang= attribute. If you want to indicate that a
particular phrase-level snippet of code might be better off
rendered on output as a block, put a rend= (or rendition=) on it.
* Use xml:lang= of <eg>. E.g.:
<eg xml:lang='x-computer-elisp'>(defun wwp-insert-current-date-and-time ()
"Insert ISO extended format date and time"
(insert (format-time-string "%Y-%m-%dT%T%z" (current-time))))</eg>
(Note that the CDATA marked section is not needed, as there happen
not to be any characters that would be mistaken for XML markup.)
* Use <figure> as you suggested.
> following a short discussion in this list from the year 1995, I
> discovered that I could use the element <eg> in combination with a
> CDATA section for the purpose of encoding a chunk of source code
> from any given programming language. (see:
> * Once you are done trying to ‘optimize’ this routine,
> * and have realized what a terrible mistake that was,
> * please increment the following counter as a warning
> * to the next guy:
> * total_hours_wasted_here = 11
> However, if I want to add the name of the programming language I'm
> a little lost, since I can't add a @type Attribute to <eg>.
> The only solution I came up with so far is to put <eg> within the
> <figure> Element and type it accordingly. Another advantage of this
> approach is, that I can add a heading and a caption to the source
> code example.
> <figure type="sourceCode" subtype="php">
> However, I'm not sure, if the semantics of <figure> ("...
> containing graphic information such as an illustration or figure
> ... ") allow for that kind of content.
> Another idea that came to my mind is using <exemplum> element
> instead of <figure>, but it is not usable within a <p> or <div>
> element and according to its semantic, it seems to be only used in
> order to encode chunks of TEI-Markup.
> Does anyone of you have another solution or idea on that issue or
> is <figure><eg>...</eg></figure> already a feasible approach?