OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]

Subject: Re: [docbook-apps] How to insert JavaScript near end of HTML without chunking?

Hello again,

Well... this seems to work, though it doesn't feel right. I put this as one of the tasks for the maven-antrun-plugin of the POM:

        <replace dir='${basedir}/target/docbkx/html/' token='&lt;/body&gt;'>

         <include name='**/**/*.html' />

         <replacevalue>&lt;script type="text/javascript"&gt;

  var _gaq = _gaq || [];

  _gaq.push(['_setAccount', 'UA-********-*']);


  (function() {

    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;

    ga.src = "('https:'" == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';

    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);




It would be cool if there were something like user.footer.content that worked without chunking.


On Thu, May 19, 2011 at 3:45 PM, Mark Craig <mark.craig@gmail.com> wrote:
Hello, thanks for your suggestion.

This is what I tried after I found user.footer.content only gets used when chunking.

Trouble is, I can insert the file in the HTML following the instructions you cite.

But either I get effectively "&lt;script&gt;" etc. in the HTML, using <xinclude:include href=""ga.txt"" parse="text" />.
Or the HTML is okay but the build breaks generating PDF with <xinclude:include href=""ga.txt"" />, because the FO specification has never heard of <script> elements.


On Thu, May 19, 2011 at 3:23 PM, Peter Desjardins <peter.desjardins.us@gmail.com> wrote:
On Thu, May 19, 2011 at 2:28 AM, Mark Craig <mark.craig@gmail.com> wrote:

> How does one insert <script> content, such as for Google Analytics, near the
> end of generated HTML?
> Chunking is turned off by popular reader demand.

Can you use a technique like this one?


Since you're not chunking, it might be easy to add a processing
instruction at the end of your document.


Mark Craig

Mark Craig
e: mark.craig@gmail.com
t: +33 7 60 69 95 68
blog: http://mcraig.org/mec

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]