Adding scripts in Mallard?

Philip Chimento <philip.chimento at gmail.com>
Mon Feb 20 17:42:05 EST 2012

On Mon, Feb 20, 2012 at 17:14, Shaun McCance <shaunm at gnome.org> wrote:
> On Wed, 2012-02-15 at 21:37 +0100, Philip Chimento wrote:
>> Hello,
>>
>> I'm wondering if there's a way to include <script>s in the HTML that
>> Mallard generates. For example, I'd like to have my code listings
>> highlighted with highlight.js [1], so I'd want to add, say, the
>> following to the <head> in the generated HTML:
>>
>> <link rel="stylesheet"
>> href="http://yandex.st/highlightjs/6.1/styles/github.min.css"></link>
>> <script src="../highlight.pack.js"></script>
>> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
>> <script>
>> $(document).ready(function() {
>>   $('pre.code').each(function(i, e) {hljs.highlightBlock(e, '    ')});
>> });
>> </script>
>>
>> But there's no <xsl:apply-templates> in the section of
>> mal2html-page.xsl that generates the HTML's <head>, so no place for a
>> custom XSLT stylesheet to hook into.
>
> You want to override the html.head.custom template, defined in
> common/html.xsl.
>
> Incidentally, Yelp's stylesheets can do syntax highlighting using the
> jQuery.Syntax library if you set the mime attribute on code elements
> and you set the html.syntax.highlight parameter to true. I still need
> to do quite a bit of work on the colorers, though, so if you're happier
> with the results with highlight.js, just use that.

Ah, okay - I was using gnome-doc-tool and its stylesheets, not
yelp-build... that clarifies a lot. I see yelp's stylesheets provide
much more opportunities for customization.

Regards,
-- 
Philip Chimento