Not logged in. · Lost password · Register
Forum: General Help and Support Development RSS
Plugin Dependency: Adding a header script if a syntax exist
Avatar
gerardnico #1
Member since Mar 2009 · 4 posts · Location: Oegstgeest Netherlands
Group memberships: Members
Show profile · Link to this post
Subject: Plugin Dependency: Adding a header script if a syntax exist
Hallo,

I would like to improve the page load of my wiki.

The plugin mathjax is using a third party library javascript that render the math expression
https://www.dokuwiki.org/plugin:mathjax

Ie there is a action plugin that is triggerd at the hook TPL_METAHEADER_OUTPUT and add the following:
<script src='https://cdnjs.cloudflare.com/ajax/libs/mathjax/2…?config…' async></script>

There is also a syntax plugin that takes care of all math expression
<math>x^2</math>

I would like to add the javascript library only if there is a math expression.

I actually have tried with a boolean constant class but has the same class object is used between test case, I got a false positive.
Ie the test works in isolation but not in the test serie.

Does dokuwiki have a mechanism to take care of this kind of dependency between a syntax and a action plugin ?

Thanks
Nico
Avatar
andi (Administrator) #2
User title: splitbrain
Member since May 2006 · 3485 posts · Location: Berlin Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Your syntax plugin could set some metadata that your action plugin reads. You could also use a minimal javascript that is always loaded, which checks for math tags and if it finds any it loads and executes additional script.
Read this if you don't get any useful answers.
Lies dies wenn du keine hilfreichen Antworten bekommst.
Avatar
gerardnico #3
Member since Mar 2009 · 4 posts · Location: Oegstgeest Netherlands
Group memberships: Members
Show profile · Link to this post
Javascript is king :)

Thanks for the answer, I will check in this direction.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
Imprint
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2019-10-17, 10:05:39 (UTC +02:00)