Closed uniqueck closed 2 years ago
That's a good idea, I think we should introduce a new attribute named chartjs-dir
. Though, It would be more generic to use the terminology chartjs-location
to be able to specify either a URL or a local path.
Any opinion on this @mojavelinux ?
OK I'm not a ruby developer, but I will try to provide a PR for that.
The Chart.js URL is defined here (as a constant):
You will need to get the value of the attribute chartjsdir
from the doc
in the process
method. If the attribute is defined then you should use normalize_web_path
to concat the filename chart.min.js
with the Chart.js directory.
Here's an example: https://github.com/asciidoctor/asciidoctor/blob/1f90be5f63a7bd9092d8510d88cd6db20caa87bd/lib/asciidoctor/converter/html5.rb#L133
You can add a test here to make sure that everything is working as expected: https://github.com/asciidoctor/asciidoctor-chart/blob/master/spec/docinfo_processor_spec.rb
That's a good idea, I think we should introduce a new attribute named chartjs-dir. Though, It would be more generic to use the terminology chartjs-location to be able to specify either a URL or a local path.
The convention in AsciiDoc is to name it chartsjsdir
(just like highlightjsdir
), which can be a local directory or a URL.
I'm ready with this change, should we also introduce these kind of attributes for c3js and chartist? There is no changelog, should we introduce some? Where I have to document this new attribute? There is no integration for the antora documentation process of https://docs.asciidoctor.org, is this planned for the future?
should we also introduce these kind of attributes for c3js and chartist?
Yes, I think we should to do it to keep things consistent. We might also want to introduce a generic chartdir
where all resources could be found (C3.js, Chartist and Chart.js). Might be a bad idea, not sure... 🤔
Anyway, we should do it as a follow-up issue/pull request.
Where I have to document this new attribute? There is no integration for the antora documentation process of docs.asciidoctor.org, is this planned for the future?
For now, I think it's enough to add a "Configuration" section in the "Getting started" section (after "Usage") to document this new attribute.
We should also document what files are expected to be found in the chartjsdir
.
There is no changelog, should we introduce some?
Maybe later.
sorry for the delay, but I'm busy until today.
We use asciidoctor-chart in combination with asciidoctor-revealjs and the generate slides are deployed in a kubernetes cluster without internet access.
In the extension asciidoctor-revealjs, I can define which reveal.js directory should be used, instead of linking them online. The same approach would be nice for asciidoctor-chart.
So I can download them and point with an asciidoctor attribute to the chart.js directory and the chart extension link the specific scripts relativ to the directory.