Giter Site home page Giter Site logo

Comments (7)

yjwen avatar yjwen commented on August 9, 2024

OK. I am not familiar with JS. So will all JS be specified in the form

{src: 'xxx.js', async:true, condition: function() {return !!document.body.classList} }

or it is possible there are JS in other forms.

If all JS are in the same form, I can modify org-reveal to simply the statements, otherwise, we have to leave some extensibility there.

Regards,
Yujie

from org-reveal.

VladimirAlexiev avatar VladimirAlexiev commented on August 9, 2024
  1. I think the JS fragment is correct.
  2. To allow a space-separated list and global default (see org-export-options-alist):
    (:reveal-extra-js "REVEAL_EXTRA_JS" nil org-reveal-extra-js split)

(defcustom org-reveal-extra-js nil
  "List of extra JS files or URLs to load"
  :group 'org-export-reveal
  :type 'list)
  1. I think that you should do the same with :reveal-extra-css.
  2. And it may also be better to handle :reveal-plugins like a list, instead of space-separated string.

from org-reveal.

VladimirAlexiev avatar VladimirAlexiev commented on August 9, 2024

The above defcustom is bogus. The right one is this, see (info "(elisp)Simple Types") and (info "(elisp)Composite Types")

(defcustom org-reveal-extra-js nil
  "List of extra JS files or URLs to load"
  :group 'org-export-reveal
  :type '(set (choice (file :tag "File" :must-match t)
                      (string :tag "URL"))))

This will offer auto-completion if the user picks the File choice

from org-reveal.

psifertex avatar psifertex commented on August 9, 2024

I'm loading some extra libraries to do graphing and that required specifying the callback function so for me it was easier to do #+REVEAL_EXTRA_JS: { src: './js/Chart.min.js', async: true , callback: function() { Chart.renderChart(); } }, { src: './js/Chart.StackedBar.js', async: true }. Figured I'd drop that here in case anyone else is trying to do something similar.

from org-reveal.

gongzhitaao avatar gongzhitaao commented on August 9, 2024

Is it good to have REVEAL_EXTRA_JS accept the same arguments as HTML_HEAD_EXTRA? Or actually rename it as REVEAL_HEAD_EXTRA?

from org-reveal.

VladimirAlexiev avatar VladimirAlexiev commented on August 9, 2024

@psifertex: imho the best is to elaborate the defcustom to include for each value a string field callback (eg Chart.renderChart()) and a boolean field async. Breaking the info into fields makes it easier for a user to fill out correctly.

@gongzhitaao HTML_HEAD_EXTRA is not appropriate since it's merely lines to be added to the <HEAD>

from org-reveal.

yjwen avatar yjwen commented on August 9, 2024

Since there are possibly different requirements for the format of JS script format, I'd like to leave REVEAL_EXTRA_JS as it is now, where one can write whatever JS code, ugly though.

Let me close the issue for now.

from org-reveal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.