From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus 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 Message-ID: <87k2ij895o.fsf_-_@gmx.us> References: <1461444845.13483.6.camel@gmail.com> <87h9eqt74z.fsf@gmx.us> <87a8kivzcc.fsf@saiph.selenimh> <87r3durmc6.fsf@gmx.us> <87h9ep6hkx.fsf@saiph.selenimh> <874mapstdk.fsf@gmx.us> <87a8kh4wpp.fsf@saiph.selenimh> <87r3ctalx7.fsf@gmx.us> <87bn3w8nba.fsf@saiph.selenimh> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:54480) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b5JQG-0007Dj-1j for emacs-orgmode@gnu.org; Tue, 24 May 2016 16:59:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b5JQC-0002Mf-DI for emacs-orgmode@gnu.org; Tue, 24 May 2016 16:59:27 -0400 Received: from plane.gmane.org ([80.91.229.3]:32926) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b5JQC-0002M3-5n for emacs-orgmode@gnu.org; Tue, 24 May 2016 16:59:24 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1b5JQA-0001R6-CI for emacs-orgmode@gnu.org; Tue, 24 May 2016 22:59:22 +0200 Received: from ip-178-203-233-73.hsi10.unitymediagroup.de ([178.203.233.73]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 24 May 2016 22:59:22 +0200 Received: from rasmus by ip-178-203-233-73.hsi10.unitymediagroup.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 24 May 2016 22:59:22 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi, Thanks for comments. Nicolas Goaziou 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 --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-ox-html-Find-preamble-spec-case-insensitively.patch >From 8b7534d16b611fa4f55df59ce4e2521b5c525cc0 Mon Sep 17 00:00:00 2001 From: Rasmus 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 "

%s

\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 --=-=-=--