callouts again: are pictures possible after a source-highlight pass ?

53 views
Skip to first unread message

Lionel

unread,
Feb 18, 2010, 4:27:30 AM2/18/10
to asciidoc
I am using the source-highlight filter and the xhtml backend of
asciidoc to output the single-page html version of the documentation,
because the highlighted source looks great.

source-highlight, in that case, outputs html directly, which is
included then by asciidoc in the final doc.

I was wondering if it's possible to filter the html once again after
the source-highlight pass, and replace a pattern corresponding to the
generated html for the callout numbers, by the html to display the
same callout pictures used with the docbook backend (black circles) ?

It would greatly improve the look and feel of the callout lists with
the xhtml backend.

Any ideas of the best way to do that ? on my machine (but I suppose
this is specific to the configuration and version of source-
highlight), the callout numbers generate the following html code (to
be replaced):

<span style="color: #990000">&lt;</span><span style="color:
#993399">1</span><span style="color: #990000">&gt;</span>

I'd like this to be changed to:

<img src="./callouts/1.png" alt="1" border="0" />

And even better, later, i'd try to make the cross-reference links
between the callout and the callout-list definition work.

Thanks for hints,
Lionel

Stuart Rackham

unread,
Feb 22, 2010, 3:53:30 AM2/22/10
to asci...@googlegroups.com

You could redefine the callout-inlinemacro template in xhtml11.conf as:

[callout-inlinemacro]
<img src="./callouts/{index}.png" alt="{index}" border="0" />


To place callout icons in the list item bullets something like this:

[listtags-callout]
list=<div class="colist{style? {style}}"{id? id="{id}"}>{title?<div
class="title">{title}</div>}<table>|</table></div>
item=<tr><td style="padding-right:0.5em;"><img src="./callouts/{listindex}.png"
alt="{listindex}" /></td><td>|</td></tr>
text=|


I'll look at putting this into the trunk.


Cheers, Stuart


>
> Thanks for hints,
> Lionel
>

Lionel

unread,
Feb 22, 2010, 8:35:21 AM2/22/10
to asciidoc
Great, I already guessed the first part, thanks for the remaining one.

I was considering using the original <ol> for the calllout list, and
append a class name to items, i.e

<ol class="calloutlist">
<li class="colist-1">...</li>
<li class="colist-2">...</li>
<li class="colist-3">...</li>
</ol>

then using CSS to redefine list-type:

ol.calloutlist li.colist-1 { list-style-image: url('./callouts/
1.png'); }
ol.calloutlist li.colist-2 { list-style-image: url('./callouts/
2.png'); }
ol.calloutlist li.colist-3 { list-style-image: url('./callouts/
3.png'); }

I don't know if it's better, but I'd rather avoid tables if not
necessary. ascciidoc xhtml backend nicely uses <ol> for now, why not
keep it ?

Lionel

Stuart Rackham

unread,
Feb 22, 2010, 6:46:01 PM2/22/10
to asci...@googlegroups.com
Lionel wrote:
> Great, I already guessed the first part, thanks for the remaining one.
>
> I was considering using the original <ol> for the calllout list, and
> append a class name to items, i.e
>
> <ol class="calloutlist">
> <li class="colist-1">...</li>
> <li class="colist-2">...</li>
> <li class="colist-3">...</li>
> </ol>
>
> then using CSS to redefine list-type:
>
> ol.calloutlist li.colist-1 { list-style-image: url('./callouts/
> 1.png'); }
> ol.calloutlist li.colist-2 { list-style-image: url('./callouts/
> 2.png'); }
> ol.calloutlist li.colist-3 { list-style-image: url('./callouts/
> 3.png'); }
>
> I don't know if it's better, but I'd rather avoid tables if not
> necessary. ascciidoc xhtml backend nicely uses <ol> for now, why not
> keep it ?

CSS hardwires the image path -- we need to set it dynamically using the AsciiDoc
iconsdir attribute (I didn't get round to that in the example I posted). Also
missing is that the use of icons should be conditional on the AsciiDoc icons
attribute.

I've committed the completed patch:

http://code.google.com/p/asciidoc/source/detail?r=1de6d41c76463615c8b5dac756be3d37e37fafb0


Cheers, Stuart


>
> Lionel

Lionel

unread,
Feb 23, 2010, 2:43:13 AM2/23/10
to asciidoc
great, thanks a lot !

Another request: is it possible to _also_ provide cross-reference
links between the callouts and callout-list items, like docbook
stylesheets do ? That would be awesome.

regards,
Lionel

> http://code.google.com/p/asciidoc/source/detail?r=1de6d41c76463615c8b...

Stuart Rackham

unread,
Feb 23, 2010, 4:35:36 PM2/23/10
to asci...@googlegroups.com
Lionel wrote:
> great, thanks a lot !
>
> Another request: is it possible to _also_ provide cross-reference
> links between the callouts and callout-list items, like docbook
> stylesheets do ? That would be awesome.

It's possible, but would require code changes to asciidoc.

Cheers, Stuart


>
> regards,
> Lionel

Reply all
Reply to author
Forward
0 new messages