all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] Org-mode publish avoids inserting licensed content into target documents.
@ 2020-06-17  0:45 Anthony Carrico
  2020-09-05  8:03 ` Bastien
  0 siblings, 1 reply; 3+ messages in thread
From: Anthony Carrico @ 2020-06-17  0:45 UTC (permalink / raw)
  To: emacs-orgmode

* It is customary for compilers to avoid claiming authorship over target
code.  However, the org-mode publish document publisher silently
inserted licensed content into target documents.  This patch replaces
the GPL-V3 licensed highlighter script with a public domain version to
resolve this issue.

The public domain version works in a different way than the original.
It adds(removes) highlighting rather than replacing the original
format.  In contrast, the old version caches(restores).  Because the
new add(remove) method is idempotent, the public domain version avoids
a potential bug in the original: the cached value would be lost if it
was called twice in succession.

This entire patch is released to the public domain by its author,
Anthony Carrico.  TINYCHANGE
---
 lisp/ox-html.el | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 32996c2c2..6a4555bc7 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -233,25 +233,23 @@ property on the headline itself.")
 
 (defconst org-html-scripts
   "<script type=\"text/javascript\">
-// @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&amp;dn=gpl-3.0.txt GPL-v3-or-Later
+// @license magnet:?xt=urn:btih:e95b018ef3580986a04669f1b5879592219e2a7a&dn=public-domain.txt Public Domain
 <!--/*--><![CDATA[/*><!--*/
      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\";
+         elem.classList.add(\"code-highlighted\");
+         target.classList.add(\"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;
+       if(null != target) {
+         elem.classList.remove(\"code-highlighted\");
+         target.classList.remove(\"code-highlighted\");
+       }
      }
     /*]]>*///-->
 // @license-end
-- 
2.25.4



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-09-09 14:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-17  0:45 [PATCH] Org-mode publish avoids inserting licensed content into target documents Anthony Carrico
2020-09-05  8:03 ` Bastien
2020-09-09 14:44   ` Anthony Carrico

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.