Captions are currently auto-generated for example, figure and table blocks.
Numbering code listing blocks is a very common requirement for technical
articles. Therefore, I think listing blocks should be added to the built-in set
of blocks that get auto-numbered.
This requires a change to both the listingblock template and the
source-highlight-block template (if in use).
The first step is to define a caption prefix in the language file:
[attributes]
listing-caption=Listing
The next step is to set the fallback caption in the listingblock in html
backends. Here's the template for html5.conf.
[listingblock]
<div class="listingblock{role? {role}}{unbreakable-option? unbreakable}"{id?
id="{id}"}>
<div class="title">{caption={listing-caption} {counter:listing-number}.
}{title}</div>
<div class="content monospaced">
<pre>
|
</pre>
</div></div>
Here's the source-highlight-block template for the xhtml and html5 backends in
source filter configuration file:
[source-highlight-block]
<div class="listingblock{role? {role}}">
<a name="{id}"></a>
<div class="title">{caption={listing-caption} {counter:listing-number}.
}{title}</div>
<div class="content">
{source-highlighter$highlight:}<pre><code>
|
{source-highlighter$highlight:}</code></pre>
</div></div>
Original issue reported on code.google.com by dan.j.allen on 10 Feb 2013 at 8:00
Original issue reported on code.google.com by
dan.j.allen
on 10 Feb 2013 at 8:00