>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 backend * 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")))) +(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 contextual information." (localp (org-string-match-p "\\" value))) (org-html-toc depth info (and localp keyword)))) ((string= "listings" value) (org-html-list-of-listings info)) + ((string= "figures" value) (org-html-list-of-figures info)) ((string= "tables" value) (org-html-list-of-tables info)))))))) ;;;; 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 "Примітки") ("zh-CN" :html "脚注" :utf-8 "脚注") ("zh-TW" :html "腳註" :utf-8 "腳註")) + ("List of Figures" + ("nl" :default "Figuren")) ("List of Listings" ("da" :default "Programmer") ("de" :default "Programmauflistungsverzeichnis") -- 1.9.1