From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id bzSMMp4qw16rEgAA0tVLHw (envelope-from ) for ; Tue, 19 May 2020 00:38:54 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id aFXOLZ4qw16PewAAbx9fmQ (envelope-from ) for ; Tue, 19 May 2020 00:38:54 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id CF971940B6B for ; Tue, 19 May 2020 00:38:53 +0000 (UTC) Received: from localhost ([::1]:36134 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jaqHU-0004Xp-CC for larch@yhetil.org; Mon, 18 May 2020 20:38:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33494) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jaqHA-0004Xh-Hh for emacs-orgmode@gnu.org; Mon, 18 May 2020 20:38:32 -0400 Received: from memebeam.org ([80.68.89.71]:56447 helo=jvb.vm.bytemark.co.uk) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jaqH9-0004Ft-A4 for emacs-orgmode@gnu.org; Mon, 18 May 2020 20:38:32 -0400 Received: from [192.168.1.27] (dhcp-68-142-47-225.greenmountainaccess.net [::ffff:68.142.47.225]) (AUTH: LOGIN acarrico@memebeam.org, TLS: TLS1.3, 128bits, ECDHE_RSA_AES_128_GCM_SHA256) by jvb.vm.bytemark.co.uk with ESMTPSA id 000000000018C228.5EC32A85.0000365B; Mon, 18 May 2020 20:38:29 -0400 From: Anthony Carrico Subject: ISSUE: org publish document processor silently inserts licensed content into targets by default To: emacs-orgmode@gnu.org Message-ID: <450d0a78-2316-28b6-9781-0935053831bf@memebeam.org> Date: Mon, 18 May 2020 20:38:27 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=80.68.89.71; envelope-from=acarrico@memebeam.org; helo=jvb.vm.bytemark.co.uk X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/18 20:38:29 X-ACL-Warn: Detected OS = Linux 3.1-3.10 X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: -1.01 X-TUID: 5ToX3WYQsas0 ISSUE: An author should expect a compiler to avoid claiming authorship over target code, however, currently the org-mode publish document processor silently inserts licensed content into target documents by default. SOLUTION: The following script is a drop-in-replacement which provides the same API as the original, without a license. It also opts not to highlight code links, but only their targets, which seems less distracting (it is a simple change to keep the original behavior if preferred). The public domain version works in a different way than the original, fixing a potential bug. It adds(removes) highlighting rather than replacing the original format. Ignoring the boilerplate, the new script is: target.classList.add("code-highlighted") The add method is idempotent. In contrast, the old version caches(restores): elem.cacheClassTarget = target.className; target.className = "code-highlighted"; Note that the cached value would be lost if this was called twice in succession. I've added the comment, "any content added to the source document by the document processor, including this script, is in the public domain". This statement may seem superfluous, since an author should expect the compiler to avoid claiming authorship over target code anyway. I've only added it in contrast with the original claim. Assuming the org-mode authors agree with the goal of publish acting as pure compiler, and if it seems more appropriate not to pass the notice through to the target html, then feel free to remove this notice from the org-html-scripts definition, perhaps retaining it above the definition as an as an elisp comment and/or as a note in the documentation. One last note: users can attempt to fix this issue by disabling :html-head-include-scripts, but doing so will provoke an error when a reader's browser attempts to highlight links to source code literal lines, so it is probably better to patch the script. Anyway here is my patch, you can adapt it to your emacs init, or call it from the command line as "emacs --batch -l publish". I declare that this patch is in the public domain. Enjoy. ;;; publish.el --- publish project with org publish -*- lexical-binding: t; -*- ;; To use this from the shell: ;; ;; emacs --batch -l publish (require 'org) (require 'ox-publish) (defconst public-domain-scripts "") ;; patch globally: (setq org-html-scripts public-domain-scripts) (org-publish-all) ;; or patch locally: ;; ;; (let ((org-html-scripts public-domain-scripts)) (org-publish-all)) -- Anthony Carrico