From: Kaushal Modi <kaushal.modi@gmail.com>
To: Brett Viren <bv@bnl.gov>, Nicolas Goaziou <mail@nicolasgoaziou.fr>
Cc: Carsten Dominik <dominik@uva.nl>,
Tim Cross <theophilusx@gmail.com>,
Org Mode <emacs-orgmode@gnu.org>
Subject: Re: why prepend "file://" to abs paths in html output?
Date: Mon, 10 Jul 2017 21:44:42 +0000 [thread overview]
Message-ID: <CAFyQvY02yLUf1RQpRqD+QNi4qYsJbZshbVK45vrqCy-DA03xWw@mail.gmail.com> (raw)
In-Reply-To: <CAFyQvY2cUdo23YZKZdb=Am+fJCudjq5VziRSTVCM_ohf9hEVNQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2376 bytes --]
Hello,
On Mon, Jul 10, 2017 at 3:54 PM Kaushal Modi <kaushal.modi@gmail.com> wrote:
> Hi Nicolas,
>
> I tried out the patch, and my comments are in the MWE below.
>
> I have this MWE that explains the "would like to have" vs "what this patch
> gives us":
>
> =====
> #+TITLE: ox-html root dir
> #+OPTIONS: toc:nil
> #+STARTUP: inlineimages
> #+HTML_LINK_ROOT: /tmp/site/static/
>
> An =image.png= exists as =/tmp/site/static/images/image.png=.
>
> * This is how the image links should have worked with the link root
> already specified
> [[/images/image.png]]
> - The =HTML_LINK_ROOT= should to appended to the front of the above link
> if that
> concatenated path is a valid one.
> - Would also like =C-x C-o=, inline image display, etc. to work.
> - So a thought.. should the link root specification be made exporter
> agnostic?
>
To expand on my MWE:
I have this patch on top of Nicolas's patch:
=====
diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 9e710e3e0a..410bb42eec 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -3011,11 +3011,12 @@ INFO is a plist holding contextual information. See
((file-name-absolute-p raw-path)
(let ((root (plist-get info :html-link-root)))
(setq raw-path
- (if (and root (file-in-directory-p raw-path root))
- (concat "/"
- (file-relative-name
- (expand-file-name raw-path)
- root))
+ (if (and root
+ (file-exists-p
+ (concat (file-name-as-directory root)
+ (replace-regexp-in-string
+ "\\`/" "" raw-path))))
+ raw-path
(org-export-file-uri raw-path)))))
((and home use-abs-url)
(setq raw-path (expand-file-name raw-path home))))
=====
This adds the root and link instead of having the root be a subset of link
(hope that makes sense).
With that, here is the updated MEW:
=====
#+TITLE: ox-html root dir
#+OPTIONS: toc:nil
#+STARTUP: inlineimages
#+HTML_LINK_ROOT: /tmp/site/static/
An =image.png= exists at =/tmp/site/static/images/image.png=.
* TODO [1/2] This is how the image links should have worked with the link
root already specified
[[/images/image.png]]
- [X] The =HTML_LINK_ROOT= should to appended to the front of the above
link if
that concatenated path is a valid one.
- [ ] Would also like =C-x C-o=, inline image display, etc. to work.
- So a thought.. should the link root specification be made exporter
agnostic?
=====
--
Kaushal Modi
[-- Attachment #2: Type: text/html, Size: 4388 bytes --]
next prev parent reply other threads:[~2017-07-10 21:44 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-08 0:38 why prepend "file://" to abs paths in html output? Matt Price
2017-07-08 10:33 ` Nicolas Goaziou
2017-07-08 12:37 ` Kaushal Modi
2017-07-08 14:08 ` Nicolas Goaziou
2017-07-08 14:19 ` Carsten Dominik
2017-07-08 19:13 ` Nicolas Goaziou
2017-07-08 23:37 ` Tim Cross
2017-07-09 10:45 ` Nicolas Goaziou
2017-07-10 12:53 ` Kaushal Modi
2017-07-10 13:31 ` Nicolas Goaziou
2017-07-10 13:58 ` Brett Viren
2017-07-10 19:54 ` Kaushal Modi
2017-07-10 21:44 ` Kaushal Modi [this message]
2017-07-13 12:39 ` Nicolas Goaziou
2017-07-13 12:50 ` Kaushal Modi
2017-07-13 12:55 ` Nicolas Goaziou
2017-07-13 13:01 ` Kaushal Modi
2017-07-13 13:14 ` Nicolas Goaziou
2017-07-13 12:46 ` Nicolas Goaziou
2017-07-10 22:12 ` Tim Cross
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAFyQvY02yLUf1RQpRqD+QNi4qYsJbZshbVK45vrqCy-DA03xWw@mail.gmail.com \
--to=kaushal.modi@gmail.com \
--cc=bv@bnl.gov \
--cc=dominik@uva.nl \
--cc=emacs-orgmode@gnu.org \
--cc=mail@nicolasgoaziou.fr \
--cc=theophilusx@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).