emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: fix for latex export of doi links [8.2.10 (8.2.10-35-g19a7d6-elpaplus @ .../elpa/org-plus-contrib-20150330/)]
@ 2015-04-03 16:38 Derek Feichtinger
  2015-04-03 19:19 ` Nicolas Goaziou
  0 siblings, 1 reply; 5+ messages in thread
From: Derek Feichtinger @ 2015-04-03 16:38 UTC (permalink / raw)
  To: emacs-orgmode

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

Hi

The current org latex export will export a link doi:10.xyz/abcd without
the protocol prefix as 10.xyz/abcd. Correctly, it should retain the
prefix.

An easy fix is adding "doi" to the list of protocols that retain
the link type string in ox-latex.el, below.

################### ox-latex.el ###############
(defun org-latex-link (link desc info)
  "Transcode a LINK object from Org to LaTeX.

DESC is the description part of the link, or the empty string.
INFO is a plist holding contextual information.  See
`org-export-data'."
  (let* ((type (org-element-property :type link))
 (raw-path (replace-regexp-in-string
    "%" "\\%" (org-element-property :path link) nil t))
 ;; Ensure DESC really exists, or set it to nil.
 (desc (and (not (string= desc "")) desc))
 (imagep (org-export-inline-image-p
  link org-latex-inline-image-rules))
 (path (cond
                ;; ----- NEXT LINE CONTAINS THE FIX -------
((member type '("http" "https" "ftp" "mailto" "doi"))
 (concat type ":" raw-path))
((and (string= type "file") (file-name-absolute-p raw-path))
 (concat "file:" raw-path))
(t raw-path)))
 protocol)
#############

Best regards,
Derek

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

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

* Re: Bug: fix for latex export of doi links [8.2.10 (8.2.10-35-g19a7d6-elpaplus @ .../elpa/org-plus-contrib-20150330/)]
  2015-04-03 16:38 Bug: fix for latex export of doi links [8.2.10 (8.2.10-35-g19a7d6-elpaplus @ .../elpa/org-plus-contrib-20150330/)] Derek Feichtinger
@ 2015-04-03 19:19 ` Nicolas Goaziou
  2015-04-03 19:52   ` Derek Feichtinger
  2015-04-03 20:34   ` Derek Feichtinger
  0 siblings, 2 replies; 5+ messages in thread
From: Nicolas Goaziou @ 2015-04-03 19:19 UTC (permalink / raw)
  To: Derek Feichtinger; +Cc: emacs-orgmode

Hello,

Derek Feichtinger <dfeich@gmail.com> writes:

> The current org latex export will export a link doi:10.xyz/abcd without
> the protocol prefix as 10.xyz/abcd. Correctly, it should retain the
> prefix.
>
> An easy fix is adding "doi" to the list of protocols that retain
> the link type string in ox-latex.el, below.
>
> ################### ox-latex.el ###############
> (defun org-latex-link (link desc info)
>   "Transcode a LINK object from Org to LaTeX.
>
> DESC is the description part of the link, or the empty string.
> INFO is a plist holding contextual information.  See
> `org-export-data'."
>   (let* ((type (org-element-property :type link))
>  (raw-path (replace-regexp-in-string
>     "%" "\\%" (org-element-property :path link) nil t))
>  ;; Ensure DESC really exists, or set it to nil.
>  (desc (and (not (string= desc "")) desc))
>  (imagep (org-export-inline-image-p
>   link org-latex-inline-image-rules))
>  (path (cond
>                 ;; ----- NEXT LINE CONTAINS THE FIX -------
> ((member type '("http" "https" "ftp" "mailto" "doi"))
>  (concat type ":" raw-path))
> ((and (string= type "file") (file-name-absolute-p raw-path))
>  (concat "file:" raw-path))
> (t raw-path)))
>  protocol)
> #############

Indeed. Thank you. 

Would you mind preparing a patch with "git format-patch" for correct
attribution? See <http://orgmode.org/worg/org-contribute.html> for
details.

Regards,

-- 
Nicolas Goaziou

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

* Re: Bug: fix for latex export of doi links [8.2.10 (8.2.10-35-g19a7d6-elpaplus @ .../elpa/org-plus-contrib-20150330/)]
  2015-04-03 19:19 ` Nicolas Goaziou
@ 2015-04-03 19:52   ` Derek Feichtinger
  2015-04-03 20:34   ` Derek Feichtinger
  1 sibling, 0 replies; 5+ messages in thread
From: Derek Feichtinger @ 2015-04-03 19:52 UTC (permalink / raw)
  To: Derek Feichtinger, emacs-orgmode

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

Hi, Nicolas

thanks for responding so fast. Sure, I'll try and submit the patch.
Thanks for all your great work!

Happy Easter,
Derek

On Fri, Apr 3, 2015 at 9:19 PM, Nicolas Goaziou <mail@nicolasgoaziou.fr>
wrote:

> Hello,
>
> Derek Feichtinger <dfeich@gmail.com> writes:
>
> > The current org latex export will export a link doi:10.xyz/abcd without
> > the protocol prefix as 10.xyz/abcd. Correctly, it should retain the
> > prefix.
> >
> > An easy fix is adding "doi" to the list of protocols that retain
> > the link type string in ox-latex.el, below.
> >
> > ################### ox-latex.el ###############
> > (defun org-latex-link (link desc info)
> >   "Transcode a LINK object from Org to LaTeX.
> >
> > DESC is the description part of the link, or the empty string.
> > INFO is a plist holding contextual information.  See
> > `org-export-data'."
> >   (let* ((type (org-element-property :type link))
> >  (raw-path (replace-regexp-in-string
> >     "%" "\\%" (org-element-property :path link) nil t))
> >  ;; Ensure DESC really exists, or set it to nil.
> >  (desc (and (not (string= desc "")) desc))
> >  (imagep (org-export-inline-image-p
> >   link org-latex-inline-image-rules))
> >  (path (cond
> >                 ;; ----- NEXT LINE CONTAINS THE FIX -------
> > ((member type '("http" "https" "ftp" "mailto" "doi"))
> >  (concat type ":" raw-path))
> > ((and (string= type "file") (file-name-absolute-p raw-path))
> >  (concat "file:" raw-path))
> > (t raw-path)))
> >  protocol)
> > #############
>
> Indeed. Thank you.
>
> Would you mind preparing a patch with "git format-patch" for correct
> attribution? See <http://orgmode.org/worg/org-contribute.html> for
> details.
>
> Regards,
>
> --
> Nicolas Goaziou
>

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

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

* Re: Bug: fix for latex export of doi links [8.2.10 (8.2.10-35-g19a7d6-elpaplus @ .../elpa/org-plus-contrib-20150330/)]
  2015-04-03 19:19 ` Nicolas Goaziou
  2015-04-03 19:52   ` Derek Feichtinger
@ 2015-04-03 20:34   ` Derek Feichtinger
  2015-04-03 22:06     ` Nicolas Goaziou
  1 sibling, 1 reply; 5+ messages in thread
From: Derek Feichtinger @ 2015-04-03 20:34 UTC (permalink / raw)
  To: Derek Feichtinger, emacs-orgmode


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

Patch for the latex export of doi links is attached to this mail.

Cheers,
Derek

On Fri, Apr 3, 2015 at 9:19 PM, Nicolas Goaziou <mail@nicolasgoaziou.fr>
wrote:

> Hello,
>
> Derek Feichtinger <dfeich@gmail.com> writes:
>
> > The current org latex export will export a link doi:10.xyz/abcd without
> > the protocol prefix as 10.xyz/abcd. Correctly, it should retain the
> > prefix.
> >
> > An easy fix is adding "doi" to the list of protocols that retain
> > the link type string in ox-latex.el, below.
> >
> > ################### ox-latex.el ###############
> > (defun org-latex-link (link desc info)
> >   "Transcode a LINK object from Org to LaTeX.
> >
> > DESC is the description part of the link, or the empty string.
> > INFO is a plist holding contextual information.  See
> > `org-export-data'."
> >   (let* ((type (org-element-property :type link))
> >  (raw-path (replace-regexp-in-string
> >     "%" "\\%" (org-element-property :path link) nil t))
> >  ;; Ensure DESC really exists, or set it to nil.
> >  (desc (and (not (string= desc "")) desc))
> >  (imagep (org-export-inline-image-p
> >   link org-latex-inline-image-rules))
> >  (path (cond
> >                 ;; ----- NEXT LINE CONTAINS THE FIX -------
> > ((member type '("http" "https" "ftp" "mailto" "doi"))
> >  (concat type ":" raw-path))
> > ((and (string= type "file") (file-name-absolute-p raw-path))
> >  (concat "file:" raw-path))
> > (t raw-path)))
> >  protocol)
> > #############
>
> Indeed. Thank you.
>
> Would you mind preparing a patch with "git format-patch" for correct
> attribution? See <http://orgmode.org/worg/org-contribute.html> for
> details.
>
> Regards,
>
> --
> Nicolas Goaziou
>

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

[-- Attachment #2: 0001-fix-for-latex-export-of-doi-type-links.patch --]
[-- Type: text/x-patch, Size: 969 bytes --]

From b1e74964890f1b602d7c144cec8b83518a21ddd7 Mon Sep 17 00:00:00 2001
From: Derek Feichtinger <derek.feichtinger@psi.ch>
Date: Fri, 3 Apr 2015 22:11:15 +0200
Subject: [PATCH] fix for latex export of doi type links

* lisp/ox-latex.el: Add "doi" to the list of link types that retain
the protocol prefix in the exported link.

TINYCHANGE
---
 lisp/ox-latex.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index cfd1fdf..57962c1 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -2032,7 +2032,7 @@ INFO is a plist holding contextual information.  See
 	 (imagep (org-export-inline-image-p
 		  link (plist-get info :latex-inline-image-rules)))
 	 (path (cond
-		((member type '("http" "https" "ftp" "mailto"))
+		((member type '("http" "https" "ftp" "mailto" "doi"))
 		 (concat type ":" raw-path))
 		((and (string= type "file") (file-name-absolute-p raw-path))
 		 (concat "file:" raw-path))
-- 
1.9.2


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

* Re: Bug: fix for latex export of doi links [8.2.10 (8.2.10-35-g19a7d6-elpaplus @ .../elpa/org-plus-contrib-20150330/)]
  2015-04-03 20:34   ` Derek Feichtinger
@ 2015-04-03 22:06     ` Nicolas Goaziou
  0 siblings, 0 replies; 5+ messages in thread
From: Nicolas Goaziou @ 2015-04-03 22:06 UTC (permalink / raw)
  To: Derek Feichtinger; +Cc: emacs-orgmode

Derek Feichtinger <dfeich@gmail.com> writes:

> Patch for the latex export of doi links is attached to this mail.

Applied. Thank you.

Regards,

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

end of thread, other threads:[~2015-04-03 22:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-03 16:38 Bug: fix for latex export of doi links [8.2.10 (8.2.10-35-g19a7d6-elpaplus @ .../elpa/org-plus-contrib-20150330/)] Derek Feichtinger
2015-04-03 19:19 ` Nicolas Goaziou
2015-04-03 19:52   ` Derek Feichtinger
2015-04-03 20:34   ` Derek Feichtinger
2015-04-03 22:06     ` Nicolas Goaziou

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