From mboxrd@z Thu Jan 1 00:00:00 1970 From: Manuel Koell Subject: Re: html export: what do codehighlighton/off functions do? Date: Fri, 13 Nov 2015 20:55:55 +0100 Message-ID: References: <87mvujjgmf.fsf@gmx.us> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a114edeac8ab15e05247172aa Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33766) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZxKRx-0003FV-A0 for emacs-orgmode@gnu.org; Fri, 13 Nov 2015 14:55:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZxKRw-0007TS-2T for emacs-orgmode@gnu.org; Fri, 13 Nov 2015 14:55:57 -0500 Received: from mail-yk0-x233.google.com ([2607:f8b0:4002:c07::233]:34407) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZxKRv-0007TN-T1 for emacs-orgmode@gnu.org; Fri, 13 Nov 2015 14:55:56 -0500 Received: by ykfs79 with SMTP id s79so165757171ykf.1 for ; Fri, 13 Nov 2015 11:55:55 -0800 (PST) In-Reply-To: <87mvujjgmf.fsf@gmx.us> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Rasmus Cc: org-mode mailing list --001a114edeac8ab15e05247172aa Content-Type: text/plain; charset=UTF-8 Sorry, I didn't know such feature exists in org mode! It's just kinda weird, these function still get called from onmouseover/onmouseout bindings. 2015-11-12 18:02 GMT+01:00 Rasmus : > Manuel Koell writes: > > > Can someone please tell me what these functions do? > > > > ``` > > > > function CodeHighlightOn(elem, id) { var target = > > document.getElementById(id); if(null != target) { > > elem.cacheClassElem = elem.className; elem.cacheClassTarget = > > target.className; target.className = "code-highlighted"; > > elem.className = "code-highlighted"; } } function > > CodeHighlightOff(elem, id) { var target = > > document.getElementById(id); if(elem.cacheClassElem) > > elem.className = elem.cacheClassElem; if(elem.cacheClassTarget) > > target.className = elem.cacheClassTarget; } > > > > > > ``` > > > > The only thing I could think of is to toggle some classes, but I can't > seem > > to find some real world example out there. This javascript code is > included > > on every export, doesn't matter if you've src/example blocks in your org > > file or not. > > It is used for "coderefs" links. Example from unit tests: > > #+BEGIN_SRC emacs-lisp > (+ 1 1) (ref:sc) > #+END_SRC > [[(sc)]] > > It will highlight the appropriate line in the html export. > > Are you asking us to remove the javascript conditionally on whether we > think it will be used? This sounds hard. > > You can remove the JS via the buffer option html-scripts or via > org-html-head-include-scripts. > > Hope it helps, > Rasmus > > -- > I hear there's rumors on the, uh, Internets. . . > > > --001a114edeac8ab15e05247172aa Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Sorry, I didn't know such feature exists in org mode! = It's just kinda weird, these function still get called from onmouseover= /onmouseout bindings.

2015-11-12 18:02 GMT+01:00 Rasmus <rasmus@gmx.us>:=
Manuel Koell <man.koell@gmail.com> writes:

> Can someone please tell me what these functions do?
>
> ```
>
> function CodeHighlightOn(elem, id) {=C2=A0 =C2=A0var target =3D
> document.getElementById(id);=C2=A0 =C2=A0if(null !=3D target) {
> elem.cacheClassElem =3D elem.className;=C2=A0 =C2=A0 =C2=A0elem.cacheC= lassTarget =3D
> target.className;=C2=A0 =C2=A0 =C2=A0target.className =3D "code-h= ighlighted";
> elem.className=C2=A0 =C2=A0=3D "code-highlighted";=C2=A0 =C2= =A0} } function
> CodeHighlightOff(elem, id) {=C2=A0 =C2=A0var target =3D
> document.getElementById(id);=C2=A0 =C2=A0if(elem.cacheClassElem)
> elem.className =3D elem.cacheClassElem;=C2=A0 =C2=A0if(elem.cacheClass= Target)
> target.className =3D elem.cacheClassTarget; }
>
>
> ```
>
> The only thing I could think of is to toggle some classes, but I can&#= 39;t seem
> to find some real world example out there. This javascript code is inc= luded
> on every export, doesn't matter if you've src/example blocks i= n your org
> file or not.

It is used for "coderefs" links.=C2=A0 Example from unit t= ests:

#+BEGIN_SRC emacs-lisp
(+ 1 1)=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (ref:= sc)
#+END_SRC
[[(sc)]]

It will highlight the appropriate line in the html export.

Are you asking us to remove the javascript conditionally on whether we
think it will be used?=C2=A0 This sounds hard.

You can remove the JS via the buffer option html-scripts or via
org-html-head-include-scripts.

Hope it helps,
Rasmus

--
I hear there's rumors on the, uh, Internets. . .



--001a114edeac8ab15e05247172aa--