[pmwiki-users] Trying to include this javascript code with custom markup
Petko Yotov
5ko at 5ko.fr
Fri Mar 21 03:38:49 PDT 2025
Technically you also need to escape $ signs to \$ in the JavaScript code
in a PHP string.
I would indeed place the JS code in a separate JS file and add a
<script> element instead of inline JS in the HTML page.
Create a file say pub/chronologie.js
Place in the file the JS code that is working.
In PHP, return:
Keep('<script src="https://d3js.org/d3.v7.min.js"></script>
<script src="$PubDirUrl/chronologie.js"></script>');
Possibly, add (:chronologie:) after (:template last:) in the pagelist
template.
Le me know if you have questions or need assistance, this
enhancement/augmentation is very appropriate for automation.
I am using the Chart.js library for charts rather than d3, I plan to
someday release a PmWiki extension for charts.
Petko
On 21/03/2025 10:38, ABClf wrote:
> either to load the javascript from an external javascript file (rather
> than including it in my php file config) ;
> thus my question becomes : how to include an external javascript from
> custom markup rule and, more generally, what is the way to go to get
> the magic begin ?
More information about the pmwiki-users
mailing list