From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joost Helberg Subject: [PATCH] ox-html.el ox.el: added list of figures support in html backend Date: Mon, 09 Nov 2015 11:46:49 +0100 Message-ID: <87611btppi.fsf@snow.nl> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40797) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zvjyd-0008Dr-Od for emacs-orgmode@gnu.org; Mon, 09 Nov 2015 05:47:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZvjyY-0007E7-KY for emacs-orgmode@gnu.org; Mon, 09 Nov 2015 05:47:07 -0500 Received: from mx.snow.nl ([213.154.248.146]:48333) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZvjyY-0007D0-B5 for emacs-orgmode@gnu.org; Mon, 09 Nov 2015 05:47:02 -0500 Received: from mail.snow.nl (imap2.snow.nl [213.154.248.218]) by mx.snow.nl (Postfix) with ESMTP id 0225540248 for ; Mon, 9 Nov 2015 11:44:56 +0100 (CET) Received: from joost-ThinkPad-W520 (unknown [IPv6:2001:7b8:204:7:fda6:773b:2218:86e4]) by mail.snow.nl (Postfix) with ESMTPSA id 3E644787FA for ; Mon, 9 Nov 2015 11:46:49 +0100 (CET) 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode --=-=-= Content-Type: text/plain Hi, this patch adds the list of figures to the html export backend. It also includes a translation entry-point for the label "List of Figures" with already one translation in: dutch. --=-=-= Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0001-ox-html.el-added-list-of-figures-support-in-html-bac.patch Content-Transfer-Encoding: quoted-printable >From fab9105d04e5cb9f923c17d322d84a25527ec27a Mon Sep 17 00:00:00 2001 From: Joost Helberg Date: Sun, 8 Nov 2015 14:34:11 +0100 Subject: [PATCH] ox-html.el: added list of figures support in html backen= d * lisp/ox-html.el (org-html-list-of-figures): new, similar to org-html-list-of-tables but with tables replaced by figures. (org-html-list-of-tables): added mapping keyword "figures" to new function org-html-list-of-figures. ox.el: added label for "list of figures" * lisp/ox.el (org-export-dictionary): Added label for List of Figures with dutch translation --- lisp/ox-html.el | 36 ++++++++++++++++++++++++++++++++++++ lisp/ox.el | 2 ++ 2 files changed, 38 insertions(+) diff --git a/lisp/ox-html.el b/lisp/ox-html.el index effd387..3a7d7a1 100644 --- a/lisp/ox-html.el +++ b/lisp/ox-html.el @@ -2251,6 +2251,41 @@ of listings as a string, or nil if it is empty." lol-entries "\n")) "\n\n\n")))) =20 +(defun org-html-list-of-figures (info) + "Build a list of figures. +INFO is a plist used as a communication channel. Return the list +of figures as a string, or nil if it is empty." + (let ((lol-entries (org-export-collect-figures info nil))) + (when lol-entries + (concat "
\n" + (format "%s\n" + org-html-toplevel-hlevel + (org-html--translate "List of Figures" info) + org-html-toplevel-hlevel) + "
\n
    \n" + (let ((count 0) + (initial-fmt (format "%s" + (org-html--translate "Figure %d:" info)))) + (mapconcat + (lambda (entry) + (let ((label (org-element-property :name entry)) + (title (org-trim + (org-export-data + (or (org-export-get-caption entry t) + (org-export-get-caption entry)) + info)))) + (concat + "
  • " + (if (not label) + (concat (format initial-fmt (incf count)) " " title) + (format "%s %s" + (org-export-solidify-link-text label) + (format initial-fmt (incf count)) + title)) + "
  • "))) + lol-entries "\n")) + "\n
\n
\n
")))) + (defun org-html-list-of-tables (info) "Build a list of tables. INFO is a plist used as a communication channel. Return the list @@ -2654,6 +2689,7 @@ CONTENTS is nil. INFO is a plist holding contextua= l information." (localp (org-string-match-p "\\" value))) (org-html-toc depth info (and localp keyword)))) ((string=3D "listings" value) (org-html-list-of-listings info)) + ((string=3D "figures" value) (org-html-list-of-figures info)) ((string=3D "tables" value) (org-html-list-of-tables info)))))))) =20 ;;;; Latex Environment diff --git a/lisp/ox.el b/lisp/ox.el index a37de04..f00469f 100644 --- a/lisp/ox.el +++ b/lisp/ox.el @@ -5561,6 +5561,8 @@ them." :utf-8 "=D0=9F=D1=80=D0=B8=D0=BC=D1=96=D1=82=D0=BA=D0=B8") ("zh-CN" :html "脚注" :utf-8 "=E8=84=9A=E6=B3=A8") ("zh-TW" :html "腳註" :utf-8 "=E8=85=B3=E8=A8=BB")) + ("List of Figures" + ("nl" :default "Figuren")) ("List of Listings" ("da" :default "Programmer") ("de" :default "Programmauflistungsverzeichnis") --=20 1.9.1 --=-=-= Content-Type: text/plain regards, Joost -- Snow B.V. --=-=-=--