all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* possible fix for a bug in org-mode html export
@ 2020-05-06 15:29 bpanthi
  2020-05-16 17:30 ` Nicolas Goaziou
  0 siblings, 1 reply; 3+ messages in thread
From: bpanthi @ 2020-05-06 15:29 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 1687 bytes --]

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


[-- Attachment #1.2: Type: text/html, Size: 2201 bytes --]

[-- Attachment #2: sample.org --]
[-- Type: text/plain, Size: 243 bytes --]

#+OPTIONS: tex:dvipng

* Vector Subspace
+ Subspace :: A subspace of a vector space $V$ is a subset $S \subset V$
  such that $S$ itself is a vector space. (i.e. it must be closed
  under addition, and scaling and thus also include $0$)

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

* Re: possible fix for a bug in org-mode html export
  2020-05-06 15:29 possible fix for a bug in org-mode html export bpanthi
@ 2020-05-16 17:30 ` Nicolas Goaziou
  2020-05-17  3:18   ` Bibek Panthi
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Goaziou @ 2020-05-16 17:30 UTC (permalink / raw)
  To: bpanthi; +Cc: emacs-orgmode

Hello,

bpanthi <bpanthi977@gmail.com> writes:

> 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.

I have fixed it in master. Please let me know how it goes.

Thank you.

Regards,

-- 
Nicolas Goaziou


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

* Re: possible fix for a bug in org-mode html export
  2020-05-16 17:30 ` Nicolas Goaziou
@ 2020-05-17  3:18   ` Bibek Panthi
  0 siblings, 0 replies; 3+ messages in thread
From: Bibek Panthi @ 2020-05-17  3:18 UTC (permalink / raw)
  To: bpanthi, emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 592 bytes --]

I verfied. It works well.
Thanks!
On Sat, 16 May, 2020, 11:15 PM Nicolas Goaziou, <mail@nicolasgoaziou.fr>
wrote:

> Hello,
>
> bpanthi <bpanthi977@gmail.com> writes:
>
> > 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.
>
> I have fixed it in master. Please let me know how it goes.
>
> Thank you.
>
> Regards,
>
> --
> Nicolas Goaziou
>

[-- Attachment #2: Type: text/html, Size: 1173 bytes --]

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

end of thread, other threads:[~2020-05-17  3:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-06 15:29 possible fix for a bug in org-mode html export bpanthi
2020-05-16 17:30 ` Nicolas Goaziou
2020-05-17  3:18   ` Bibek Panthi

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.