From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id CEtoHIoEwF5PYAAA0tVLHw (envelope-from ) for ; Sat, 16 May 2020 15:19:38 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id 8LBGGIoEwF5yeAAA1q6Kng (envelope-from ) for ; Sat, 16 May 2020 15:19:38 +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 1F6E6940C01 for ; Sat, 16 May 2020 15:19:37 +0000 (UTC) Received: from localhost ([::1]:40470 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZybA-0001mn-1Y for larch@yhetil.org; Sat, 16 May 2020 11:19:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43380) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jWLzD-0002nc-L3 for emacs-orgmode@gnu.org; Wed, 06 May 2020 11:29:27 -0400 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]:56309) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jWLzC-0001Gj-OA for emacs-orgmode@gnu.org; Wed, 06 May 2020 11:29:27 -0400 Received: by mail-pj1-x102e.google.com with SMTP id a32so1064261pje.5 for ; Wed, 06 May 2020 08:29:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:date:user-agent:mime-version :content-language; bh=4OuN15hKlKyCjVAHUKY01tP5LFuk7Rxvnd6Zv77hyc0=; b=VCV+I5Lizi1qYc9qvdomUZIjnQunQz1petq4NbMEHuTL36jSZW2+Fn6XXo5Lk2z0h6 fOmu+V37BKC4yGc4j6iwl1KBf1elDb0oi8LXiFafws5aseF9lghMVKAMTwoX7j7M719Q ihlcFTnUNa3lQZCdYMTUi4lgiBrEPmxW4JDPGNcAY3Rb2SuMMRrFd4aXUHQXMa1xOYGC tfPSugRO9gLvwdMc9NHwk5qEwLSsydBAtL5KkjQYbQmtgUQnlqc69r0iNG6heOT24WGN /Z0E5nylrB1GcVZeOtNBpLjUlR8k2rvxAcMwVKXouY1o8VbV8hxXS75liu7SHV/h6Eu7 dS2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-language; bh=4OuN15hKlKyCjVAHUKY01tP5LFuk7Rxvnd6Zv77hyc0=; b=G7TmgI4V5SXdB4n622tBXXUVSpI35n0+MwxMa0zQg0Brr/mBa5jiyYlTr7Of85GgyF +/LaOKsVrVgexWGBf6QyssrGg2VX15s+9oteqoC067bB4+OFCSwUShPx1qGauNemH5KH 37JTuR8DVazAPhqBVNhAexKWLujzzVb5hG4DNmlNntRk7Wii4AdjYX+fImUoehxyljdC AvCxnq1p6SNnovwTMz+k/V1EB5e4f42BA+Fz2ox12KMRThqx2SlFtHNIcGXfb3SCOrvU sha4HH64gPRPPEaqoFPUbWxee8yB3Ew0++Rxhs7xVtL7QTi7PZo5qTup5UE4PFofTVtK g6mw== X-Gm-Message-State: AGi0PuYJM667z0FEVoXmtnbniY0pqURRXQ8fmX/blSdVqZ43ZkAW7qBz XHN2IWECllN2wrk6YyPWtmXEe1IF5EQ= X-Google-Smtp-Source: APiQypJ3VuWVxowVfreAvKOL9EIRFt4zks97rCk5QqN+GrRStdhG17P+wF+Z2wGcXG7L7GmNmmF6zA== X-Received: by 2002:a17:902:b286:: with SMTP id u6mr8456959plr.11.1588778964722; Wed, 06 May 2020 08:29:24 -0700 (PDT) Received: from [192.168.0.107] ([103.94.252.79]) by smtp.gmail.com with ESMTPSA id a23sm2125280pfo.145.2020.05.06.08.29.22 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 06 May 2020 08:29:23 -0700 (PDT) To: emacs-orgmode@gnu.org From: bpanthi Subject: possible fix for a bug in org-mode html export Message-ID: <6c6618d6-16bc-c76e-7f6c-24b5fb7f324e@gmail.com> Date: Wed, 6 May 2020 21:14:14 +0545 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------A51E59CF17D901A63B4B8FA4" Content-Language: en-US Received-SPF: pass client-ip=2607:f8b0:4864:20::102e; envelope-from=bpanthi977@gmail.com; helo=mail-pj1-x102e.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-Mailman-Approved-At: Sat, 16 May 2020 11:19:00 -0400 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=pass header.d=gmail.com header.s=20161025 header.b=VCV+I5Li; dmarc=pass (policy=none) header.from=gmail.com; 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: 5.39 X-TUID: nKPp3yE6lVRh This is a multi-part message in MIME format. --------------A51E59CF17D901A63B4B8FA4 Content-Type: multipart/alternative; boundary="------------53CA498C17C3B21F4BFD94BA" --------------53CA498C17C3B21F4BFD94BA Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit When exporting an org file containing latex fragments with option #+OPTIONS: tex:dvipng in the html file the png image src attribute's value is not a valid URI.   while it should be   for the browser to work. In my config I have  (setq org-preview-latex-image-directory "E:/tmp/ltximg/") so that all images are created in a single directory and don't clutter my org file directory. I fixed this issue for me by modifying `org-html--format-image' function of ox-html.el file as follow: (defun org-html--format-image (source attributes info) "Return \"img\" tag with given SOURCE and ATTRIBUTES. SOURCE is a string specifying the location of the image. ATTRIBUTES is a plist, as returned by `org-export-read-attribute'. INFO is a plist used as a communication channel." (if (string= "svg" (file-name-extension source)) (org-html--svg-image source attributes info) (org-html-close-tag "img" (org-html--make-attribute-string (org-combine-plists (list :src (concat "file:///" source) :alt (if (string-match-p "^ltxpng/" source) (org-html-encode-plain-text (org-find-text-property-in-string 'org-latex-src source)) (file-name-nondirectory source))) attributes)) info))) I just changed (list :src source ...) to (list :src (concat "file:///" source). I don't know if it is an acceptable way or it further causes bugs in other places. Hope that this will find the proper way and fix it. (emacs-version) = "GNU Emacs 26.3 (build 1, x86_64-w64-mingw32) of 2019-11-01" (org-version) = "9.3.6" Emacs Admirer, Bibek Panthi --------------53CA498C17C3B21F4BFD94BA Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit

When exporting an org file containing latex fragments with option

#+OPTIONS: tex:dvipng 

in the html file the png image src attribute's value is not a valid URI. <img src="e:/dir/sth.png" ...>  while it should be <img src="file:///e:/dir/sth.png" ...>  for the browser to work. In my config I have  (setq org-preview-latex-image-directory "E:/tmp/ltximg/") so that all images are created in a single directory and don't clutter my org file directory.

I fixed this issue for me by modifying `org-html--format-image' function of ox-html.el file as follow:

(defun org-html--format-image (source attributes info)
  "Return \"img\" tag with given SOURCE and ATTRIBUTES.
SOURCE is a string specifying the location of the image.
ATTRIBUTES is a plist, as returned by
`org-export-read-attribute'.  INFO is a plist used as
a communication channel."
  (if (string= "svg" (file-name-extension source))
      (org-html--svg-image source attributes info)
    (org-html-close-tag
     "img"
     (org-html--make-attribute-string
      (org-combine-plists
       (list :src (concat "file:///" source)
	     :alt (if (string-match-p "^ltxpng/" source)
		      (org-html-encode-plain-text
		       (org-find-text-property-in-string 'org-latex-src source))
		    (file-name-nondirectory source)))
       attributes))
     info)))

I just changed (list :src source ...) to (list :src (concat "file:///" source).

I don't know if it is an acceptable way or it further causes bugs in other places.
Hope that this will find the proper way and fix it. 

(emacs-version) = "GNU Emacs 26.3 (build 1, x86_64-w64-mingw32) of 2019-11-01"
(org-version) = "9.3.6"

Emacs Admirer,
Bibek Panthi

--------------53CA498C17C3B21F4BFD94BA-- --------------A51E59CF17D901A63B4B8FA4 Content-Type: text/plain; charset=UTF-8; name="sample.org" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="sample.org" IytPUFRJT05TOiB0ZXg6ZHZpcG5nDQoNCiogVmVjdG9yIFN1YnNwYWNlDQorIFN1YnNwYWNl IDo6IEEgc3Vic3BhY2Ugb2YgYSB2ZWN0b3Igc3BhY2UgJFYkIGlzIGEgc3Vic2V0ICRTIFxz dWJzZXQgViQNCiAgc3VjaCB0aGF0ICRTJCBpdHNlbGYgaXMgYSB2ZWN0b3Igc3BhY2UuIChp LmUuIGl0IG11c3QgYmUgY2xvc2VkDQogIHVuZGVyIGFkZGl0aW9uLCBhbmQgc2NhbGluZyBh bmQgdGh1cyBhbHNvIGluY2x1ZGUgJDAkKQ0K --------------A51E59CF17D901A63B4B8FA4--