On 19 September 2015 at 17:47, Jon Leech <[email protected]> wrote: > In order to inject MathJax headers into generated HTML, I've had to create a > user config file with redefines the [header] macro used in e.g. html5.conf. > There didn't seem to be any obvious way to just inject my own <script> > tags into the HTML headers without doing this.
Did you try the docinfo? See http://asciidoc.org/userguide.html#X95 section 8.2.1 which says for HTML output the docinfo provides " style and script elements for CSS and JavaScript inclusion" Cheers Lex > However, the stock [header] > macros have a large number of include1:: directives which are relative to > the {stylesdir} and {scriptsdir} variables. If I leave these includes intact > in my > modified [header] macro, I get errors like this: > > asciidoc -b html5 -a mathjax -f config/testadoc.conf \ > -o adoc/test.html test.txt > asciidoc: WARNING: Include file not found: config/stylesheets/asciidoc.css > asciidoc: WARNING: Include file not found: config/javascripts/asciidoc.js > asciidoc: WARNING: test.txt: line 2: Include file not found: > config/stylesheets/asciidoc.css > asciidoc: WARNING: test.txt: line 2: Include file not found: > config/javascripts/asciidoc.js > > My next attempt was to preface the modified [header] in my user .conf file > with > > [attributes] > stylesdir=/etc/asciidoc/stylesheets > scriptsdir=/etc/asciidoc/javascripts > > This was less than optimal since it hardwired the installed path into my > user script. But it... sort of worked: > > asciidoc -b html5 -a mathjax -f config/testadoc.conf \ > -o adoc/test.html test.txt > asciidoc: WARNING: Include file not found: config/stylesheets/asciidoc.css > asciidoc: WARNING: Include file not found: config/javascripts/asciidoc.js > > Despite the warnings, the css/js still showed up in the generated output. > I don't really understand why, but by turning on -v I can see that something > in the system html5.conf is being invoked *after* it reads my conf file and > that somehow results in the proper include files being injected in the > context of my [header]. Perhaps it has something to do with the multi-pass > partial-invocation approach to processing conf files? > > Is there a way to, in decreasing order of preference: > > 1) Add my own code into the HTML header without replacing the [header] > macro? > 2) Change the include1 directives in my modified [header] to refer to > whatever the system install path for the scripts is, without hardwiring > it in? > 3) Do what I'm doing now, but in a way that makes the warnings go away? > > Thanks, > > Jon > > (N.b. I can provide a code example if it helps, but am hoping it's just > a matter of understanding more about conf files that is apparent from > the description above). > > > > > -- > You received this message because you are subscribed to the Google Groups > "asciidoc" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/asciidoc. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "asciidoc" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/asciidoc. For more options, visit https://groups.google.com/d/optout.
