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] javascript file in docbook generated html


My experiments succeded, so that from one script I can import others. This means I can linenmber and syntax highlight with Prism. The built in through Saxon transform never worked. So I returned to xsltproc which is also way faster.

I got a couple of nice customizations in place to support Prism.js

One peculiar caveat though, type=module does NOT work with xhtml, only with html. My webdev eyes get sore from seeing the html output. Not pretty, but it works.

/Niels

Greetings
Niels MÃller Larsen
Programmer/Teacher



On 20 Apr 2020, at 03.33, Bob Stayton <bobs@sagehill.net> wrote:

ï

Hi Niels,

I'm not sure I understand if this is working for you.  Multiple scripts are allowed as a space-separated value to the stylesheet parameter html.script, and they each generate a <script> element.  They would all get the same @type, though.

In any case, if you need more than the simple script handling provided by the params, there is an empty utility template named 'user.head.content' that you can customize instead.  It is called within <head> to output whatever custom head content you need.  It is described here:

http://www.sagehill.net/docbookxsl/HtmlHead.html

Bob Stayton
bobs@sagehill.net
On 4/19/2020 2:52 AM, Niels MÃller Larsen wrote:
Thanks Bob. Are there any details you donât have handy?

I notice âa scriptâ at the link location. Not âthe scriptâ.
I tested if you could include more than one. Didnât work. So the âtype=âmoduleâ will allow you to import other scripts to help the one allowed in docbook. This supports a better structure in the necessary js code.
In css you can import other sheets. In js you can do that only with type=module.
At present I am trying to interface my pages with prism.js for syntax highlighting. Prism is a script and a css sheet.

But thanks again

/Niels

Greetings
Niels MÃller Larsen
Programmer/Teacher



On 19 Apr 2020, at 07.53, Bob Stayton <bobs@sagehill.net> wrote:

ï

If you just want to change the @type attribute value for all scripts, there's a param for that:

http://docbook.sourceforge.net/release/xsl/current/doc/html/html.script.type.html

Bob Stayton
bobs@sagehill.net
On 4/18/2020 5:01 AM, Niels MÃller Larsen wrote:
Hi all
You may customize docbook to include a certain _javascript_ into all your generated html files (chunked) by including

    <xsl:param name="html.script">nmlQuery.js</xsl:param>

is there a way you can make this appear in the html as

<script src="" type="module"/>

it would be very convenient by allowing you to structure your js in a more moderne way.

BTW ...type="text/_javascript_" is not necessary in this day and age.



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