emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rasmus <rasmus@gmx.us>
To: emacs-orgmode@gnu.org
Subject: [patch] more robust footnotes (was: Bug: When exporting to PDF an Org file where multiple footnotes share the same definition, only the first footnote is clickable [8.3.4 (8.3.4-39-ge0acd8-elpaplus @ /home/jorge/.emacs.d/elpa/org-plus-contrib-20160418/)])
Date: Tue, 24 May 2016 22:59:15 +0200	[thread overview]
Message-ID: <87k2ij895o.fsf_-_@gmx.us> (raw)
In-Reply-To: 87bn3w8nba.fsf@saiph.selenimh

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

Hi,

Thanks for comments.

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

>> Though perhaps there’s a more efficient way to get the first
>> footnote-reference to a given definition than trawling through with
>> org-export--footnote-reference-map.
>
> Couldn't you refer to the definition instead of the first reference ?
> There is a function grabbing it and it is unique for a given label.
> Also, not that `org-export-get-footnote-definition' doesn't return the
> definition itself, only its contents. Therefore the reference are
> different and there is no possible ambiguity.

Yeah that's much better.  Thanks!

>> +	  (format "\\footnote{%s%s}" (org-trim (org-export-data def info))
>> +		  (if (catch 'exit
>> +			(org-export--footnote-reference-map
>> +			 (lambda (f)
>> +			   (let ((l (org-element-property :label f)))
>> +			     (when (and l label
>> +					(not (eq f footnote-reference))
>> +					(string= label l))
>> +			       (throw 'exit t))))
>> +			 (plist-get info :parse-tree) info))
>> +		      (org-latex--label footnote-reference info t t)
>> +		    ""))
>
> I'm not sure to understand the logic here. You seem to add a label to
> all references sharing a given label but the first one. Intuitively,
> I think it should be the opposite.
>
> Besides, in this branch of the `cond', all footnote references are the
> first for their their label.
>
> Wouldn't it be sufficient to use
>
>   (format "\\footnote{%s%s}" 
>           (org-trim (org-export-data def info))
>           (org-latex--label def info t t))


The GOAL is to make "pretty" latex and not clutter every footnote with
labels.  I think the logic is better now, but it uses the plain
org-export-map rather than org-export--footnote-reference-map.  I guess
that’s anyway more clean and org-export-get-footnote-definition should do
the necessary caching.

Rasmus

-- 
Governments should be afraid of their people

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ox-html-Find-preamble-spec-case-insensitively.patch --]
[-- Type: text/x-diff, Size: 1027 bytes --]

From 8b7534d16b611fa4f55df59ce4e2521b5c525cc0 Mon Sep 17 00:00:00 2001
From: Rasmus <rasmus@gmx.us>
Date: Sun, 22 May 2016 15:10:16 +0200
Subject: [PATCH] ox-html: Find preamble-spec case-insensitively

* ox-html.el (org-html--build-pre/postamble): Find the spec based on
  the language case-insensitively.

Note that the default org-html-preamble-format and
org-export-default-language are incompatible.
---
 lisp/ox-html.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index a05fa2d..3d4e5da 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -1854,10 +1854,11 @@ communication channel."
 		    (format "<p class=\"validation\">%s</p>\n"
 			    validation-link))))
 		(t (format-spec
-		    (or (cadr (assoc
+		    (or (cadr (assoc-string
 			       (plist-get info :language)
 			       (eval (intern
-				      (format "org-html-%s-format" type)))))
+				      (format "org-html-%s-format" type)))
+			       t))
 			(cadr
 			 (assoc
 			  "en"
-- 
2.8.2


  reply	other threads:[~2016-05-24 20:59 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-23 20:54 Bug: When exporting to PDF an Org file where multiple footnotes share the same definition, only the first footnote is clickable [8.3.4 (8.3.4-39-ge0acd8-elpaplus @ /home/jorge/.emacs.d/elpa/org-plus-contrib-20160418/)] Jorge Peixoto de Morais Neto
2016-04-25  8:38 ` Rasmus
2016-04-25  8:58   ` Nicolas Goaziou
2016-04-25 10:53     ` Rasmus
2016-04-25 11:41       ` Nicolas Goaziou
2016-04-25 13:36         ` Rasmus
2016-04-25 13:57           ` Nicolas Goaziou
2016-04-25 14:04             ` Rasmus
2016-04-25 14:07               ` Rasmus
2016-05-22 20:16             ` Rasmus
2016-05-23 21:41               ` Nicolas Goaziou
2016-05-24 20:59                 ` Rasmus [this message]
2016-05-24 21:31                   ` [patch] more robust footnotes Nicolas Goaziou
2016-05-24 21:38                     ` Rasmus
2016-05-24 21:54                       ` Nicolas Goaziou
2016-05-25  7:16                         ` Rasmus
2016-05-25 16:50                           ` Nicolas Goaziou
2016-05-25 17:51                             ` Rasmus
2016-08-10 21:09                 ` Bug: When exporting to PDF an Org file where multiple footnotes share the same definition, only the first footnote is clickable [8.3.4 (8.3.4-39-ge0acd8-elpaplus @ /home/jorge/.emacs.d/elpa/org-plus-contrib-20160418/)] Kaushal Modi

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=87k2ij895o.fsf_-_@gmx.us \
    --to=rasmus@gmx.us \
    --cc=emacs-orgmode@gnu.org \
    /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).