Merge branch 'maint'
[org-mode.git] / lisp / ox-html.el
blobd33072a8c17e8b281fb2563d1b3907e6a9ef6727
1 ;;; ox-html.el --- HTML Back-End for Org Export Engine -*- lexical-binding: t; -*-
3 ;; Copyright (C) 2011-2016 Free Software Foundation, Inc.
5 ;; Author: Carsten Dominik <carsten at orgmode dot org>
6 ;; Jambunathan K <kjambunathan at gmail dot com>
7 ;; Keywords: outlines, hypermedia, calendar, wp
9 ;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software: you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation, either version 3 of the License, or
14 ;; (at your option) any later version.
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
24 ;;; Commentary:
26 ;; This library implements a HTML back-end for Org generic exporter.
27 ;; See Org manual for more information.
29 ;;; Code:
31 ;;; Dependencies
33 (require 'ox)
34 (require 'ox-publish)
35 (require 'format-spec)
36 (eval-when-compile (require 'cl) (require 'table nil 'noerror))
37 (require 'cl-lib)
40 ;;; Function Declarations
42 (declare-function org-id-find-id-file "org-id" (id))
43 (declare-function htmlize-region "ext:htmlize" (beg end))
44 (declare-function org-pop-to-buffer-same-window
45 "org-compat" (&optional buffer-or-name norecord label))
46 (declare-function mm-url-decode-entities "mm-url" ())
48 (defvar htmlize-css-name-prefix)
49 (defvar htmlize-output-type)
50 (defvar htmlize-output-type)
51 (defvar htmlize-css-name-prefix)
53 ;;; Define Back-End
55 (org-export-define-backend 'html
56 '((bold . org-html-bold)
57 (center-block . org-html-center-block)
58 (clock . org-html-clock)
59 (code . org-html-code)
60 (drawer . org-html-drawer)
61 (dynamic-block . org-html-dynamic-block)
62 (entity . org-html-entity)
63 (example-block . org-html-example-block)
64 (export-block . org-html-export-block)
65 (export-snippet . org-html-export-snippet)
66 (fixed-width . org-html-fixed-width)
67 (footnote-definition . org-html-footnote-definition)
68 (footnote-reference . org-html-footnote-reference)
69 (headline . org-html-headline)
70 (horizontal-rule . org-html-horizontal-rule)
71 (inline-src-block . org-html-inline-src-block)
72 (inlinetask . org-html-inlinetask)
73 (inner-template . org-html-inner-template)
74 (italic . org-html-italic)
75 (item . org-html-item)
76 (keyword . org-html-keyword)
77 (latex-environment . org-html-latex-environment)
78 (latex-fragment . org-html-latex-fragment)
79 (line-break . org-html-line-break)
80 (link . org-html-link)
81 (node-property . org-html-node-property)
82 (paragraph . org-html-paragraph)
83 (plain-list . org-html-plain-list)
84 (plain-text . org-html-plain-text)
85 (planning . org-html-planning)
86 (property-drawer . org-html-property-drawer)
87 (quote-block . org-html-quote-block)
88 (radio-target . org-html-radio-target)
89 (section . org-html-section)
90 (special-block . org-html-special-block)
91 (src-block . org-html-src-block)
92 (statistics-cookie . org-html-statistics-cookie)
93 (strike-through . org-html-strike-through)
94 (subscript . org-html-subscript)
95 (superscript . org-html-superscript)
96 (table . org-html-table)
97 (table-cell . org-html-table-cell)
98 (table-row . org-html-table-row)
99 (target . org-html-target)
100 (template . org-html-template)
101 (timestamp . org-html-timestamp)
102 (underline . org-html-underline)
103 (verbatim . org-html-verbatim)
104 (verse-block . org-html-verse-block))
105 :filters-alist '((:filter-options . org-html-infojs-install-script)
106 (:filter-final-output . org-html-final-function))
107 :menu-entry
108 '(?h "Export to HTML"
109 ((?H "As HTML buffer" org-html-export-as-html)
110 (?h "As HTML file" org-html-export-to-html)
111 (?o "As HTML file and open"
112 (lambda (a s v b)
113 (if a (org-html-export-to-html t s v b)
114 (org-open-file (org-html-export-to-html nil s v b)))))))
115 :options-alist
116 '((:html-doctype "HTML_DOCTYPE" nil org-html-doctype)
117 (:html-container "HTML_CONTAINER" nil org-html-container-element)
118 (:description "DESCRIPTION" nil nil newline)
119 (:keywords "KEYWORDS" nil nil space)
120 (:html-html5-fancy nil "html5-fancy" org-html-html5-fancy)
121 (:html-link-use-abs-url nil "html-link-use-abs-url" org-html-link-use-abs-url)
122 (:html-link-home "HTML_LINK_HOME" nil org-html-link-home)
123 (:html-link-up "HTML_LINK_UP" nil org-html-link-up)
124 (:html-mathjax "HTML_MATHJAX" nil "" space)
125 (:html-link-use-abs-url nil "html-link-use-abs-url" org-html-link-use-abs-url)
126 (:html-postamble nil "html-postamble" org-html-postamble)
127 (:html-preamble nil "html-preamble" org-html-preamble)
128 (:html-head "HTML_HEAD" nil org-html-head newline)
129 (:html-head-extra "HTML_HEAD_EXTRA" nil org-html-head-extra newline)
130 (:subtitle "SUBTITLE" nil nil parse)
131 (:html-head-include-default-style
132 nil "html-style" org-html-head-include-default-style)
133 (:html-head-include-scripts nil "html-scripts" org-html-head-include-scripts)
134 (:html-allow-name-attribute-in-anchors
135 nil nil org-html-allow-name-attribute-in-anchors)
136 (:html-divs nil nil org-html-divs)
137 (:html-checkbox-type nil nil org-html-checkbox-type)
138 (:html-extension nil nil org-html-extension)
139 (:html-footnote-format nil nil org-html-footnote-format)
140 (:html-footnote-separator nil nil org-html-footnote-separator)
141 (:html-footnotes-section nil nil org-html-footnotes-section)
142 (:html-format-drawer-function nil nil org-html-format-drawer-function)
143 (:html-format-headline-function nil nil org-html-format-headline-function)
144 (:html-format-inlinetask-function
145 nil nil org-html-format-inlinetask-function)
146 (:html-home/up-format nil nil org-html-home/up-format)
147 (:html-indent nil nil org-html-indent)
148 (:html-infojs-options nil nil org-html-infojs-options)
149 (:html-infojs-template nil nil org-html-infojs-template)
150 (:html-inline-image-rules nil nil org-html-inline-image-rules)
151 (:html-link-org-files-as-html nil nil org-html-link-org-files-as-html)
152 (:html-mathjax-options nil nil org-html-mathjax-options)
153 (:html-mathjax-template nil nil org-html-mathjax-template)
154 (:html-metadata-timestamp-format nil nil org-html-metadata-timestamp-format)
155 (:html-postamble-format nil nil org-html-postamble-format)
156 (:html-preamble-format nil nil org-html-preamble-format)
157 (:html-table-align-individual-fields
158 nil nil org-html-table-align-individual-fields)
159 (:html-table-caption-above nil nil org-html-table-caption-above)
160 (:html-table-data-tags nil nil org-html-table-data-tags)
161 (:html-table-header-tags nil nil org-html-table-header-tags)
162 (:html-table-use-header-tags-for-first-column
163 nil nil org-html-table-use-header-tags-for-first-column)
164 (:html-tag-class-prefix nil nil org-html-tag-class-prefix)
165 (:html-text-markup-alist nil nil org-html-text-markup-alist)
166 (:html-todo-kwd-class-prefix nil nil org-html-todo-kwd-class-prefix)
167 (:html-toplevel-hlevel nil nil org-html-toplevel-hlevel)
168 (:html-use-infojs nil nil org-html-use-infojs)
169 (:html-validation-link nil nil org-html-validation-link)
170 (:html-viewport nil nil org-html-viewport)
171 (:html-inline-images nil nil org-html-inline-images)
172 (:html-table-attributes nil nil org-html-table-default-attributes)
173 (:html-table-row-open-tag nil nil org-html-table-row-open-tag)
174 (:html-table-row-close-tag nil nil org-html-table-row-close-tag)
175 (:html-xml-declaration nil nil org-html-xml-declaration)
176 (:infojs-opt "INFOJS_OPT" nil nil)
177 ;; Redefine regular options.
178 (:creator "CREATOR" nil org-html-creator-string)
179 (:with-latex nil "tex" org-html-with-latex)
180 ;; Retrieve LaTeX header for fragments.
181 (:latex-header "LATEX_HEADER" nil nil newline)))
184 ;;; Internal Variables
186 (defvar org-html-format-table-no-css)
187 (defvar htmlize-buffer-places) ; from htmlize.el
189 (defvar org-html--pre/postamble-class "status"
190 "CSS class used for pre/postamble")
192 (defconst org-html-doctype-alist
193 '(("html4-strict" . "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\"
194 \"http://www.w3.org/TR/html4/strict.dtd\">")
195 ("html4-transitional" . "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"
196 \"http://www.w3.org/TR/html4/loose.dtd\">")
197 ("html4-frameset" . "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\"
198 \"http://www.w3.org/TR/html4/frameset.dtd\">")
200 ("xhtml-strict" . "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"
201 \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">")
202 ("xhtml-transitional" . "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"
203 \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">")
204 ("xhtml-frameset" . "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\"
205 \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">")
206 ("xhtml-11" . "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\"
207 \"http://www.w3.org/TR/xhtml1/DTD/xhtml11.dtd\">")
209 ("html5" . "<!DOCTYPE html>")
210 ("xhtml5" . "<!DOCTYPE html>"))
211 "An alist mapping (x)html flavors to specific doctypes.")
213 (defconst org-html-html5-elements
214 '("article" "aside" "audio" "canvas" "details" "figcaption"
215 "figure" "footer" "header" "menu" "meter" "nav" "output"
216 "progress" "section" "video")
217 "New elements in html5.
219 For blocks that should contain headlines, use the HTML_CONTAINER
220 property on the headline itself.")
222 (defconst org-html-special-string-regexps
223 '(("\\\\-" . "&#x00ad;") ; shy
224 ("---\\([^-]\\)" . "&#x2014;\\1") ; mdash
225 ("--\\([^-]\\)" . "&#x2013;\\1") ; ndash
226 ("\\.\\.\\." . "&#x2026;")) ; hellip
227 "Regular expressions for special string conversion.")
229 (defconst org-html-scripts
230 "<script type=\"text/javascript\">
232 @licstart The following is the entire license notice for the
233 JavaScript code in this tag.
235 Copyright (C) 2012-2013 Free Software Foundation, Inc.
237 The JavaScript code in this tag is free software: you can
238 redistribute it and/or modify it under the terms of the GNU
239 General Public License (GNU GPL) as published by the Free Software
240 Foundation, either version 3 of the License, or (at your option)
241 any later version. The code is distributed WITHOUT ANY WARRANTY;
242 without even the implied warranty of MERCHANTABILITY or FITNESS
243 FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
245 As additional permission under GNU GPL version 3 section 7, you
246 may distribute non-source (e.g., minimized or compacted) forms of
247 that code without the copy of the GNU GPL normally required by
248 section 4, provided you include this license notice and a URL
249 through which recipients can access the Corresponding Source.
252 @licend The above is the entire license notice
253 for the JavaScript code in this tag.
255 <!--/*--><![CDATA[/*><!--*/
256 function CodeHighlightOn(elem, id)
258 var target = document.getElementById(id);
259 if(null != target) {
260 elem.cacheClassElem = elem.className;
261 elem.cacheClassTarget = target.className;
262 target.className = \"code-highlighted\";
263 elem.className = \"code-highlighted\";
266 function CodeHighlightOff(elem, id)
268 var target = document.getElementById(id);
269 if(elem.cacheClassElem)
270 elem.className = elem.cacheClassElem;
271 if(elem.cacheClassTarget)
272 target.className = elem.cacheClassTarget;
274 /*]]>*///-->
275 </script>"
276 "Basic JavaScript that is needed by HTML files produced by Org mode.")
278 (defconst org-html-style-default
279 "<style type=\"text/css\">
280 <!--/*--><![CDATA[/*><!--*/
281 .title { text-align: center;
282 margin-bottom: .2em; }
283 .subtitle { text-align: center;
284 font-size: medium;
285 font-weight: bold;
286 margin-top:0; }
287 .todo { font-family: monospace; color: red; }
288 .done { font-family: monospace; color: green; }
289 .priority { font-family: monospace; color: orange; }
290 .tag { background-color: #eee; font-family: monospace;
291 padding: 2px; font-size: 80%; font-weight: normal; }
292 .timestamp { color: #bebebe; }
293 .timestamp-kwd { color: #5f9ea0; }
294 .org-right { margin-left: auto; margin-right: 0px; text-align: right; }
295 .org-left { margin-left: 0px; margin-right: auto; text-align: left; }
296 .org-center { margin-left: auto; margin-right: auto; text-align: center; }
297 .underline { text-decoration: underline; }
298 #postamble p, #preamble p { font-size: 90%; margin: .2em; }
299 p.verse { margin-left: 3%; }
300 pre {
301 border: 1px solid #ccc;
302 box-shadow: 3px 3px 3px #eee;
303 padding: 8pt;
304 font-family: monospace;
305 overflow: auto;
306 margin: 1.2em;
308 pre.src {
309 position: relative;
310 overflow: visible;
311 padding-top: 1.2em;
313 pre.src:before {
314 display: none;
315 position: absolute;
316 background-color: white;
317 top: -10px;
318 right: 10px;
319 padding: 3px;
320 border: 1px solid black;
322 pre.src:hover:before { display: inline;}
323 pre.src-sh:before { content: 'sh'; }
324 pre.src-bash:before { content: 'sh'; }
325 pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
326 pre.src-R:before { content: 'R'; }
327 pre.src-perl:before { content: 'Perl'; }
328 pre.src-java:before { content: 'Java'; }
329 pre.src-sql:before { content: 'SQL'; }
331 table { border-collapse:collapse; }
332 caption.t-above { caption-side: top; }
333 caption.t-bottom { caption-side: bottom; }
334 td, th { vertical-align:top; }
335 th.org-right { text-align: center; }
336 th.org-left { text-align: center; }
337 th.org-center { text-align: center; }
338 td.org-right { text-align: right; }
339 td.org-left { text-align: left; }
340 td.org-center { text-align: center; }
341 dt { font-weight: bold; }
342 .footpara { display: inline; }
343 .footdef { margin-bottom: 1em; }
344 .figure { padding: 1em; }
345 .figure p { text-align: center; }
346 .inlinetask {
347 padding: 10px;
348 border: 2px solid gray;
349 margin: 10px;
350 background: #ffffcc;
352 #org-div-home-and-up
353 { text-align: right; font-size: 70%; white-space: nowrap; }
354 textarea { overflow-x: auto; }
355 .linenr { font-size: smaller }
356 .code-highlighted { background-color: #ffff00; }
357 .org-info-js_info-navigation { border-style: none; }
358 #org-info-js_console-label
359 { font-size: 10px; font-weight: bold; white-space: nowrap; }
360 .org-info-js_search-highlight
361 { background-color: #ffff00; color: #000000; font-weight: bold; }
362 /*]]>*/-->
363 </style>"
364 "The default style specification for exported HTML files.
365 You can use `org-html-head' and `org-html-head-extra' to add to
366 this style. If you don't want to include this default style,
367 customize `org-html-head-include-default-style'.")
370 ;;; User Configuration Variables
372 (defgroup org-export-html nil
373 "Options for exporting Org mode files to HTML."
374 :tag "Org Export HTML"
375 :group 'org-export)
377 ;;;; Handle infojs
379 (defvar org-html-infojs-opts-table
380 '((path PATH "http://orgmode.org/org-info.js")
381 (view VIEW "info")
382 (toc TOC :with-toc)
383 (ftoc FIXED_TOC "0")
384 (tdepth TOC_DEPTH "max")
385 (sdepth SECTION_DEPTH "max")
386 (mouse MOUSE_HINT "underline")
387 (buttons VIEW_BUTTONS "0")
388 (ltoc LOCAL_TOC "1")
389 (up LINK_UP :html-link-up)
390 (home LINK_HOME :html-link-home))
391 "JavaScript options, long form for script, default values.")
393 (defcustom org-html-use-infojs 'when-configured
394 "Non-nil when Sebastian Rose's Java Script org-info.js should be active.
395 This option can be nil or t to never or always use the script.
396 It can also be the symbol `when-configured', meaning that the
397 script will be linked into the export file if and only if there
398 is a \"#+INFOJS_OPT:\" line in the buffer. See also the variable
399 `org-html-infojs-options'."
400 :group 'org-export-html
401 :version "24.4"
402 :package-version '(Org . "8.0")
403 :type '(choice
404 (const :tag "Never" nil)
405 (const :tag "When configured in buffer" when-configured)
406 (const :tag "Always" t)))
408 (defcustom org-html-infojs-options
409 (mapcar (lambda (x) (cons (car x) (nth 2 x))) org-html-infojs-opts-table)
410 "Options settings for the INFOJS JavaScript.
411 Each of the options must have an entry in `org-html-infojs-opts-table'.
412 The value can either be a string that will be passed to the script, or
413 a property. This property is then assumed to be a property that is defined
414 by the Export/Publishing setup of Org.
415 The `sdepth' and `tdepth' parameters can also be set to \"max\", which
416 means to use the maximum value consistent with other options."
417 :group 'org-export-html
418 :version "24.4"
419 :package-version '(Org . "8.0")
420 :type
421 `(set :greedy t :inline t
422 ,@(mapcar
423 (lambda (x)
424 (list 'cons (list 'const (car x))
425 '(choice
426 (symbol :tag "Publishing/Export property")
427 (string :tag "Value"))))
428 org-html-infojs-opts-table)))
430 (defcustom org-html-infojs-template
431 "<script type=\"text/javascript\" src=\"%SCRIPT_PATH\">
434 * @source: %SCRIPT_PATH
436 * @licstart The following is the entire license notice for the
437 * JavaScript code in %SCRIPT_PATH.
439 * Copyright (C) 2012-2013 Free Software Foundation, Inc.
442 * The JavaScript code in this tag is free software: you can
443 * redistribute it and/or modify it under the terms of the GNU
444 * General Public License (GNU GPL) as published by the Free Software
445 * Foundation, either version 3 of the License, or (at your option)
446 * any later version. The code is distributed WITHOUT ANY WARRANTY;
447 * without even the implied warranty of MERCHANTABILITY or FITNESS
448 * FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
450 * As additional permission under GNU GPL version 3 section 7, you
451 * may distribute non-source (e.g., minimized or compacted) forms of
452 * that code without the copy of the GNU GPL normally required by
453 * section 4, provided you include this license notice and a URL
454 * through which recipients can access the Corresponding Source.
456 * @licend The above is the entire license notice
457 * for the JavaScript code in %SCRIPT_PATH.
460 </script>
462 <script type=\"text/javascript\">
465 @licstart The following is the entire license notice for the
466 JavaScript code in this tag.
468 Copyright (C) 2012-2013 Free Software Foundation, Inc.
470 The JavaScript code in this tag is free software: you can
471 redistribute it and/or modify it under the terms of the GNU
472 General Public License (GNU GPL) as published by the Free Software
473 Foundation, either version 3 of the License, or (at your option)
474 any later version. The code is distributed WITHOUT ANY WARRANTY;
475 without even the implied warranty of MERCHANTABILITY or FITNESS
476 FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
478 As additional permission under GNU GPL version 3 section 7, you
479 may distribute non-source (e.g., minimized or compacted) forms of
480 that code without the copy of the GNU GPL normally required by
481 section 4, provided you include this license notice and a URL
482 through which recipients can access the Corresponding Source.
485 @licend The above is the entire license notice
486 for the JavaScript code in this tag.
489 <!--/*--><![CDATA[/*><!--*/
490 %MANAGER_OPTIONS
491 org_html_manager.setup(); // activate after the parameters are set
492 /*]]>*///-->
493 </script>"
494 "The template for the export style additions when org-info.js is used.
495 Option settings will replace the %MANAGER-OPTIONS cookie."
496 :group 'org-export-html
497 :version "24.4"
498 :package-version '(Org . "8.0")
499 :type 'string)
501 (defun org-html-infojs-install-script (exp-plist _backend)
502 "Install script in export options when appropriate.
503 EXP-PLIST is a plist containing export options. BACKEND is the
504 export back-end currently used."
505 (unless (or (memq 'body-only (plist-get exp-plist :export-options))
506 (not (plist-get exp-plist :html-use-infojs))
507 (and (eq (plist-get exp-plist :html-use-infojs) 'when-configured)
508 (let ((opt (plist-get exp-plist :infojs-opt)))
509 (or (not opt)
510 (string= "" opt)
511 (string-match "\\<view:nil\\>" opt)))))
512 (let* ((template (plist-get exp-plist :html-infojs-template))
513 (ptoc (plist-get exp-plist :with-toc))
514 (hlevels (plist-get exp-plist :headline-levels))
515 (sdepth hlevels)
516 (tdepth (if (integerp ptoc) (min ptoc hlevels) hlevels))
517 (options (plist-get exp-plist :infojs-opt))
518 (infojs-opt (plist-get exp-plist :html-infojs-options))
519 (table org-html-infojs-opts-table)
520 style)
521 (dolist (entry table)
522 (let* ((opt (car entry))
523 (var (nth 1 entry))
524 ;; Compute default values for script option OPT from
525 ;; `org-html-infojs-options' variable.
526 (default
527 (let ((default (cdr (assq opt infojs-opt))))
528 (if (and (symbolp default) (not (memq default '(t nil))))
529 (plist-get exp-plist default)
530 default)))
531 ;; Value set through INFOJS_OPT keyword has precedence
532 ;; over the default one.
533 (val (if (and options
534 (string-match (format "\\<%s:\\(\\S-+\\)" opt)
535 options))
536 (match-string 1 options)
537 default)))
538 (case opt
539 (path (setq template
540 (replace-regexp-in-string
541 "%SCRIPT_PATH" val template t t)))
542 (sdepth (when (integerp (read val))
543 (setq sdepth (min (read val) sdepth))))
544 (tdepth (when (integerp (read val))
545 (setq tdepth (min (read val) tdepth))))
546 (otherwise (setq val
547 (cond
548 ((or (eq val t) (equal val "t")) "1")
549 ((or (eq val nil) (equal val "nil")) "0")
550 ((stringp val) val)
551 (t (format "%s" val))))
552 (push (cons var val) style)))))
553 ;; Now we set the depth of the *generated* TOC to SDEPTH,
554 ;; because the toc will actually determine the splitting. How
555 ;; much of the toc will actually be displayed is governed by the
556 ;; TDEPTH option.
557 (setq exp-plist (plist-put exp-plist :with-toc sdepth))
558 ;; The table of contents should not show more sections than we
559 ;; generate.
560 (setq tdepth (min tdepth sdepth))
561 (push (cons "TOC_DEPTH" tdepth) style)
562 ;; Build style string.
563 (setq style (mapconcat
564 (lambda (x)
565 (format "org_html_manager.set(\"%s\", \"%s\");"
566 (car x) (cdr x)))
567 style "\n"))
568 (when (and style (> (length style) 0))
569 (and (string-match "%MANAGER_OPTIONS" template)
570 (setq style (replace-match style t t template))
571 (setq exp-plist
572 (plist-put
573 exp-plist :html-head-extra
574 (concat (or (plist-get exp-plist :html-head-extra) "")
575 "\n"
576 style)))))
577 ;; This script absolutely needs the table of contents, so we
578 ;; change that setting.
579 (unless (plist-get exp-plist :with-toc)
580 (setq exp-plist (plist-put exp-plist :with-toc t)))
581 ;; Return the modified property list.
582 exp-plist)))
584 ;;;; Bold, etc.
586 (defcustom org-html-text-markup-alist
587 '((bold . "<b>%s</b>")
588 (code . "<code>%s</code>")
589 (italic . "<i>%s</i>")
590 (strike-through . "<del>%s</del>")
591 (underline . "<span class=\"underline\">%s</span>")
592 (verbatim . "<code>%s</code>"))
593 "Alist of HTML expressions to convert text markup.
595 The key must be a symbol among `bold', `code', `italic',
596 `strike-through', `underline' and `verbatim'. The value is
597 a formatting string to wrap fontified text with.
599 If no association can be found for a given markup, text will be
600 returned as-is."
601 :group 'org-export-html
602 :version "24.4"
603 :package-version '(Org . "8.0")
604 :type '(alist :key-type (symbol :tag "Markup type")
605 :value-type (string :tag "Format string"))
606 :options '(bold code italic strike-through underline verbatim))
608 (defcustom org-html-indent nil
609 "Non-nil means to indent the generated HTML.
610 Warning: non-nil may break indentation of source code blocks."
611 :group 'org-export-html
612 :version "24.4"
613 :package-version '(Org . "8.0")
614 :type 'boolean)
616 ;;;; Drawers
618 (defcustom org-html-format-drawer-function (lambda (_name contents) contents)
619 "Function called to format a drawer in HTML code.
621 The function must accept two parameters:
622 NAME the drawer name, like \"LOGBOOK\"
623 CONTENTS the contents of the drawer.
625 The function should return the string to be exported.
627 For example, the variable could be set to the following function
628 in order to mimic default behavior:
630 The default value simply returns the value of CONTENTS."
631 :group 'org-export-html
632 :version "24.4"
633 :package-version '(Org . "8.0")
634 :type 'function)
636 ;;;; Footnotes
638 (defcustom org-html-footnotes-section "<div id=\"footnotes\">
639 <h2 class=\"footnotes\">%s: </h2>
640 <div id=\"text-footnotes\">
642 </div>
643 </div>"
644 "Format for the footnotes section.
645 Should contain a two instances of %s. The first will be replaced with the
646 language-specific word for \"Footnotes\", the second one will be replaced
647 by the footnotes themselves."
648 :group 'org-export-html
649 :type 'string)
651 (defcustom org-html-footnote-format "<sup>%s</sup>"
652 "The format for the footnote reference.
653 %s will be replaced by the footnote reference itself."
654 :group 'org-export-html
655 :type 'string)
657 (defcustom org-html-footnote-separator "<sup>, </sup>"
658 "Text used to separate footnotes."
659 :group 'org-export-html
660 :type 'string)
662 ;;;; Headline
664 (defcustom org-html-toplevel-hlevel 2
665 "The <H> level for level 1 headings in HTML export.
666 This is also important for the classes that will be wrapped around headlines
667 and outline structure. If this variable is 1, the top-level headlines will
668 be <h1>, and the corresponding classes will be outline-1, section-number-1,
669 and outline-text-1. If this is 2, all of these will get a 2 instead.
670 The default for this variable is 2, because we use <h1> for formatting the
671 document title."
672 :group 'org-export-html
673 :type 'integer)
675 (defcustom org-html-format-headline-function
676 'org-html-format-headline-default-function
677 "Function to format headline text.
679 This function will be called with six arguments:
680 TODO the todo keyword (string or nil).
681 TODO-TYPE the type of todo (symbol: `todo', `done', nil)
682 PRIORITY the priority of the headline (integer or nil)
683 TEXT the main headline text (string).
684 TAGS the tags (string or nil).
685 INFO the export options (plist).
687 The function result will be used in the section format string."
688 :group 'org-export-html
689 :version "25.1"
690 :package-version '(Org . "8.3")
691 :type 'function)
693 ;;;; HTML-specific
695 (defcustom org-html-allow-name-attribute-in-anchors nil
696 "When nil, do not set \"name\" attribute in anchors.
697 By default, when appropriate, anchors are formatted with \"id\"
698 but without \"name\" attribute."
699 :group 'org-export-html
700 :version "24.4"
701 :package-version '(Org . "8.0")
702 :type 'boolean)
704 ;;;; Inlinetasks
706 (defcustom org-html-format-inlinetask-function
707 'org-html-format-inlinetask-default-function
708 "Function called to format an inlinetask in HTML code.
710 The function must accept seven parameters:
711 TODO the todo keyword, as a string
712 TODO-TYPE the todo type, a symbol among `todo', `done' and nil.
713 PRIORITY the inlinetask priority, as a string
714 NAME the inlinetask name, as a string.
715 TAGS the inlinetask tags, as a list of strings.
716 CONTENTS the contents of the inlinetask, as a string.
717 INFO the export options, as a plist
719 The function should return the string to be exported."
720 :group 'org-export-html
721 :version "25.1"
722 :package-version '(Org . "8.3")
723 :type 'function)
725 ;;;; LaTeX
727 (defcustom org-html-with-latex org-export-with-latex
728 "Non-nil means process LaTeX math snippets.
730 When set, the exporter will process LaTeX environments and
731 fragments.
733 This option can also be set with the +OPTIONS line,
734 e.g. \"tex:mathjax\". Allowed values are:
736 nil Ignore math snippets.
737 `verbatim' Keep everything in verbatim
738 `dvipng' Process the LaTeX fragments to images. This will also
739 include processing of non-math environments.
740 `imagemagick' Convert the LaTeX fragments to pdf files and use
741 imagemagick to convert pdf files to png files.
742 `mathjax' Do MathJax preprocessing and arrange for MathJax.js to
743 be loaded.
744 t Synonym for `mathjax'."
745 :group 'org-export-html
746 :version "24.4"
747 :package-version '(Org . "8.0")
748 :type '(choice
749 (const :tag "Do not process math in any way" nil)
750 (const :tag "Use dvipng to make images" dvipng)
751 (const :tag "Use imagemagick to make images" imagemagick)
752 (const :tag "Use MathJax to display math" mathjax)
753 (const :tag "Leave math verbatim" verbatim)))
755 ;;;; Links :: Generic
757 (defcustom org-html-link-org-files-as-html t
758 "Non-nil means make file links to `file.org' point to `file.html'.
759 When `org-mode' is exporting an `org-mode' file to HTML, links to
760 non-html files are directly put into a href tag in HTML.
761 However, links to other Org-mode files (recognized by the
762 extension `.org') should become links to the corresponding html
763 file, assuming that the linked `org-mode' file will also be
764 converted to HTML.
765 When nil, the links still point to the plain `.org' file."
766 :group 'org-export-html
767 :type 'boolean)
769 ;;;; Links :: Inline images
771 (defcustom org-html-inline-images t
772 "Non-nil means inline images into exported HTML pages.
773 This is done using an <img> tag. When nil, an anchor with href is used to
774 link to the image."
775 :group 'org-export-html
776 :version "24.4"
777 :package-version '(Org . "8.1")
778 :type 'boolean)
780 (defcustom org-html-inline-image-rules
781 '(("file" . "\\.\\(jpeg\\|jpg\\|png\\|gif\\|svg\\)\\'")
782 ("http" . "\\.\\(jpeg\\|jpg\\|png\\|gif\\|svg\\)\\'")
783 ("https" . "\\.\\(jpeg\\|jpg\\|png\\|gif\\|svg\\)\\'"))
784 "Rules characterizing image files that can be inlined into HTML.
785 A rule consists in an association whose key is the type of link
786 to consider, and value is a regexp that will be matched against
787 link's path."
788 :group 'org-export-html
789 :version "24.4"
790 :package-version '(Org . "8.0")
791 :type '(alist :key-type (string :tag "Type")
792 :value-type (regexp :tag "Path")))
794 ;;;; Plain Text
796 (defvar org-html-protect-char-alist
797 '(("&" . "&amp;")
798 ("<" . "&lt;")
799 (">" . "&gt;"))
800 "Alist of characters to be converted by `org-html-encode-plain-text'.")
802 ;;;; Src Block
804 (defcustom org-html-htmlize-output-type 'inline-css
805 "Output type to be used by htmlize when formatting code snippets.
806 Choices are `css' to export the CSS selectors only,`inline-css'
807 to export the CSS attribute values inline in the HTML or `nil' to
808 export plain text. We use as default `inline-css', in order to
809 make the resulting HTML self-containing.
811 However, this will fail when using Emacs in batch mode for export, because
812 then no rich font definitions are in place. It will also not be good if
813 people with different Emacs setup contribute HTML files to a website,
814 because the fonts will represent the individual setups. In these cases,
815 it is much better to let Org/Htmlize assign classes only, and to use
816 a style file to define the look of these classes.
817 To get a start for your css file, start Emacs session and make sure that
818 all the faces you are interested in are defined, for example by loading files
819 in all modes you want. Then, use the command
820 \\[org-html-htmlize-generate-css] to extract class definitions."
821 :group 'org-export-html
822 :type '(choice (const css) (const inline-css) (const nil)))
824 (defcustom org-html-htmlize-font-prefix "org-"
825 "The prefix for CSS class names for htmlize font specifications."
826 :group 'org-export-html
827 :type 'string)
829 ;;;; Table
831 (defcustom org-html-table-default-attributes
832 '(:border "2" :cellspacing "0" :cellpadding "6" :rules "groups" :frame "hsides")
833 "Default attributes and values which will be used in table tags.
834 This is a plist where attributes are symbols, starting with
835 colons, and values are strings.
837 When exporting to HTML5, these values will be disregarded."
838 :group 'org-export-html
839 :version "24.4"
840 :package-version '(Org . "8.0")
841 :type '(plist :key-type (symbol :tag "Property")
842 :value-type (string :tag "Value")))
844 (defcustom org-html-table-header-tags '("<th scope=\"%s\"%s>" . "</th>")
845 "The opening and ending tags for table header fields.
846 This is customizable so that alignment options can be specified.
847 The first %s will be filled with the scope of the field, either row or col.
848 The second %s will be replaced by a style entry to align the field.
849 See also the variable `org-html-table-use-header-tags-for-first-column'.
850 See also the variable `org-html-table-align-individual-fields'."
851 :group 'org-export-html
852 :type '(cons (string :tag "Opening tag") (string :tag "Closing tag")))
854 (defcustom org-html-table-data-tags '("<td%s>" . "</td>")
855 "The opening and ending tags for table data fields.
856 This is customizable so that alignment options can be specified.
857 The first %s will be filled with the scope of the field, either row or col.
858 The second %s will be replaced by a style entry to align the field.
859 See also the variable `org-html-table-align-individual-fields'."
860 :group 'org-export-html
861 :type '(cons (string :tag "Opening tag") (string :tag "Closing tag")))
863 (defcustom org-html-table-row-open-tag "<tr>"
864 "The opening tag for table rows.
865 This is customizable so that alignment options can be specified.
866 Instead of strings, these can be a Lisp function that will be
867 evaluated for each row in order to construct the table row tags.
869 The function will be called with these arguments:
871 `number': row number (0 is the first row)
872 `group-number': group number of current row
873 `start-group-p': non-nil means the row starts a group
874 `end-group-p': non-nil means the row ends a group
875 `topp': non-nil means this is the top row
876 `bottomp': non-nil means this is the bottom row
878 For example:
880 \(setq org-html-table-row-open-tag
881 \(lambda (number group-number start-group-p end-group-p topp bottomp)
882 \(cond (topp \"<tr class=\\\"tr-top\\\">\")
883 \(bottomp \"<tr class=\\\"tr-bottom\\\">\")
884 \(t (if (= (mod number 2) 1)
885 \"<tr class=\\\"tr-odd\\\">\"
886 \"<tr class=\\\"tr-even\\\">\")))))
888 will use the \"tr-top\" and \"tr-bottom\" classes for the top row
889 and the bottom row, and otherwise alternate between \"tr-odd\" and
890 \"tr-even\" for odd and even rows."
891 :group 'org-export-html
892 :type '(choice :tag "Opening tag"
893 (string :tag "Specify")
894 (function)))
896 (defcustom org-html-table-row-close-tag "</tr>"
897 "The closing tag for table rows.
898 This is customizable so that alignment options can be specified.
899 Instead of strings, this can be a Lisp function that will be
900 evaluated for each row in order to construct the table row tags.
902 See documentation of `org-html-table-row-open-tag'."
903 :group 'org-export-html
904 :type '(choice :tag "Closing tag"
905 (string :tag "Specify")
906 (function)))
908 (defcustom org-html-table-align-individual-fields t
909 "Non-nil means attach style attributes for alignment to each table field.
910 When nil, alignment will only be specified in the column tags, but this
911 is ignored by some browsers (like Firefox, Safari). Opera does it right
912 though."
913 :group 'org-export-html
914 :type 'boolean)
916 (defcustom org-html-table-use-header-tags-for-first-column nil
917 "Non-nil means format column one in tables with header tags.
918 When nil, also column one will use data tags."
919 :group 'org-export-html
920 :type 'boolean)
922 (defcustom org-html-table-caption-above t
923 "When non-nil, place caption string at the beginning of the table.
924 Otherwise, place it near the end."
925 :group 'org-export-html
926 :type 'boolean)
928 ;;;; Tags
930 (defcustom org-html-tag-class-prefix ""
931 "Prefix to class names for TODO keywords.
932 Each tag gets a class given by the tag itself, with this prefix.
933 The default prefix is empty because it is nice to just use the keyword
934 as a class name. But if you get into conflicts with other, existing
935 CSS classes, then this prefix can be very useful."
936 :group 'org-export-html
937 :type 'string)
939 ;;;; Template :: Generic
941 (defcustom org-html-extension "html"
942 "The extension for exported HTML files."
943 :group 'org-export-html
944 :type 'string)
946 (defcustom org-html-xml-declaration
947 '(("html" . "<?xml version=\"1.0\" encoding=\"%s\"?>")
948 ("php" . "<?php echo \"<?xml version=\\\"1.0\\\" encoding=\\\"%s\\\" ?>\"; ?>"))
949 "The extension for exported HTML files.
950 %s will be replaced with the charset of the exported file.
951 This may be a string, or an alist with export extensions
952 and corresponding declarations.
954 This declaration only applies when exporting to XHTML."
955 :group 'org-export-html
956 :type '(choice
957 (string :tag "Single declaration")
958 (repeat :tag "Dependent on extension"
959 (cons (string :tag "Extension")
960 (string :tag "Declaration")))))
962 (defcustom org-html-coding-system 'utf-8
963 "Coding system for HTML export.
964 Use utf-8 as the default value."
965 :group 'org-export-html
966 :version "24.4"
967 :package-version '(Org . "8.0")
968 :type 'coding-system)
970 (defcustom org-html-doctype "xhtml-strict"
971 "Document type definition to use for exported HTML files.
972 Can be set with the in-buffer HTML_DOCTYPE property or for
973 publishing, with :html-doctype."
974 :group 'org-export-html
975 :version "24.4"
976 :package-version '(Org . "8.0")
977 :type (append
978 '(choice)
979 (mapcar (lambda (x) `(const ,(car x))) org-html-doctype-alist)
980 '((string :tag "Custom doctype" ))))
982 (defcustom org-html-html5-fancy nil
983 "Non-nil means using new HTML5 elements.
984 This variable is ignored for anything other than HTML5 export.
986 For compatibility with Internet Explorer, it's probably a good
987 idea to download some form of the html5shiv (for instance
988 https://code.google.com/p/html5shiv/) and add it to your
989 HTML_HEAD_EXTRA, so that your pages don't break for users of IE
990 versions 8 and below."
991 :group 'org-export-html
992 :version "24.4"
993 :package-version '(Org . "8.0")
994 :type 'boolean)
996 (defcustom org-html-container-element "div"
997 "HTML element to use for wrapping top level sections.
998 Can be set with the in-buffer HTML_CONTAINER property or for
999 publishing, with :html-container.
1001 Note that changing the default will prevent you from using
1002 org-info.js for your website."
1003 :group 'org-export-html
1004 :version "24.4"
1005 :package-version '(Org . "8.0")
1006 :type 'string)
1008 (defcustom org-html-divs
1009 '((preamble "div" "preamble")
1010 (content "div" "content")
1011 (postamble "div" "postamble"))
1012 "Alist of the three section elements for HTML export.
1013 The car of each entry is one of `preamble', `content' or `postamble'.
1014 The cdrs of each entry are the ELEMENT_TYPE and ID for each
1015 section of the exported document.
1017 Note that changing the default will prevent you from using
1018 org-info.js for your website."
1019 :group 'org-export-html
1020 :version "24.4"
1021 :package-version '(Org . "8.0")
1022 :type '(list :greedy t
1023 (list :tag "Preamble"
1024 (const :format "" preamble)
1025 (string :tag "element") (string :tag " id"))
1026 (list :tag "Content"
1027 (const :format "" content)
1028 (string :tag "element") (string :tag " id"))
1029 (list :tag "Postamble" (const :format "" postamble)
1030 (string :tag " id") (string :tag "element"))))
1032 (defconst org-html-checkbox-types
1033 '((unicode .
1034 ((on . "&#x2611;") (off . "&#x2610;") (trans . "&#x2610;")))
1035 (ascii .
1036 ((on . "<code>[X]</code>")
1037 (off . "<code>[&#xa0;]</code>")
1038 (trans . "<code>[-]</code>")))
1039 (html .
1040 ((on . "<input type='checkbox' checked='checked' />")
1041 (off . "<input type='checkbox' />")
1042 (trans . "<input type='checkbox' />"))))
1043 "Alist of checkbox types.
1044 The cdr of each entry is an alist list three checkbox types for
1045 HTML export: `on', `off' and `trans'.
1047 The choices are:
1048 `unicode' Unicode characters (HTML entities)
1049 `ascii' ASCII characters
1050 `html' HTML checkboxes
1052 Note that only the ascii characters implement tri-state
1053 checkboxes. The other two use the `off' checkbox for `trans'.")
1055 (defcustom org-html-checkbox-type 'ascii
1056 "The type of checkboxes to use for HTML export.
1057 See `org-html-checkbox-types' for for the values used for each
1058 option."
1059 :group 'org-export-html
1060 :version "24.4"
1061 :package-version '(Org . "8.0")
1062 :type '(choice
1063 (const :tag "ASCII characters" ascii)
1064 (const :tag "Unicode characters" unicode)
1065 (const :tag "HTML checkboxes" html)))
1067 (defcustom org-html-metadata-timestamp-format "%Y-%m-%d %a %H:%M"
1068 "Format used for timestamps in preamble, postamble and metadata.
1069 See `format-time-string' for more information on its components."
1070 :group 'org-export-html
1071 :version "24.4"
1072 :package-version '(Org . "8.0")
1073 :type 'string)
1075 ;;;; Template :: Mathjax
1077 (defcustom org-html-mathjax-options
1078 '((path "http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML" )
1079 (scale "100")
1080 (align "center")
1081 (font "TeX")
1082 (linebreaks "false")
1083 (autonumber "AMS")
1084 (indent "0em")
1085 (multlinewidth "85%")
1086 (tagindent ".8em")
1087 (tagside "right"))
1088 "Options for MathJax setup.
1090 Alist of the following elements. All values are strings.
1092 path The path to MathJax.
1093 scale Scaling with HTML-CSS, MathML and SVG output engines.
1094 align How to align display math: left, center, or right.
1095 font The font to use with HTML-CSS and SVG output. As of MathJax 2.5
1096 the following values are understood: \"TeX\", \"STIX-Web\",
1097 \"Asana-Math\", \"Neo-Euler\", \"Gyre-Pagella\",
1098 \"Gyre-Termes\", and \"Latin-Modern\".
1099 linebreaks Let MathJax perform automatic linebreaks. Valid values
1100 are \"true\" and \"false\".
1101 indent If align is not center, how far from the left/right side?
1102 Valid values are \"left\" and \"right\"
1103 multlinewidth The width of the multline environment.
1104 autonumber How to number equations. Valid values are \"None\",
1105 \"all\" and \"AMS Math\".
1106 tagindent The amount tags are indented.
1107 tagside Which side to show tags/labels on. Valid values are
1108 \"left\" and \"right\"
1110 You can also customize this for each buffer, using something like
1112 #+HTML_MATHJAX: align: left indent: 5em tagside: left font: Neo-Euler
1114 For further information about MathJax options, see the MathJax documentation:
1116 http://docs.mathjax.org/
1118 Please note that by using the default CDN one must agree with
1119 MathJax CDN Terms of Service.
1121 http://www.mathjax.org/mathjax-cdn-terms-of-service.html"
1122 :group 'org-export-html
1123 :package-version '(Org . "8.3")
1124 :type '(list :greedy t
1125 (list :tag "path (the path from where to load MathJax.js)"
1126 (const :format " " path) (string))
1127 (list :tag "scale (scaling for the displayed math)"
1128 (const :format " " scale) (string))
1129 (list :tag "align (alignment of displayed equations)"
1130 (const :format " " align) (string))
1131 (list :tag "font (used to display math)"
1132 (const :format " " font)
1133 (choice (const "TeX")
1134 (const "STIX-Web")
1135 (const "Asana-Math")
1136 (const "Neo-Euler")
1137 (const "Gyre-Pagella")
1138 (const "Gyre-Termes")
1139 (const "Latin-Modern")))
1140 (list :tag "linebreaks (automatic line-breaking)"
1141 (const :format " " linebreaks)
1142 (choice (const "true")
1143 (const "false")))
1144 (list :tag "autonumber (when should equations be numbered)"
1145 (const :format " " autonumber)
1146 (choice (const "AMS")
1147 (const "None")
1148 (const "All")))
1149 (list :tag "indent (indentation with left or right alignment)"
1150 (const :format " " indent) (string))
1151 (list :tag "multlinewidth (width to use for the multline environment)"
1152 (const :format " " multlinewidth) (string))
1153 (list :tag "tagindent (the indentation of tags from left or right)"
1154 (const :format " " tagindent) (string))
1155 (list :tag "tagside (location of tags)"
1156 (const :format " " tagside)
1157 (choice (const "left")
1158 (const "right")))))
1160 (defcustom org-html-mathjax-template
1161 "<script type=\"text/x-mathjax-config\">
1162 MathJax.Hub.Config({
1163 displayAlign: \"%ALIGN\",
1164 displayIndent: \"%INDENT\",
1166 \"HTML-CSS\": { scale: %SCALE,
1167 linebreaks: { automatic: \"%LINEBREAKS\" },
1168 webFont: \"%FONT\"
1170 SVG: {scale: %SCALE,
1171 linebreaks: { automatic: \"%LINEBREAKS\" },
1172 font: \"%FONT\"},
1173 NativeMML: {scale: %SCALE},
1174 TeX: { equationNumbers: {autoNumber: \"%AUTONUMBER\"},
1175 MultLineWidth: \"%MULTLINEWIDTH\",
1176 TagSide: \"%TAGSIDE\",
1177 TagIndent: \"%TAGINDENT\"
1180 </script>
1181 <script type=\"text/javascript\"
1182 src=\"%PATH\"></script>"
1183 "The MathJax template. See also `org-html-mathjax-options'."
1184 :group 'org-export-html
1185 :type 'string)
1187 ;;;; Template :: Postamble
1189 (defcustom org-html-postamble 'auto
1190 "Non-nil means insert a postamble in HTML export.
1192 When set to `auto', check against the
1193 `org-export-with-author/email/creator/date' variables to set the
1194 content of the postamble. When set to a string, use this string
1195 as the postamble. When t, insert a string as defined by the
1196 formatting string in `org-html-postamble-format'.
1198 When set to a function, apply this function and insert the
1199 returned string. The function takes the property list of export
1200 options as its only argument.
1202 Setting :html-postamble in publishing projects will take
1203 precedence over this variable."
1204 :group 'org-export-html
1205 :type '(choice (const :tag "No postamble" nil)
1206 (const :tag "Auto postamble" auto)
1207 (const :tag "Default formatting string" t)
1208 (string :tag "Custom formatting string")
1209 (function :tag "Function (must return a string)")))
1211 (defcustom org-html-postamble-format
1212 '(("en" "<p class=\"author\">Author: %a (%e)</p>
1213 <p class=\"date\">Date: %d</p>
1214 <p class=\"creator\">%c</p>
1215 <p class=\"validation\">%v</p>"))
1216 "Alist of languages and format strings for the HTML postamble.
1218 The first element of each list is the language code, as used for
1219 the LANGUAGE keyword. See `org-export-default-language'.
1221 The second element of each list is a format string to format the
1222 postamble itself. This format string can contain these elements:
1224 %t stands for the title.
1225 %s stands for the subtitle.
1226 %a stands for the author's name.
1227 %e stands for the author's email.
1228 %d stands for the date.
1229 %c will be replaced by `org-html-creator-string'.
1230 %v will be replaced by `org-html-validation-link'.
1231 %T will be replaced by the export time.
1232 %C will be replaced by the last modification time.
1234 If you need to use a \"%\" character, you need to escape it
1235 like that: \"%%\"."
1236 :group 'org-export-html
1237 :type '(repeat
1238 (list (string :tag "Language")
1239 (string :tag "Format string"))))
1241 (defcustom org-html-validation-link
1242 "<a href=\"http://validator.w3.org/check?uri=referer\">Validate</a>"
1243 "Link to HTML validation service."
1244 :group 'org-export-html
1245 :type 'string)
1247 (defcustom org-html-creator-string
1248 (format "<a href=\"http://www.gnu.org/software/emacs/\">Emacs</a> %s (<a href=\"http://orgmode.org\">Org</a> mode %s)"
1249 emacs-version
1250 (if (fboundp 'org-version) (org-version) "unknown version"))
1251 "Information about the creator of the HTML document.
1252 This option can also be set on with the CREATOR keyword."
1253 :group 'org-export-html
1254 :version "24.4"
1255 :package-version '(Org . "8.0")
1256 :type '(string :tag "Creator string"))
1258 ;;;; Template :: Preamble
1260 (defcustom org-html-preamble t
1261 "Non-nil means insert a preamble in HTML export.
1263 When t, insert a string as defined by the formatting string in
1264 `org-html-preamble-format'. When set to a string, use this
1265 formatting string instead (see `org-html-postamble-format' for an
1266 example of such a formatting string).
1268 When set to a function, apply this function and insert the
1269 returned string. The function takes the property list of export
1270 options as its only argument.
1272 Setting :html-preamble in publishing projects will take
1273 precedence over this variable."
1274 :group 'org-export-html
1275 :type '(choice (const :tag "No preamble" nil)
1276 (const :tag "Default preamble" t)
1277 (string :tag "Custom formatting string")
1278 (function :tag "Function (must return a string)")))
1280 (defcustom org-html-preamble-format '(("en" ""))
1281 "Alist of languages and format strings for the HTML preamble.
1283 The first element of each list is the language code, as used for
1284 the LANGUAGE keyword. See `org-export-default-language'.
1286 The second element of each list is a format string to format the
1287 preamble itself. This format string can contain these elements:
1289 %t stands for the title.
1290 %s stands for the subtitle.
1291 %a stands for the author's name.
1292 %e stands for the author's email.
1293 %d stands for the date.
1294 %c will be replaced by `org-html-creator-string'.
1295 %v will be replaced by `org-html-validation-link'.
1296 %T will be replaced by the export time.
1297 %C will be replaced by the last modification time.
1299 If you need to use a \"%\" character, you need to escape it
1300 like that: \"%%\".
1302 See the default value of `org-html-postamble-format' for an
1303 example."
1304 :group 'org-export-html
1305 :type '(repeat
1306 (list (string :tag "Language")
1307 (string :tag "Format string"))))
1309 (defcustom org-html-link-up ""
1310 "Where should the \"UP\" link of exported HTML pages lead?"
1311 :group 'org-export-html
1312 :type '(string :tag "File or URL"))
1314 (defcustom org-html-link-home ""
1315 "Where should the \"HOME\" link of exported HTML pages lead?"
1316 :group 'org-export-html
1317 :type '(string :tag "File or URL"))
1319 (defcustom org-html-link-use-abs-url nil
1320 "Should we prepend relative links with HTML_LINK_HOME?"
1321 :group 'org-export-html
1322 :version "24.4"
1323 :package-version '(Org . "8.1")
1324 :type 'boolean)
1326 (defcustom org-html-home/up-format
1327 "<div id=\"org-div-home-and-up\">
1328 <a accesskey=\"h\" href=\"%s\"> UP </a>
1330 <a accesskey=\"H\" href=\"%s\"> HOME </a>
1331 </div>"
1332 "Snippet used to insert the HOME and UP links.
1333 This is a format string, the first %s will receive the UP link,
1334 the second the HOME link. If both `org-html-link-up' and
1335 `org-html-link-home' are empty, the entire snippet will be
1336 ignored."
1337 :group 'org-export-html
1338 :type 'string)
1340 ;;;; Template :: Scripts
1342 (define-obsolete-variable-alias
1343 'org-html-style-include-scripts 'org-html-head-include-scripts "24.4")
1344 (defcustom org-html-head-include-scripts t
1345 "Non-nil means include the JavaScript snippets in exported HTML files.
1346 The actual script is defined in `org-html-scripts' and should
1347 not be modified."
1348 :group 'org-export-html
1349 :version "24.4"
1350 :package-version '(Org . "8.0")
1351 :type 'boolean)
1353 ;;;; Template :: Styles
1355 (define-obsolete-variable-alias
1356 'org-html-style-include-default 'org-html-head-include-default-style "24.4")
1357 (defcustom org-html-head-include-default-style t
1358 "Non-nil means include the default style in exported HTML files.
1359 The actual style is defined in `org-html-style-default' and
1360 should not be modified. Use `org-html-head' to use your own
1361 style information."
1362 :group 'org-export-html
1363 :version "24.4"
1364 :package-version '(Org . "8.0")
1365 :type 'boolean)
1366 ;;;###autoload
1367 (put 'org-html-head-include-default-style 'safe-local-variable 'booleanp)
1369 (define-obsolete-variable-alias 'org-html-style 'org-html-head "24.4")
1370 (defcustom org-html-head ""
1371 "Org-wide head definitions for exported HTML files.
1373 This variable can contain the full HTML structure to provide a
1374 style, including the surrounding HTML tags. You can consider
1375 including definitions for the following classes: title, todo,
1376 done, timestamp, timestamp-kwd, tag, target.
1378 For example, a valid value would be:
1380 <style type=\"text/css\">
1381 <![CDATA[
1382 p { font-weight: normal; color: gray; }
1383 h1 { color: black; }
1384 .title { text-align: center; }
1385 .todo, .timestamp-kwd { color: red; }
1386 .done { color: green; }
1388 </style>
1390 If you want to refer to an external style, use something like
1392 <link rel=\"stylesheet\" type=\"text/css\" href=\"mystyles.css\" />
1394 As the value of this option simply gets inserted into the HTML
1395 <head> header, you can use it to add any arbitrary text to the
1396 header.
1398 You can set this on a per-file basis using #+HTML_HEAD:,
1399 or for publication projects using the :html-head property."
1400 :group 'org-export-html
1401 :version "24.4"
1402 :package-version '(Org . "8.0")
1403 :type 'string)
1404 ;;;###autoload
1405 (put 'org-html-head 'safe-local-variable 'stringp)
1407 (defcustom org-html-head-extra ""
1408 "More head information to add in the HTML output.
1410 You can set this on a per-file basis using #+HTML_HEAD_EXTRA:,
1411 or for publication projects using the :html-head-extra property."
1412 :group 'org-export-html
1413 :version "24.4"
1414 :package-version '(Org . "8.0")
1415 :type 'string)
1416 ;;;###autoload
1417 (put 'org-html-head-extra 'safe-local-variable 'stringp)
1419 ;;;; Template :: Viewport
1421 (defcustom org-html-viewport '((width "device-width")
1422 (initial-scale "1")
1423 (minimum-scale "")
1424 (maximum-scale "")
1425 (user-scalable ""))
1426 "Viewport options for mobile-optimized sites.
1428 The following values are recognized
1430 width Size of the viewport.
1431 initial-scale Zoom level when the page is first loaded.
1432 minimum-scale Minimum allowed zoom level.
1433 maximum-scale Maximum allowed zoom level.
1434 user-scalable Whether zoom can be changed.
1436 The viewport meta tag is inserted if this variable is non-nil.
1438 See the following site for a reference:
1439 https://developer.mozilla.org/en-US/docs/Mozilla/Mobile/Viewport_meta_tag"
1440 :group 'org-export-html
1441 :version "25.1"
1442 :package-version '(Org . "8.3")
1443 :type '(choice (const :tag "Disable" nil)
1444 (list :tag "Enable"
1445 (list :tag "Width of viewport"
1446 (const :format " " width)
1447 (choice (const :tag "unset" "")
1448 (string)))
1449 (list :tag "Initial scale"
1450 (const :format " " initial-scale)
1451 (choice (const :tag "unset" "")
1452 (string)))
1453 (list :tag "Minimum scale/zoom"
1454 (const :format " " minimum-scale)
1455 (choice (const :tag "unset" "")
1456 (string)))
1457 (list :tag "Maximum scale/zoom"
1458 (const :format " " maximum-scale)
1459 (choice (const :tag "unset" "")
1460 (string)))
1461 (list :tag "User scalable/zoomable"
1462 (const :format " " user-scalable)
1463 (choice (const :tag "unset" "")
1464 (const "true")
1465 (const "false"))))))
1467 ;;;; Todos
1469 (defcustom org-html-todo-kwd-class-prefix ""
1470 "Prefix to class names for TODO keywords.
1471 Each TODO keyword gets a class given by the keyword itself, with this prefix.
1472 The default prefix is empty because it is nice to just use the keyword
1473 as a class name. But if you get into conflicts with other, existing
1474 CSS classes, then this prefix can be very useful."
1475 :group 'org-export-html
1476 :type 'string)
1479 ;;; Internal Functions
1481 (defun org-html-xhtml-p (info)
1482 (let ((dt (downcase (plist-get info :html-doctype))))
1483 (string-match-p "xhtml" dt)))
1485 (defun org-html-html5-p (info)
1486 (let ((dt (downcase (plist-get info :html-doctype))))
1487 (member dt '("html5" "xhtml5" "<!doctype html>"))))
1489 (defun org-html--html5-fancy-p (info)
1490 "Non-nil when exporting to HTML5 with fancy elements.
1491 INFO is the current state of the export process, as a plist."
1492 (and (plist-get info :html-html5-fancy)
1493 (org-html-html5-p info)))
1495 (defun org-html-close-tag (tag attr info)
1496 (concat "<" tag " " attr
1497 (if (org-html-xhtml-p info) " />" ">")))
1499 (defun org-html-doctype (info)
1500 "Return correct html doctype tag from `org-html-doctype-alist',
1501 or the literal value of :html-doctype from INFO if :html-doctype
1502 is not found in the alist.
1503 INFO is a plist used as a communication channel."
1504 (let ((dt (plist-get info :html-doctype)))
1505 (or (cdr (assoc dt org-html-doctype-alist)) dt)))
1507 (defun org-html--make-attribute-string (attributes)
1508 "Return a list of attributes, as a string.
1509 ATTRIBUTES is a plist where values are either strings or nil. An
1510 attributes with a nil value will be omitted from the result."
1511 (let (output)
1512 (dolist (item attributes (mapconcat 'identity (nreverse output) " "))
1513 (cond ((null item) (pop output))
1514 ((symbolp item) (push (substring (symbol-name item) 1) output))
1515 (t (let ((key (car output))
1516 (value (replace-regexp-in-string
1517 "\"" "&quot;" (org-html-encode-plain-text item))))
1518 (setcar output (format "%s=\"%s\"" key value))))))))
1520 (defun org-html--wrap-image (contents info &optional caption label)
1521 "Wrap CONTENTS string within an appropriate environment for images.
1522 INFO is a plist used as a communication channel. When optional
1523 arguments CAPTION and LABEL are given, use them for caption and
1524 \"id\" attribute."
1525 (let ((html5-fancy (org-html--html5-fancy-p info)))
1526 (format (if html5-fancy "\n<figure%s>%s%s\n</figure>"
1527 "\n<div%s class=\"figure\">%s%s\n</div>")
1528 ;; ID.
1529 (if (org-string-nw-p label) (format " id=\"%s\"" label) "")
1530 ;; Contents.
1531 (format "\n<p>%s</p>" contents)
1532 ;; Caption.
1533 (if (not (org-string-nw-p caption)) ""
1534 (format (if html5-fancy "\n<figcaption>%s</figcaption>"
1535 "\n<p>%s</p>")
1536 caption)))))
1538 (defun org-html--format-image (source attributes info)
1539 "Return \"img\" tag with given SOURCE and ATTRIBUTES.
1540 SOURCE is a string specifying the location of the image.
1541 ATTRIBUTES is a plist, as returned by
1542 `org-export-read-attribute'. INFO is a plist used as
1543 a communication channel."
1544 (if (string= "svg" (file-name-extension source))
1545 (org-html--svg-image source attributes info)
1546 (org-html-close-tag
1547 "img"
1548 (org-html--make-attribute-string
1549 (org-combine-plists
1550 (list :src source
1551 :alt (if (string-match-p "^ltxpng/" source)
1552 (org-html-encode-plain-text
1553 (org-find-text-property-in-string 'org-latex-src source))
1554 (file-name-nondirectory source)))
1555 attributes))
1556 info)))
1558 (defun org-html--svg-image (source attributes info)
1559 "Return \"object\" appropriate for embedding svg file SOURCE
1560 with assoicated ATTRIBUTES. INFO is a plist used as a
1561 communication channel.
1563 The special attribute \"fallback\" can be used to specify a fallback
1564 image file to use if the object embedding is not supported."
1565 (let ((fallback (plist-get attributes :fallback))
1566 (attrs (org-html--make-attribute-string
1567 (plist-put attributes :fallback nil))))
1568 (format "<object type=\"image/svg+xml\" data=\"%s\" %s>\n%s</object>"
1569 source attrs
1570 (if fallback
1571 (org-html-close-tag
1572 "img" (format "src=\"%s\" %s" fallback attrs) info)
1573 "Sorry, your browser does not support SVG."))))
1575 (defun org-html--textarea-block (element)
1576 "Transcode ELEMENT into a textarea block.
1577 ELEMENT is either a src block or an example block."
1578 (let* ((code (car (org-export-unravel-code element)))
1579 (attr (org-export-read-attribute :attr_html element)))
1580 (format "<p>\n<textarea cols=\"%s\" rows=\"%s\">\n%s</textarea>\n</p>"
1581 (or (plist-get attr :width) 80)
1582 (or (plist-get attr :height) (org-count-lines code))
1583 code)))
1585 (defun org-html--has-caption-p (element &optional _info)
1586 "Non-nil when ELEMENT has a caption affiliated keyword.
1587 INFO is a plist used as a communication channel. This function
1588 is meant to be used as a predicate for `org-export-get-ordinal' or
1589 a value to `org-html-standalone-image-predicate'."
1590 (org-element-property :caption element))
1592 ;;;; Table
1594 (defun org-html-htmlize-region-for-paste (beg end)
1595 "Convert the region between BEG and END to HTML, using htmlize.el.
1596 This is much like `htmlize-region-for-paste', only that it uses
1597 the settings define in the org-... variables."
1598 (let* ((htmlize-output-type org-html-htmlize-output-type)
1599 (htmlize-css-name-prefix org-html-htmlize-font-prefix)
1600 (htmlbuf (htmlize-region beg end)))
1601 (unwind-protect
1602 (with-current-buffer htmlbuf
1603 (buffer-substring (plist-get htmlize-buffer-places 'content-start)
1604 (plist-get htmlize-buffer-places 'content-end)))
1605 (kill-buffer htmlbuf))))
1607 ;;;###autoload
1608 (defun org-html-htmlize-generate-css ()
1609 "Create the CSS for all font definitions in the current Emacs session.
1610 Use this to create face definitions in your CSS style file that can then
1611 be used by code snippets transformed by htmlize.
1612 This command just produces a buffer that contains class definitions for all
1613 faces used in the current Emacs session. You can copy and paste the ones you
1614 need into your CSS file.
1616 If you then set `org-html-htmlize-output-type' to `css', calls
1617 to the function `org-html-htmlize-region-for-paste' will
1618 produce code that uses these same face definitions."
1619 (interactive)
1620 (require 'htmlize)
1621 (and (get-buffer "*html*") (kill-buffer "*html*"))
1622 (with-temp-buffer
1623 (let ((fl (face-list))
1624 (htmlize-css-name-prefix "org-")
1625 (htmlize-output-type 'css)
1626 f i)
1627 (while (setq f (pop fl)
1628 i (and f (face-attribute f :inherit)))
1629 (when (and (symbolp f) (or (not i) (not (listp i))))
1630 (insert (org-add-props (copy-sequence "1") nil 'face f))))
1631 (htmlize-region (point-min) (point-max))))
1632 (org-pop-to-buffer-same-window "*html*")
1633 (goto-char (point-min))
1634 (if (re-search-forward "<style" nil t)
1635 (delete-region (point-min) (match-beginning 0)))
1636 (if (re-search-forward "</style>" nil t)
1637 (delete-region (1+ (match-end 0)) (point-max)))
1638 (beginning-of-line 1)
1639 (if (looking-at " +") (replace-match ""))
1640 (goto-char (point-min)))
1642 (defun org-html--make-string (n string)
1643 "Build a string by concatenating N times STRING."
1644 (let (out) (dotimes (_ n out) (setq out (concat string out)))))
1646 (defun org-html-fix-class-name (kwd) ; audit callers of this function
1647 "Turn todo keyword KWD into a valid class name.
1648 Replaces invalid characters with \"_\"."
1649 (save-match-data
1650 (while (string-match "[^a-zA-Z0-9_]" kwd)
1651 (setq kwd (replace-match "_" t t kwd))))
1652 kwd)
1654 (defun org-html-footnote-section (info)
1655 "Format the footnote section.
1656 INFO is a plist used as a communication channel."
1657 (let* ((fn-alist (org-export-collect-footnote-definitions info))
1658 (fn-alist
1659 (loop for (n _type raw) in fn-alist collect
1660 (cons n (if (eq (org-element-type raw) 'org-data)
1661 (org-trim (org-export-data raw info))
1662 (format "<div class=\"footpara\">%s</div>"
1663 (org-trim (org-export-data raw info))))))))
1664 (when fn-alist
1665 (format
1666 (plist-get info :html-footnotes-section)
1667 (org-html--translate "Footnotes" info)
1668 (format
1669 "\n%s\n"
1670 (mapconcat
1671 (lambda (fn)
1672 (let ((n (car fn)) (def (cdr fn)))
1673 (format
1674 "<div class=\"footdef\">%s %s</div>\n"
1675 (format
1676 (plist-get info :html-footnote-format)
1677 (org-html--anchor
1678 (format "fn.%d" n)
1680 (format " class=\"footnum\" href=\"#fnr.%d\"" n)
1681 info))
1682 def)))
1683 fn-alist
1684 "\n"))))))
1687 ;;; Template
1689 (defun org-html--build-meta-info (info)
1690 "Return meta tags for exported document.
1691 INFO is a plist used as a communication channel."
1692 (let ((protect-string
1693 (lambda (str)
1694 (replace-regexp-in-string
1695 "\"" "&quot;" (org-html-encode-plain-text str))))
1696 (title (org-export-data (plist-get info :title) info))
1697 (author (and (plist-get info :with-author)
1698 (let ((auth (plist-get info :author)))
1699 (and auth
1700 ;; Return raw Org syntax, skipping non
1701 ;; exportable objects.
1702 (org-element-interpret-data
1703 (org-element-map auth
1704 (cons 'plain-text org-element-all-objects)
1705 'identity info))))))
1706 (description (plist-get info :description))
1707 (keywords (plist-get info :keywords))
1708 (charset (or (and org-html-coding-system
1709 (fboundp 'coding-system-get)
1710 (coding-system-get org-html-coding-system
1711 'mime-charset))
1712 "iso-8859-1")))
1713 (concat
1714 (when (plist-get info :time-stamp-file)
1715 (format-time-string
1716 (concat "<!-- "
1717 (plist-get info :html-metadata-timestamp-format)
1718 " -->\n")))
1719 (format
1720 (if (org-html-html5-p info)
1721 (org-html-close-tag "meta" "charset=\"%s\"" info)
1722 (org-html-close-tag
1723 "meta" "http-equiv=\"Content-Type\" content=\"text/html;charset=%s\""
1724 info))
1725 charset) "\n"
1726 (let ((viewport-options
1727 (cl-remove-if-not (lambda (cell) (org-string-nw-p (cadr cell)))
1728 (plist-get info :html-viewport))))
1729 (and viewport-options
1730 (concat
1731 (org-html-close-tag
1732 "meta"
1733 (format "name=\"viewport\" content=\"%s\""
1734 (mapconcat
1735 (lambda (elm) (format "%s=%s" (car elm) (cadr elm)))
1736 viewport-options ", "))
1737 info)
1738 "\n")))
1739 (format "<title>%s</title>\n" title)
1740 (org-html-close-tag "meta" "name=\"generator\" content=\"Org-mode\"" info)
1741 "\n"
1742 (and (org-string-nw-p author)
1743 (concat
1744 (org-html-close-tag "meta"
1745 (format "name=\"author\" content=\"%s\""
1746 (funcall protect-string author))
1747 info)
1748 "\n"))
1749 (and (org-string-nw-p description)
1750 (concat
1751 (org-html-close-tag "meta"
1752 (format "name=\"description\" content=\"%s\"\n"
1753 (funcall protect-string description))
1754 info)
1755 "\n"))
1756 (and (org-string-nw-p keywords)
1757 (concat
1758 (org-html-close-tag "meta"
1759 (format "name=\"keywords\" content=\"%s\""
1760 (funcall protect-string keywords))
1761 info)
1762 "\n")))))
1764 (defun org-html--build-head (info)
1765 "Return information for the <head>..</head> of the HTML output.
1766 INFO is a plist used as a communication channel."
1767 (org-element-normalize-string
1768 (concat
1769 (when (plist-get info :html-head-include-default-style)
1770 (org-element-normalize-string org-html-style-default))
1771 (org-element-normalize-string (plist-get info :html-head))
1772 (org-element-normalize-string (plist-get info :html-head-extra))
1773 (when (and (plist-get info :html-htmlized-css-url)
1774 (eq org-html-htmlize-output-type 'css))
1775 (org-html-close-tag "link"
1776 (format "rel=\"stylesheet\" href=\"%s\" type=\"text/css\""
1777 (plist-get info :html-htmlized-css-url))
1778 info))
1779 (when (plist-get info :html-head-include-scripts) org-html-scripts))))
1781 (defun org-html--build-mathjax-config (info)
1782 "Insert the user setup into the mathjax template.
1783 INFO is a plist used as a communication channel."
1784 (when (and (memq (plist-get info :with-latex) '(mathjax t))
1785 (org-element-map (plist-get info :parse-tree)
1786 '(latex-fragment latex-environment) 'identity info t))
1787 (let ((template (plist-get info :html-mathjax-template))
1788 (options (plist-get info :html-mathjax-options))
1789 (in-buffer (or (plist-get info :html-mathjax) "")))
1790 (dolist (e options (org-element-normalize-string template))
1791 (let ((name (car e))
1792 (val (nth 1 e)))
1793 (when (string-match (concat "\\<" (symbol-name name) ":") in-buffer)
1794 (setq val
1795 (car (read-from-string (substring in-buffer (match-end 0))))))
1796 (unless (stringp val) (setq val (format "%s" val)))
1797 (while (string-match (concat "%" (upcase (symbol-name name)))
1798 template)
1799 (setq template (replace-match val t t template))))))))
1801 (defun org-html-format-spec (info)
1802 "Return format specification for elements that can be
1803 used in the preamble or postamble."
1804 `((?t . ,(org-export-data (plist-get info :title) info))
1805 (?s . ,(org-export-data (plist-get info :subtitle) info))
1806 (?d . ,(org-export-data (org-export-get-date info) info))
1807 (?T . ,(format-time-string
1808 (plist-get info :html-metadata-timestamp-format)))
1809 (?a . ,(org-export-data (plist-get info :author) info))
1810 (?e . ,(mapconcat
1811 (lambda (e)
1812 (format "<a href=\"mailto:%s\">%s</a>" e e))
1813 (split-string (plist-get info :email) ",+ *")
1814 ", "))
1815 (?c . ,(plist-get info :creator))
1816 (?C . ,(let ((file (plist-get info :input-file)))
1817 (format-time-string
1818 (plist-get info :html-metadata-timestamp-format)
1819 (when file (nth 5 (file-attributes file))))))
1820 (?v . ,(or (plist-get info :html-validation-link) ""))))
1822 (defun org-html--build-pre/postamble (type info)
1823 "Return document preamble or postamble as a string, or nil.
1824 TYPE is either `preamble' or `postamble', INFO is a plist used as a
1825 communication channel."
1826 (let ((section (plist-get info (intern (format ":html-%s" type))))
1827 (spec (org-html-format-spec info)))
1828 (when section
1829 (let ((section-contents
1830 (if (functionp section) (funcall section info)
1831 (cond
1832 ((stringp section) (format-spec section spec))
1833 ((eq section 'auto)
1834 (let ((date (cdr (assq ?d spec)))
1835 (author (cdr (assq ?a spec)))
1836 (email (cdr (assq ?e spec)))
1837 (creator (cdr (assq ?c spec)))
1838 (validation-link (cdr (assq ?v spec))))
1839 (concat
1840 (when (and (plist-get info :with-date)
1841 (org-string-nw-p date))
1842 (format "<p class=\"date\">%s: %s</p>\n"
1843 (org-html--translate "Date" info)
1844 date))
1845 (when (and (plist-get info :with-author)
1846 (org-string-nw-p author))
1847 (format "<p class=\"author\">%s: %s</p>\n"
1848 (org-html--translate "Author" info)
1849 author))
1850 (when (and (plist-get info :with-email)
1851 (org-string-nw-p email))
1852 (format "<p class=\"email\">%s: %s</p>\n"
1853 (org-html--translate "Email" info)
1854 email))
1855 (when (plist-get info :time-stamp-file)
1856 (format
1857 "<p class=\"date\">%s: %s</p>\n"
1858 (org-html--translate "Created" info)
1859 (format-time-string
1860 (plist-get info :html-metadata-timestamp-format))))
1861 (when (plist-get info :with-creator)
1862 (format "<p class=\"creator\">%s</p>\n" creator))
1863 (format "<p class=\"validation\">%s</p>\n"
1864 validation-link))))
1865 (t (format-spec
1866 (or (cadr (assoc
1867 (plist-get info :language)
1868 (eval (intern
1869 (format "org-html-%s-format" type)))))
1870 (cadr
1871 (assoc
1872 "en"
1873 (eval
1874 (intern (format "org-html-%s-format" type))))))
1875 spec))))))
1876 (let ((div (assq type (plist-get info :html-divs))))
1877 (when (org-string-nw-p section-contents)
1878 (concat
1879 (format "<%s id=\"%s\" class=\"%s\">\n"
1880 (nth 1 div)
1881 (nth 2 div)
1882 org-html--pre/postamble-class)
1883 (org-element-normalize-string section-contents)
1884 (format "</%s>\n" (nth 1 div)))))))))
1886 (defun org-html-inner-template (contents info)
1887 "Return body of document string after HTML conversion.
1888 CONTENTS is the transcoded contents string. INFO is a plist
1889 holding export options."
1890 (concat
1891 ;; Table of contents.
1892 (let ((depth (plist-get info :with-toc)))
1893 (when depth (org-html-toc depth info)))
1894 ;; Document contents.
1895 contents
1896 ;; Footnotes section.
1897 (org-html-footnote-section info)))
1899 (defun org-html-template (contents info)
1900 "Return complete document string after HTML conversion.
1901 CONTENTS is the transcoded contents string. INFO is a plist
1902 holding export options."
1903 (concat
1904 (when (and (not (org-html-html5-p info)) (org-html-xhtml-p info))
1905 (let* ((xml-declaration (plist-get info :html-xml-declaration))
1906 (decl (or (and (stringp xml-declaration) xml-declaration)
1907 (cdr (assoc (plist-get info :html-extension)
1908 xml-declaration))
1909 (cdr (assoc "html" xml-declaration))
1910 "")))
1911 (when (not (or (not decl) (string= "" decl)))
1912 (format "%s\n"
1913 (format decl
1914 (or (and org-html-coding-system
1915 (fboundp 'coding-system-get)
1916 (coding-system-get org-html-coding-system 'mime-charset))
1917 "iso-8859-1"))))))
1918 (org-html-doctype info)
1919 "\n"
1920 (concat "<html"
1921 (cond ((org-html-xhtml-p info)
1922 (format
1923 " xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"%s\" xml:lang=\"%s\""
1924 (plist-get info :language) (plist-get info :language)))
1925 ((org-html-html5-p info)
1926 (format " lang=\"%s\"" (plist-get info :language))))
1927 ">\n")
1928 "<head>\n"
1929 (org-html--build-meta-info info)
1930 (org-html--build-head info)
1931 (org-html--build-mathjax-config info)
1932 "</head>\n"
1933 "<body>\n"
1934 (let ((link-up (org-trim (plist-get info :html-link-up)))
1935 (link-home (org-trim (plist-get info :html-link-home))))
1936 (unless (and (string= link-up "") (string= link-home ""))
1937 (format (plist-get info :html-home/up-format)
1938 (or link-up link-home)
1939 (or link-home link-up))))
1940 ;; Preamble.
1941 (org-html--build-pre/postamble 'preamble info)
1942 ;; Document contents.
1943 (let ((div (assq 'content (plist-get info :html-divs))))
1944 (format "<%s id=\"%s\">\n" (nth 1 div) (nth 2 div)))
1945 ;; Document title.
1946 (when (plist-get info :with-title)
1947 (let ((title (plist-get info :title))
1948 (subtitle (plist-get info :subtitle))
1949 (html5-fancy (org-html--html5-fancy-p info)))
1950 (when title
1951 (format
1952 (if html5-fancy
1953 "<header>\n<h1 class=\"title\">%s</h1>\n%s</header>"
1954 "<h1 class=\"title\">%s%s</h1>\n")
1955 (org-export-data title info)
1956 (if subtitle
1957 (format
1958 (if html5-fancy
1959 "<p class=\"subtitle\">%s</p>\n"
1960 "\n<br>\n<span class=\"subtitle\">%s</span>\n")
1961 (org-export-data subtitle info))
1962 "")))))
1963 contents
1964 (format "</%s>\n" (nth 1 (assq 'content (plist-get info :html-divs))))
1965 ;; Postamble.
1966 (org-html--build-pre/postamble 'postamble info)
1967 ;; Closing document.
1968 "</body>\n</html>"))
1970 (defun org-html--translate (s info)
1971 "Translate string S according to specified language.
1972 INFO is a plist used as a communication channel."
1973 (org-export-translate s :html info))
1975 ;;;; Anchor
1977 (defun org-html--anchor (id desc attributes info)
1978 "Format a HTML anchor."
1979 (let* ((name (and (plist-get info :html-allow-name-attribute-in-anchors) id))
1980 (attributes (concat (and id (format " id=\"%s\"" id))
1981 (and name (format " name=\"%s\"" name))
1982 attributes)))
1983 (format "<a%s>%s</a>" attributes (or desc ""))))
1985 ;;;; Todo
1987 (defun org-html--todo (todo info)
1988 "Format TODO keywords into HTML."
1989 (when todo
1990 (format "<span class=\"%s %s%s\">%s</span>"
1991 (if (member todo org-done-keywords) "done" "todo")
1992 (or (plist-get info :html-todo-kwd-class-prefix) "")
1993 (org-html-fix-class-name todo)
1994 todo)))
1996 ;;;; Priority
1998 (defun org-html--priority (priority _info)
1999 "Format a priority into HTML.
2000 PRIORITY is the character code of the priority or nil. INFO is
2001 a plist containing export options."
2002 (and priority (format "<span class=\"priority\">[%c]</span>" priority)))
2004 ;;;; Tags
2006 (defun org-html--tags (tags info)
2007 "Format TAGS into HTML.
2008 INFO is a plist containing export options."
2009 (when tags
2010 (format "<span class=\"tag\">%s</span>"
2011 (mapconcat
2012 (lambda (tag)
2013 (format "<span class=\"%s\">%s</span>"
2014 (concat (plist-get info :html-tag-class-prefix)
2015 (org-html-fix-class-name tag))
2016 tag))
2017 tags "&#xa0;"))))
2019 ;;;; Src Code
2021 (defun org-html-fontify-code (code lang)
2022 "Color CODE with htmlize library.
2023 CODE is a string representing the source code to colorize. LANG
2024 is the language used for CODE, as a string, or nil."
2025 (when code
2026 (cond
2027 ;; Case 1: No lang. Possibly an example block.
2028 ((not lang)
2029 ;; Simple transcoding.
2030 (org-html-encode-plain-text code))
2031 ;; Case 2: No htmlize or an inferior version of htmlize
2032 ((not (and (require 'htmlize nil t) (fboundp 'htmlize-region-for-paste)))
2033 ;; Emit a warning.
2034 (message "Cannot fontify src block (htmlize.el >= 1.34 required)")
2035 ;; Simple transcoding.
2036 (org-html-encode-plain-text code))
2037 ;; Case 3: plain text explicitly set
2038 ((not org-html-htmlize-output-type)
2039 ;; Simple transcoding.
2040 (org-html-encode-plain-text code))
2042 ;; Map language
2043 (setq lang (or (assoc-default lang org-src-lang-modes) lang))
2044 (let* ((lang-mode (and lang (intern (format "%s-mode" lang)))))
2045 (cond
2046 ;; Case 1: Language is not associated with any Emacs mode
2047 ((not (functionp lang-mode))
2048 ;; Simple transcoding.
2049 (org-html-encode-plain-text code))
2050 ;; Case 2: Default. Fontify code.
2052 ;; htmlize
2053 (setq code
2054 (let ((output-type org-html-htmlize-output-type)
2055 (font-prefix org-html-htmlize-font-prefix))
2056 (with-temp-buffer
2057 ;; Switch to language-specific mode.
2058 (funcall lang-mode)
2059 (insert code)
2060 ;; Fontify buffer.
2061 (org-font-lock-ensure)
2062 ;; Remove formatting on newline characters.
2063 (save-excursion
2064 (let ((beg (point-min))
2065 (end (point-max)))
2066 (goto-char beg)
2067 (while (progn (end-of-line) (< (point) end))
2068 (put-text-property (point) (1+ (point)) 'face nil)
2069 (forward-char 1))))
2070 (org-src-mode)
2071 (set-buffer-modified-p nil)
2072 ;; Htmlize region.
2073 (let ((org-html-htmlize-output-type output-type)
2074 (org-html-htmlize-font-prefix font-prefix))
2075 (org-html-htmlize-region-for-paste
2076 (point-min) (point-max))))))
2077 ;; Strip any enclosing <pre></pre> tags.
2078 (let* ((beg (and (string-match "\\`<pre[^>]*>\n*" code) (match-end 0)))
2079 (end (and beg (string-match "</pre>\\'" code))))
2080 (if (and beg end) (substring code beg end) code)))))))))
2082 (defun org-html-do-format-code
2083 (code &optional lang refs retain-labels num-start)
2084 "Format CODE string as source code.
2085 Optional arguments LANG, REFS, RETAIN-LABELS and NUM-START are,
2086 respectively, the language of the source code, as a string, an
2087 alist between line numbers and references (as returned by
2088 `org-export-unravel-code'), a boolean specifying if labels should
2089 appear in the source code, and the number associated to the first
2090 line of code."
2091 (let* ((code-lines (org-split-string code "\n"))
2092 (code-length (length code-lines))
2093 (num-fmt
2094 (and num-start
2095 (format "%%%ds: "
2096 (length (number-to-string (+ code-length num-start))))))
2097 (code (org-html-fontify-code code lang)))
2098 (org-export-format-code
2099 code
2100 (lambda (loc line-num ref)
2101 (setq loc
2102 (concat
2103 ;; Add line number, if needed.
2104 (when num-start
2105 (format "<span class=\"linenr\">%s</span>"
2106 (format num-fmt line-num)))
2107 ;; Transcoded src line.
2109 ;; Add label, if needed.
2110 (when (and ref retain-labels) (format " (%s)" ref))))
2111 ;; Mark transcoded line as an anchor, if needed.
2112 (if (not ref) loc
2113 (format "<span id=\"coderef-%s\" class=\"coderef-off\">%s</span>"
2114 ref loc)))
2115 num-start refs)))
2117 (defun org-html-format-code (element info)
2118 "Format contents of ELEMENT as source code.
2119 ELEMENT is either an example block or a src block. INFO is
2120 a plist used as a communication channel."
2121 (let* ((lang (org-element-property :language element))
2122 ;; Extract code and references.
2123 (code-info (org-export-unravel-code element))
2124 (code (car code-info))
2125 (refs (cdr code-info))
2126 ;; Does the src block contain labels?
2127 (retain-labels (org-element-property :retain-labels element))
2128 ;; Does it have line numbers?
2129 (num-start (case (org-element-property :number-lines element)
2130 (continued (org-export-get-loc element info))
2131 (new 0))))
2132 (org-html-do-format-code code lang refs retain-labels num-start)))
2135 ;;; Tables of Contents
2137 (defun org-html-toc (depth info &optional scope)
2138 "Build a table of contents.
2139 DEPTH is an integer specifying the depth of the table. INFO is
2140 a plist used as a communication channel. Optional argument SCOPE
2141 is an element defining the scope of the table. Return the table
2142 of contents as a string, or nil if it is empty."
2143 (let ((toc-entries
2144 (mapcar (lambda (headline)
2145 (cons (org-html--format-toc-headline headline info)
2146 (org-export-get-relative-level headline info)))
2147 (org-export-collect-headlines info depth scope))))
2148 (when toc-entries
2149 (let ((toc (concat "<div id=\"text-table-of-contents\">"
2150 (org-html--toc-text toc-entries)
2151 "</div>\n")))
2152 (if scope toc
2153 (let ((outer-tag (if (org-html--html5-fancy-p info)
2154 "nav"
2155 "div")))
2156 (concat (format "<%s id=\"table-of-contents\">\n" outer-tag)
2157 (let ((top-level (plist-get info :html-toplevel-hlevel)))
2158 (format "<h%d>%s</h%d>\n"
2159 top-level
2160 (org-html--translate "Table of Contents" info)
2161 top-level))
2163 (format "</%s>\n" outer-tag))))))))
2165 (defun org-html--toc-text (toc-entries)
2166 "Return innards of a table of contents, as a string.
2167 TOC-ENTRIES is an alist where key is an entry title, as a string,
2168 and value is its relative level, as an integer."
2169 (let* ((prev-level (1- (cdar toc-entries)))
2170 (start-level prev-level))
2171 (concat
2172 (mapconcat
2173 (lambda (entry)
2174 (let ((headline (car entry))
2175 (level (cdr entry)))
2176 (concat
2177 (let* ((cnt (- level prev-level))
2178 (times (if (> cnt 0) (1- cnt) (- cnt))))
2179 (setq prev-level level)
2180 (concat
2181 (org-html--make-string
2182 times (cond ((> cnt 0) "\n<ul>\n<li>")
2183 ((< cnt 0) "</li>\n</ul>\n")))
2184 (if (> cnt 0) "\n<ul>\n<li>" "</li>\n<li>")))
2185 headline)))
2186 toc-entries "")
2187 (org-html--make-string (- prev-level start-level) "</li>\n</ul>\n"))))
2189 (defun org-html--format-toc-headline (headline info)
2190 "Return an appropriate table of contents entry for HEADLINE.
2191 INFO is a plist used as a communication channel."
2192 (let* ((headline-number (org-export-get-headline-number headline info))
2193 (todo (and (plist-get info :with-todo-keywords)
2194 (let ((todo (org-element-property :todo-keyword headline)))
2195 (and todo (org-export-data todo info)))))
2196 (todo-type (and todo (org-element-property :todo-type headline)))
2197 (priority (and (plist-get info :with-priority)
2198 (org-element-property :priority headline)))
2199 (text (org-export-data-with-backend
2200 (org-export-get-alt-title headline info)
2201 ;; Create an anonymous back-end that will ignore any
2202 ;; footnote-reference, link, radio-target and target
2203 ;; in table of contents.
2204 (org-export-create-backend
2205 :parent 'html
2206 :transcoders '((footnote-reference . ignore)
2207 (link . (lambda (object c i) c))
2208 (radio-target . (lambda (object c i) c))
2209 (target . ignore)))
2210 info))
2211 (tags (and (eq (plist-get info :with-tags) t)
2212 (org-export-get-tags headline info))))
2213 (format "<a href=\"#%s\">%s</a>"
2214 ;; Label.
2215 (or (org-element-property :CUSTOM_ID headline)
2216 (org-export-get-reference headline info))
2217 ;; Body.
2218 (concat
2219 (and (not (org-export-low-level-p headline info))
2220 (org-export-numbered-headline-p headline info)
2221 (concat (mapconcat #'number-to-string headline-number ".")
2222 ". "))
2223 (apply (plist-get info :html-format-headline-function)
2224 todo todo-type priority text tags :section-number nil)))))
2226 (defun org-html-list-of-listings (info)
2227 "Build a list of listings.
2228 INFO is a plist used as a communication channel. Return the list
2229 of listings as a string, or nil if it is empty."
2230 (let ((lol-entries (org-export-collect-listings info)))
2231 (when lol-entries
2232 (concat "<div id=\"list-of-listings\">\n"
2233 (let ((top-level (plist-get info :html-toplevel-hlevel)))
2234 (format "<h%d>%s</h%d>\n"
2235 top-level
2236 (org-html--translate "List of Listings" info)
2237 top-level))
2238 "<div id=\"text-list-of-listings\">\n<ul>\n"
2239 (let ((count 0)
2240 (initial-fmt (format "<span class=\"listing-number\">%s</span>"
2241 (org-html--translate "Listing %d:" info))))
2242 (mapconcat
2243 (lambda (entry)
2244 (let ((label (and (org-element-property :name entry)
2245 (org-export-get-reference entry info)))
2246 (title (org-trim
2247 (org-export-data
2248 (or (org-export-get-caption entry t)
2249 (org-export-get-caption entry))
2250 info))))
2251 (concat
2252 "<li>"
2253 (if (not label)
2254 (concat (format initial-fmt (incf count)) " " title)
2255 (format "<a href=\"#%s\">%s %s</a>"
2256 label
2257 (format initial-fmt (incf count))
2258 title))
2259 "</li>")))
2260 lol-entries "\n"))
2261 "\n</ul>\n</div>\n</div>"))))
2263 (defun org-html-list-of-tables (info)
2264 "Build a list of tables.
2265 INFO is a plist used as a communication channel. Return the list
2266 of tables as a string, or nil if it is empty."
2267 (let ((lol-entries (org-export-collect-tables info)))
2268 (when lol-entries
2269 (concat "<div id=\"list-of-tables\">\n"
2270 (let ((top-level (plist-get info :html-toplevel-hlevel)))
2271 (format "<h%d>%s</h%d>\n"
2272 top-level
2273 (org-html--translate "List of Tables" info)
2274 top-level))
2275 "<div id=\"text-list-of-tables\">\n<ul>\n"
2276 (let ((count 0)
2277 (initial-fmt (format "<span class=\"table-number\">%s</span>"
2278 (org-html--translate "Table %d:" info))))
2279 (mapconcat
2280 (lambda (entry)
2281 (let ((label (and (org-element-property :name entry)
2282 (org-export-get-reference entry info)))
2283 (title (org-trim
2284 (org-export-data
2285 (or (org-export-get-caption entry t)
2286 (org-export-get-caption entry))
2287 info))))
2288 (concat
2289 "<li>"
2290 (if (not label)
2291 (concat (format initial-fmt (incf count)) " " title)
2292 (format "<a href=\"#%s\">%s %s</a>"
2293 label
2294 (format initial-fmt (incf count))
2295 title))
2296 "</li>")))
2297 lol-entries "\n"))
2298 "\n</ul>\n</div>\n</div>"))))
2301 ;;; Transcode Functions
2303 ;;;; Bold
2305 (defun org-html-bold (_bold contents info)
2306 "Transcode BOLD from Org to HTML.
2307 CONTENTS is the text with bold markup. INFO is a plist holding
2308 contextual information."
2309 (format (or (cdr (assq 'bold (plist-get info :html-text-markup-alist))) "%s")
2310 contents))
2312 ;;;; Center Block
2314 (defun org-html-center-block (_center-block contents _info)
2315 "Transcode a CENTER-BLOCK element from Org to HTML.
2316 CONTENTS holds the contents of the block. INFO is a plist
2317 holding contextual information."
2318 (format "<div class=\"org-center\">\n%s</div>" contents))
2320 ;;;; Clock
2322 (defun org-html-clock (clock _contents _info)
2323 "Transcode a CLOCK element from Org to HTML.
2324 CONTENTS is nil. INFO is a plist used as a communication
2325 channel."
2326 (format "<p>
2327 <span class=\"timestamp-wrapper\">
2328 <span class=\"timestamp-kwd\">%s</span> <span class=\"timestamp\">%s</span>%s
2329 </span>
2330 </p>"
2331 org-clock-string
2332 (org-timestamp-translate (org-element-property :value clock))
2333 (let ((time (org-element-property :duration clock)))
2334 (and time (format " <span class=\"timestamp\">(%s)</span>" time)))))
2336 ;;;; Code
2338 (defun org-html-code (code _contents info)
2339 "Transcode CODE from Org to HTML.
2340 CONTENTS is nil. INFO is a plist holding contextual
2341 information."
2342 (format (or (cdr (assq 'code (plist-get info :html-text-markup-alist))) "%s")
2343 (org-html-encode-plain-text (org-element-property :value code))))
2345 ;;;; Drawer
2347 (defun org-html-drawer (drawer contents info)
2348 "Transcode a DRAWER element from Org to HTML.
2349 CONTENTS holds the contents of the block. INFO is a plist
2350 holding contextual information."
2351 (funcall (plist-get info :html-format-drawer-function)
2352 (org-element-property :drawer-name drawer)
2353 contents))
2355 ;;;; Dynamic Block
2357 (defun org-html-dynamic-block (_dynamic-block contents _info)
2358 "Transcode a DYNAMIC-BLOCK element from Org to HTML.
2359 CONTENTS holds the contents of the block. INFO is a plist
2360 holding contextual information. See `org-export-data'."
2361 contents)
2363 ;;;; Entity
2365 (defun org-html-entity (entity _contents _info)
2366 "Transcode an ENTITY object from Org to HTML.
2367 CONTENTS are the definition itself. INFO is a plist holding
2368 contextual information."
2369 (org-element-property :html entity))
2371 ;;;; Example Block
2373 (defun org-html-example-block (example-block _contents info)
2374 "Transcode a EXAMPLE-BLOCK element from Org to HTML.
2375 CONTENTS is nil. INFO is a plist holding contextual
2376 information."
2377 (let ((attributes (org-export-read-attribute :attr_html example-block)))
2378 (if (plist-get attributes :textarea)
2379 (org-html--textarea-block example-block)
2380 (format "<pre class=\"example\"%s>\n%s</pre>"
2381 (let* ((name (org-element-property :name example-block))
2382 (a (org-html--make-attribute-string
2383 (if (or (not name) (plist-member attributes :id))
2384 attributes
2385 (plist-put attributes :id name)))))
2386 (if (org-string-nw-p a) (concat " " a) ""))
2387 (org-html-format-code example-block info)))))
2389 ;;;; Export Snippet
2391 (defun org-html-export-snippet (export-snippet _contents _info)
2392 "Transcode a EXPORT-SNIPPET object from Org to HTML.
2393 CONTENTS is nil. INFO is a plist holding contextual
2394 information."
2395 (when (eq (org-export-snippet-backend export-snippet) 'html)
2396 (org-element-property :value export-snippet)))
2398 ;;;; Export Block
2400 (defun org-html-export-block (export-block _contents _info)
2401 "Transcode a EXPORT-BLOCK element from Org to HTML.
2402 CONTENTS is nil. INFO is a plist holding contextual information."
2403 (when (string= (org-element-property :type export-block) "HTML")
2404 (org-remove-indentation (org-element-property :value export-block))))
2406 ;;;; Fixed Width
2408 (defun org-html-fixed-width (fixed-width _contents _info)
2409 "Transcode a FIXED-WIDTH element from Org to HTML.
2410 CONTENTS is nil. INFO is a plist holding contextual information."
2411 (format "<pre class=\"example\">\n%s</pre>"
2412 (org-html-do-format-code
2413 (org-remove-indentation
2414 (org-element-property :value fixed-width)))))
2416 ;;;; Footnote Reference
2418 (defun org-html-footnote-reference (footnote-reference _contents info)
2419 "Transcode a FOOTNOTE-REFERENCE element from Org to HTML.
2420 CONTENTS is nil. INFO is a plist holding contextual information."
2421 (concat
2422 ;; Insert separator between two footnotes in a row.
2423 (let ((prev (org-export-get-previous-element footnote-reference info)))
2424 (when (eq (org-element-type prev) 'footnote-reference)
2425 (plist-get info :html-footnote-separator)))
2426 (let* ((n (org-export-get-footnote-number footnote-reference info))
2427 (id (format "fnr.%d%s"
2429 (if (org-export-footnote-first-reference-p
2430 footnote-reference info)
2432 ".100"))))
2433 (format
2434 (plist-get info :html-footnote-format)
2435 (org-html--anchor
2436 id n (format " class=\"footref\" href=\"#fn.%d\"" n) info)))))
2438 ;;;; Headline
2440 (defun org-html-headline (headline contents info)
2441 "Transcode a HEADLINE element from Org to HTML.
2442 CONTENTS holds the contents of the headline. INFO is a plist
2443 holding contextual information."
2444 (unless (org-element-property :footnote-section-p headline)
2445 (let* ((numberedp (org-export-numbered-headline-p headline info))
2446 (numbers (org-export-get-headline-number headline info))
2447 (level (+ (org-export-get-relative-level headline info)
2448 (1- (plist-get info :html-toplevel-hlevel))))
2449 (todo (and (plist-get info :with-todo-keywords)
2450 (let ((todo (org-element-property :todo-keyword headline)))
2451 (and todo (org-export-data todo info)))))
2452 (todo-type (and todo (org-element-property :todo-type headline)))
2453 (priority (and (plist-get info :with-priority)
2454 (org-element-property :priority headline)))
2455 (text (org-export-data (org-element-property :title headline) info))
2456 (tags (and (plist-get info :with-tags)
2457 (org-export-get-tags headline info)))
2458 (full-text (funcall (plist-get info :html-format-headline-function)
2459 todo todo-type priority text tags info))
2460 (contents (or contents ""))
2461 (ids (delq nil
2462 (list (org-element-property :CUSTOM_ID headline)
2463 (org-export-get-reference headline info)
2464 (org-element-property :ID headline))))
2465 (preferred-id (car ids))
2466 (extra-ids
2467 (mapconcat
2468 (lambda (id)
2469 (org-html--anchor
2470 (if (org-uuidgen-p id) (concat "ID-" id) id)
2471 nil nil info))
2472 (cdr ids) "")))
2473 (if (org-export-low-level-p headline info)
2474 ;; This is a deep sub-tree: export it as a list item.
2475 (let* ((type (if numberedp 'ordered 'unordered))
2476 (itemized-body
2477 (org-html-format-list-item
2478 contents type nil info nil
2479 (concat (org-html--anchor preferred-id nil nil info)
2480 extra-ids
2481 full-text))))
2482 (concat (and (org-export-first-sibling-p headline info)
2483 (org-html-begin-plain-list type))
2484 itemized-body
2485 (and (org-export-last-sibling-p headline info)
2486 (org-html-end-plain-list type))))
2487 (let ((extra-class (org-element-property :HTML_CONTAINER_CLASS headline))
2488 (first-content (car (org-element-contents headline))))
2489 ;; Standard headline. Export it as a section.
2490 (format "<%s id=\"%s\" class=\"%s\">%s%s</%s>\n"
2491 (org-html--container headline info)
2492 (concat "outline-container-"
2493 (org-export-get-reference headline info))
2494 (concat (format "outline-%d" level)
2495 (and extra-class " ")
2496 extra-class)
2497 (format "\n<h%d id=\"%s\">%s%s</h%d>\n"
2498 level
2499 preferred-id
2500 extra-ids
2501 (concat
2502 (and numberedp
2503 (format
2504 "<span class=\"section-number-%d\">%s</span> "
2505 level
2506 (mapconcat #'number-to-string numbers ".")))
2507 full-text)
2508 level)
2509 ;; When there is no section, pretend there is an
2510 ;; empty one to get the correct <div
2511 ;; class="outline-...> which is needed by
2512 ;; `org-info.js'.
2513 (if (eq (org-element-type first-content) 'section) contents
2514 (concat (org-html-section first-content "" info) contents))
2515 (org-html--container headline info)))))))
2517 (defun org-html-format-headline-default-function
2518 (todo _todo-type priority text tags info)
2519 "Default format function for a headline.
2520 See `org-html-format-headline-function' for details."
2521 (let ((todo (org-html--todo todo info))
2522 (priority (org-html--priority priority info))
2523 (tags (org-html--tags tags info)))
2524 (concat todo (and todo " ")
2525 priority (and priority " ")
2526 text
2527 (and tags "&#xa0;&#xa0;&#xa0;") tags)))
2529 (defun org-html--container (headline info)
2530 (or (org-element-property :HTML_CONTAINER headline)
2531 (if (= 1 (org-export-get-relative-level headline info))
2532 (plist-get info :html-container)
2533 "div")))
2535 ;;;; Horizontal Rule
2537 (defun org-html-horizontal-rule (_horizontal-rule _contents info)
2538 "Transcode an HORIZONTAL-RULE object from Org to HTML.
2539 CONTENTS is nil. INFO is a plist holding contextual information."
2540 (org-html-close-tag "hr" nil info))
2542 ;;;; Inline Src Block
2544 (defun org-html-inline-src-block (inline-src-block _contents info)
2545 "Transcode an INLINE-SRC-BLOCK element from Org to HTML.
2546 CONTENTS holds the contents of the item. INFO is a plist holding
2547 contextual information."
2548 (let ((lang (org-element-property :language inline-src-block))
2549 (code (org-html-format-code inline-src-block info))
2550 (label
2551 (let ((lbl (and (org-element-property :name inline-src-block)
2552 (org-export-get-reference inline-src-block info))))
2553 (if (not lbl) "" (format " id=\"%s\"" lbl)))))
2554 (format "<code class=\"src src-%s\"%s>%s</code>" lang label code)))
2556 ;;;; Inlinetask
2558 (defun org-html-inlinetask (inlinetask contents info)
2559 "Transcode an INLINETASK element from Org to HTML.
2560 CONTENTS holds the contents of the block. INFO is a plist
2561 holding contextual information."
2562 (let* ((todo (and (plist-get info :with-todo-keywords)
2563 (let ((todo (org-element-property :todo-keyword inlinetask)))
2564 (and todo (org-export-data todo info)))))
2565 (todo-type (and todo (org-element-property :todo-type inlinetask)))
2566 (priority (and (plist-get info :with-priority)
2567 (org-element-property :priority inlinetask)))
2568 (text (org-export-data (org-element-property :title inlinetask) info))
2569 (tags (and (plist-get info :with-tags)
2570 (org-export-get-tags inlinetask info))))
2571 (funcall (plist-get info :html-format-inlinetask-function)
2572 todo todo-type priority text tags contents info)))
2574 (defun org-html-format-inlinetask-default-function
2575 (todo todo-type priority text tags contents info)
2576 "Default format function for a inlinetasks.
2577 See `org-html-format-inlinetask-function' for details."
2578 (format "<div class=\"inlinetask\">\n<b>%s</b>%s\n%s</div>"
2579 (org-html-format-headline-default-function
2580 todo todo-type priority text tags info)
2581 (org-html-close-tag "br" nil info)
2582 contents))
2584 ;;;; Italic
2586 (defun org-html-italic (_italic contents info)
2587 "Transcode ITALIC from Org to HTML.
2588 CONTENTS is the text with italic markup. INFO is a plist holding
2589 contextual information."
2590 (format
2591 (or (cdr (assq 'italic (plist-get info :html-text-markup-alist))) "%s")
2592 contents))
2594 ;;;; Item
2596 (defun org-html-checkbox (checkbox info)
2597 "Format CHECKBOX into HTML.
2598 INFO is a plist holding contextual information. See
2599 `org-html-checkbox-type' for customization options."
2600 (cdr (assq checkbox
2601 (cdr (assq (plist-get info :html-checkbox-type)
2602 org-html-checkbox-types)))))
2604 (defun org-html-format-list-item (contents type checkbox info
2605 &optional term-counter-id
2606 headline)
2607 "Format a list item into HTML."
2608 (let ((class (if checkbox
2609 (format " class=\"%s\""
2610 (symbol-name checkbox)) ""))
2611 (checkbox (concat (org-html-checkbox checkbox info)
2612 (and checkbox " ")))
2613 (br (org-html-close-tag "br" nil info)))
2614 (concat
2615 (case type
2616 (ordered
2617 (let* ((counter term-counter-id)
2618 (extra (if counter (format " value=\"%s\"" counter) "")))
2619 (concat
2620 (format "<li%s%s>" class extra)
2621 (when headline (concat headline br)))))
2622 (unordered
2623 (let* ((id term-counter-id)
2624 (extra (if id (format " id=\"%s\"" id) "")))
2625 (concat
2626 (format "<li%s%s>" class extra)
2627 (when headline (concat headline br)))))
2628 (descriptive
2629 (let* ((term term-counter-id))
2630 (setq term (or term "(no term)"))
2631 ;; Check-boxes in descriptive lists are associated to tag.
2632 (concat (format "<dt%s>%s</dt>"
2633 class (concat checkbox term))
2634 "<dd>"))))
2635 (unless (eq type 'descriptive) checkbox)
2636 (and contents (org-trim contents))
2637 (case type
2638 (ordered "</li>")
2639 (unordered "</li>")
2640 (descriptive "</dd>")))))
2642 (defun org-html-item (item contents info)
2643 "Transcode an ITEM element from Org to HTML.
2644 CONTENTS holds the contents of the item. INFO is a plist holding
2645 contextual information."
2646 (let* ((plain-list (org-export-get-parent item))
2647 (type (org-element-property :type plain-list))
2648 (counter (org-element-property :counter item))
2649 (checkbox (org-element-property :checkbox item))
2650 (tag (let ((tag (org-element-property :tag item)))
2651 (and tag (org-export-data tag info)))))
2652 (org-html-format-list-item
2653 contents type checkbox info (or tag counter))))
2655 ;;;; Keyword
2657 (defun org-html-keyword (keyword _contents info)
2658 "Transcode a KEYWORD element from Org to HTML.
2659 CONTENTS is nil. INFO is a plist holding contextual information."
2660 (let ((key (org-element-property :key keyword))
2661 (value (org-element-property :value keyword)))
2662 (cond
2663 ((string= key "HTML") value)
2664 ((string= key "TOC")
2665 (let ((case-fold-search t))
2666 (cond
2667 ((string-match "\\<headlines\\>" value)
2668 (let ((depth (and (string-match "\\<[0-9]+\\>" value)
2669 (string-to-number (match-string 0 value))))
2670 (localp (org-string-match-p "\\<local\\>" value)))
2671 (org-html-toc depth info (and localp keyword))))
2672 ((string= "listings" value) (org-html-list-of-listings info))
2673 ((string= "tables" value) (org-html-list-of-tables info))))))))
2675 ;;;; Latex Environment
2677 (defun org-html-format-latex (latex-frag processing-type info)
2678 "Format a LaTeX fragment LATEX-FRAG into HTML.
2679 PROCESSING-TYPE designates the tool used for conversion. It is
2680 a symbol among `mathjax', `dvipng', `imagemagick', `verbatim' nil
2681 and t. See `org-html-with-latex' for more information. INFO is
2682 a plist containing export properties."
2683 (let ((cache-relpath "") (cache-dir ""))
2684 (unless (eq processing-type 'mathjax)
2685 (let ((bfn (or (buffer-file-name)
2686 (make-temp-name
2687 (expand-file-name "latex" temporary-file-directory))))
2688 (latex-header
2689 (let ((header (plist-get info :latex-header)))
2690 (and header
2691 (concat (mapconcat
2692 (lambda (line) (concat "#+LATEX_HEADER: " line))
2693 (org-split-string header "\n")
2694 "\n")
2695 "\n")))))
2696 (setq cache-relpath
2697 (concat "ltxpng/"
2698 (file-name-sans-extension
2699 (file-name-nondirectory bfn)))
2700 cache-dir (file-name-directory bfn))
2701 ;; Re-create LaTeX environment from original buffer in
2702 ;; temporary buffer so that dvipng/imagemagick can properly
2703 ;; turn the fragment into an image.
2704 (setq latex-frag (concat latex-header latex-frag))))
2705 (with-temp-buffer
2706 (insert latex-frag)
2707 (org-format-latex cache-relpath cache-dir nil "Creating LaTeX Image..."
2708 nil processing-type)
2709 (buffer-string))))
2711 (defun org-html-latex-environment (latex-environment _contents info)
2712 "Transcode a LATEX-ENVIRONMENT element from Org to HTML.
2713 CONTENTS is nil. INFO is a plist holding contextual information."
2714 (let ((processing-type (plist-get info :with-latex))
2715 (latex-frag (org-remove-indentation
2716 (org-element-property :value latex-environment)))
2717 (attributes (org-export-read-attribute :attr_html latex-environment)))
2718 (case processing-type
2719 ((t mathjax)
2720 (org-html-format-latex latex-frag 'mathjax info))
2721 ((dvipng imagemagick)
2722 (let ((formula-link
2723 (org-html-format-latex latex-frag processing-type info)))
2724 (when (and formula-link (string-match "file:\\([^]]*\\)" formula-link))
2725 ;; Do not provide a caption or a name to be consistent with
2726 ;; `mathjax' handling.
2727 (org-html--wrap-image
2728 (org-html--format-image
2729 (match-string 1 formula-link) attributes info) info))))
2730 (t latex-frag))))
2732 ;;;; Latex Fragment
2734 (defun org-html-latex-fragment (latex-fragment _contents info)
2735 "Transcode a LATEX-FRAGMENT object from Org to HTML.
2736 CONTENTS is nil. INFO is a plist holding contextual information."
2737 (let ((latex-frag (org-element-property :value latex-fragment))
2738 (processing-type (plist-get info :with-latex)))
2739 (case processing-type
2740 ((t mathjax)
2741 (org-html-format-latex latex-frag 'mathjax info))
2742 ((dvipng imagemagick)
2743 (let ((formula-link
2744 (org-html-format-latex latex-frag processing-type info)))
2745 (when (and formula-link (string-match "file:\\([^]]*\\)" formula-link))
2746 (org-html--format-image (match-string 1 formula-link) nil info))))
2747 (t latex-frag))))
2749 ;;;; Line Break
2751 (defun org-html-line-break (_line-break _contents info)
2752 "Transcode a LINE-BREAK object from Org to HTML.
2753 CONTENTS is nil. INFO is a plist holding contextual information."
2754 (concat (org-html-close-tag "br" nil info) "\n"))
2756 ;;;; Link
2758 (defun org-html-inline-image-p (link info)
2759 "Non-nil when LINK is meant to appear as an image.
2760 INFO is a plist used as a communication channel. LINK is an
2761 inline image when it has no description and targets an image
2762 file (see `org-html-inline-image-rules' for more information), or
2763 if its description is a single link targeting an image file."
2764 (if (not (org-element-contents link))
2765 (org-export-inline-image-p
2766 link (plist-get info :html-inline-image-rules))
2767 (not
2768 (let ((link-count 0))
2769 (org-element-map (org-element-contents link)
2770 (cons 'plain-text org-element-all-objects)
2771 (lambda (obj)
2772 (case (org-element-type obj)
2773 (plain-text (org-string-nw-p obj))
2774 (link (if (= link-count 1) t
2775 (incf link-count)
2776 (not (org-export-inline-image-p
2777 obj (plist-get info :html-inline-image-rules)))))
2778 (otherwise t)))
2779 info t)))))
2781 (defvar org-html-standalone-image-predicate)
2782 (defun org-html-standalone-image-p (element info)
2783 "Non-nil if ELEMENT is a standalone image.
2785 INFO is a plist holding contextual information.
2787 An element or object is a standalone image when
2789 - its type is `paragraph' and its sole content, save for white
2790 spaces, is a link that qualifies as an inline image;
2792 - its type is `link' and its containing paragraph has no other
2793 content save white spaces.
2795 Bind `org-html-standalone-image-predicate' to constrain paragraph
2796 further. For example, to check for only captioned standalone
2797 images, set it to:
2799 (lambda (paragraph) (org-element-property :caption paragraph))"
2800 (let ((paragraph (case (org-element-type element)
2801 (paragraph element)
2802 (link (org-export-get-parent element)))))
2803 (and (eq (org-element-type paragraph) 'paragraph)
2804 (or (not (fboundp 'org-html-standalone-image-predicate))
2805 (funcall org-html-standalone-image-predicate paragraph))
2806 (catch 'exit
2807 (let ((link-count 0))
2808 (org-element-map (org-element-contents paragraph)
2809 (cons 'plain-text org-element-all-objects)
2810 #'(lambda (obj)
2811 (when (case (org-element-type obj)
2812 (plain-text (org-string-nw-p obj))
2813 (link (or (> (incf link-count) 1)
2814 (not (org-html-inline-image-p obj info))))
2815 (otherwise t))
2816 (throw 'exit nil)))
2817 info nil 'link)
2818 (= link-count 1))))))
2820 (defun org-html-link (link desc info)
2821 "Transcode a LINK object from Org to HTML.
2822 DESC is the description part of the link, or the empty string.
2823 INFO is a plist holding contextual information. See
2824 `org-export-data'."
2825 (let* ((home (when (plist-get info :html-link-home)
2826 (org-trim (plist-get info :html-link-home))))
2827 (use-abs-url (plist-get info :html-link-use-abs-url))
2828 (link-org-files-as-html-maybe
2829 (lambda (raw-path info)
2830 ;; Treat links to `file.org' as links to `file.html', if
2831 ;; needed. See `org-html-link-org-files-as-html'.
2832 (cond
2833 ((and (plist-get info :html-link-org-files-as-html)
2834 (string= ".org"
2835 (downcase (file-name-extension raw-path "."))))
2836 (concat (file-name-sans-extension raw-path) "."
2837 (plist-get info :html-extension)))
2838 (t raw-path))))
2839 (type (org-element-property :type link))
2840 (raw-path (org-element-property :path link))
2841 ;; Ensure DESC really exists, or set it to nil.
2842 (desc (org-string-nw-p desc))
2843 (path
2844 (cond
2845 ((member type '("http" "https" "ftp" "mailto" "news"))
2846 (org-link-escape-browser
2847 (org-link-unescape (concat type ":" raw-path))))
2848 ((string= type "file")
2849 ;; Treat links to ".org" files as ".html", if needed.
2850 (setq raw-path
2851 (funcall link-org-files-as-html-maybe raw-path info))
2852 ;; If file path is absolute, prepend it with protocol
2853 ;; component - "file://".
2854 (cond
2855 ((file-name-absolute-p raw-path)
2856 (setq raw-path (org-export-file-uri raw-path)))
2857 ((and home use-abs-url)
2858 (setq raw-path (concat (file-name-as-directory home) raw-path))))
2859 ;; Add search option, if any. A search option can be
2860 ;; relative to a custom-id, a headline title, a name or
2861 ;; a target.
2862 (let ((option (org-element-property :search-option link)))
2863 (cond ((not option) raw-path)
2864 ;; Since HTML back-end use custom-id value as-is,
2865 ;; resolving is them is trivial.
2866 ((eq (string-to-char option) ?#) (concat raw-path option))
2868 (concat raw-path
2870 (org-publish-resolve-external-link
2871 option
2872 (org-element-property :path link)))))))
2873 (t raw-path)))
2874 ;; Extract attributes from parent's paragraph. HACK: Only do
2875 ;; this for the first link in parent (inner image link for
2876 ;; inline images). This is needed as long as attributes
2877 ;; cannot be set on a per link basis.
2878 (attributes-plist
2879 (let* ((parent (org-export-get-parent-element link))
2880 (link (let ((container (org-export-get-parent link)))
2881 (if (and (eq (org-element-type container) 'link)
2882 (org-html-inline-image-p link info))
2883 container
2884 link))))
2885 (and (eq (org-element-map parent 'link 'identity info t) link)
2886 (org-export-read-attribute :attr_html parent))))
2887 (attributes
2888 (let ((attr (org-html--make-attribute-string attributes-plist)))
2889 (if (org-string-nw-p attr) (concat " " attr) ""))))
2890 (cond
2891 ;; Link type is handled by a special function.
2892 ((org-export-custom-protocol-maybe link desc 'html))
2893 ;; Image file.
2894 ((and (plist-get info :html-inline-images)
2895 (org-export-inline-image-p
2896 link (plist-get info :html-inline-image-rules)))
2897 (org-html--format-image path attributes-plist info))
2898 ;; Radio target: Transcode target's contents and use them as
2899 ;; link's description.
2900 ((string= type "radio")
2901 (let ((destination (org-export-resolve-radio-link link info)))
2902 (if (not destination) desc
2903 (format "<a href=\"#%s\"%s>%s</a>"
2904 (org-export-get-reference destination info)
2905 attributes
2906 desc))))
2907 ;; Links pointing to a headline: Find destination and build
2908 ;; appropriate referencing command.
2909 ((member type '("custom-id" "fuzzy" "id"))
2910 (let ((destination (if (string= type "fuzzy")
2911 (org-export-resolve-fuzzy-link link info)
2912 (org-export-resolve-id-link link info))))
2913 (case (org-element-type destination)
2914 ;; ID link points to an external file.
2915 (plain-text
2916 (let ((fragment (concat "ID-" path))
2917 ;; Treat links to ".org" files as ".html", if needed.
2918 (path (funcall link-org-files-as-html-maybe
2919 destination info)))
2920 (format "<a href=\"%s#%s\"%s>%s</a>"
2921 path fragment attributes (or desc destination))))
2922 ;; Fuzzy link points nowhere.
2923 ((nil)
2924 (format "<i>%s</i>"
2925 (or desc
2926 (org-export-data
2927 (org-element-property :raw-link link) info))))
2928 ;; Link points to a headline.
2929 (headline
2930 (let ((href (or (org-element-property :CUSTOM_ID destination)
2931 (org-export-get-reference destination info)))
2932 ;; What description to use?
2933 (desc
2934 ;; Case 1: Headline is numbered and LINK has no
2935 ;; description. Display section number.
2936 (if (and (org-export-numbered-headline-p destination info)
2937 (not desc))
2938 (mapconcat #'number-to-string
2939 (org-export-get-headline-number
2940 destination info) ".")
2941 ;; Case 2: Either the headline is un-numbered or
2942 ;; LINK has a custom description. Display LINK's
2943 ;; description or headline's title.
2944 (or desc
2945 (org-export-data
2946 (org-element-property :title destination) info)))))
2947 (format "<a href=\"#%s\"%s>%s</a>" href attributes desc)))
2948 ;; Fuzzy link points to a target or an element.
2950 (let* ((ref (org-export-get-reference destination info))
2951 (org-html-standalone-image-predicate
2952 #'org-html--has-caption-p)
2953 (number (cond
2954 (desc nil)
2955 ((org-html-standalone-image-p destination info)
2956 (org-export-get-ordinal
2957 (org-element-map destination 'link
2958 #'identity info t)
2959 info 'link 'org-html-standalone-image-p))
2960 (t (org-export-get-ordinal
2961 destination info nil 'org-html--has-caption-p))))
2962 (desc (cond (desc)
2963 ((not number) "No description for this link")
2964 ((numberp number) (number-to-string number))
2965 (t (mapconcat #'number-to-string number ".")))))
2966 (format "<a href=\"#%s\"%s>%s</a>" ref attributes desc))))))
2967 ;; Coderef: replace link with the reference name or the
2968 ;; equivalent line number.
2969 ((string= type "coderef")
2970 (let ((fragment (concat "coderef-" (org-html-encode-plain-text path))))
2971 (format "<a href=\"#%s\"%s%s>%s</a>"
2972 fragment
2973 (format "class=\"coderef\" onmouseover=\"CodeHighlightOn(this, \
2974 '%s');\" onmouseout=\"CodeHighlightOff(this, '%s');\""
2975 fragment fragment)
2976 attributes
2977 (format (org-export-get-coderef-format path desc)
2978 (org-export-resolve-coderef path info)))))
2979 ;; External link with a description part.
2980 ((and path desc) (format "<a href=\"%s\"%s>%s</a>"
2981 (org-html-encode-plain-text path)
2982 attributes
2983 desc))
2984 ;; External link without a description part.
2985 (path (let ((path (org-html-encode-plain-text path)))
2986 (format "<a href=\"%s\"%s>%s</a>" path attributes path)))
2987 ;; No path, only description. Try to do something useful.
2988 (t (format "<i>%s</i>" desc)))))
2990 ;;;; Node Property
2992 (defun org-html-node-property (node-property _contents _info)
2993 "Transcode a NODE-PROPERTY element from Org to HTML.
2994 CONTENTS is nil. INFO is a plist holding contextual
2995 information."
2996 (format "%s:%s"
2997 (org-element-property :key node-property)
2998 (let ((value (org-element-property :value node-property)))
2999 (if value (concat " " value) ""))))
3001 ;;;; Paragraph
3003 (defun org-html-paragraph (paragraph contents info)
3004 "Transcode a PARAGRAPH element from Org to HTML.
3005 CONTENTS is the contents of the paragraph, as a string. INFO is
3006 the plist used as a communication channel."
3007 (let* ((parent (org-export-get-parent paragraph))
3008 (parent-type (org-element-type parent))
3009 (style '((footnote-definition " class=\"footpara\"")
3010 (org-data " class=\"footpara\"")))
3011 (attributes (org-html--make-attribute-string
3012 (org-export-read-attribute :attr_html paragraph)))
3013 (extra (or (cadr (assq parent-type style)) "")))
3014 (cond
3015 ((and (eq parent-type 'item)
3016 (not (org-export-get-previous-element paragraph info))
3017 (let ((followers (org-export-get-next-element paragraph info 2)))
3018 (and (not (cdr followers))
3019 (memq (org-element-type (car followers)) '(nil plain-list)))))
3020 ;; First paragraph in an item has no tag if it is alone or
3021 ;; followed, at most, by a sub-list.
3022 contents)
3023 ((org-html-standalone-image-p paragraph info)
3024 ;; Standalone image.
3025 (let ((caption
3026 (let ((raw (org-export-data
3027 (org-export-get-caption paragraph) info))
3028 (org-html-standalone-image-predicate
3029 'org-html--has-caption-p))
3030 (if (not (org-string-nw-p raw)) raw
3031 (concat
3032 "<span class=\"figure-number\">"
3033 (format (org-html--translate "Figure %d:" info)
3034 (org-export-get-ordinal
3035 (org-element-map paragraph 'link
3036 'identity info t)
3037 info nil 'org-html-standalone-image-p))
3038 "</span> " raw))))
3039 (label (and (org-element-property :name paragraph)
3040 (org-export-get-reference paragraph info))))
3041 (org-html--wrap-image contents info caption label)))
3042 ;; Regular paragraph.
3043 (t (format "<p%s%s>\n%s</p>"
3044 (if (org-string-nw-p attributes)
3045 (concat " " attributes) "")
3046 extra contents)))))
3048 ;;;; Plain List
3050 ;; FIXME Maybe arg1 is not needed because <li value="20"> already sets
3051 ;; the correct value for the item counter
3052 (defun org-html-begin-plain-list (type &optional arg1)
3053 "Insert the beginning of the HTML list depending on TYPE.
3054 When ARG1 is a string, use it as the start parameter for ordered
3055 lists."
3056 (case type
3057 (ordered
3058 (format "<ol class=\"org-ol\"%s>"
3059 (if arg1 (format " start=\"%d\"" arg1) "")))
3060 (unordered "<ul class=\"org-ul\">")
3061 (descriptive "<dl class=\"org-dl\">")))
3063 (defun org-html-end-plain-list (type)
3064 "Insert the end of the HTML list depending on TYPE."
3065 (case type
3066 (ordered "</ol>")
3067 (unordered "</ul>")
3068 (descriptive "</dl>")))
3070 (defun org-html-plain-list (plain-list contents _info)
3071 "Transcode a PLAIN-LIST element from Org to HTML.
3072 CONTENTS is the contents of the list. INFO is a plist holding
3073 contextual information."
3074 (let ((type (org-element-property :type plain-list)))
3075 (format "%s\n%s%s"
3076 (org-html-begin-plain-list type)
3077 contents (org-html-end-plain-list type))))
3079 ;;;; Plain Text
3081 (defun org-html-convert-special-strings (string)
3082 "Convert special characters in STRING to HTML."
3083 (dolist (a org-html-special-string-regexps string)
3084 (let ((re (car a))
3085 (rpl (cdr a)))
3086 (setq string (replace-regexp-in-string re rpl string t)))))
3088 (defun org-html-encode-plain-text (text)
3089 "Convert plain text characters from TEXT to HTML equivalent.
3090 Possible conversions are set in `org-html-protect-char-alist'."
3091 (dolist (pair org-html-protect-char-alist text)
3092 (setq text (replace-regexp-in-string (car pair) (cdr pair) text t t))))
3094 (defun org-html-plain-text (text info)
3095 "Transcode a TEXT string from Org to HTML.
3096 TEXT is the string to transcode. INFO is a plist holding
3097 contextual information."
3098 (let ((output text))
3099 ;; Protect following characters: <, >, &.
3100 (setq output (org-html-encode-plain-text output))
3101 ;; Handle smart quotes. Be sure to provide original string since
3102 ;; OUTPUT may have been modified.
3103 (when (plist-get info :with-smart-quotes)
3104 (setq output (org-export-activate-smart-quotes output :html info text)))
3105 ;; Handle special strings.
3106 (when (plist-get info :with-special-strings)
3107 (setq output (org-html-convert-special-strings output)))
3108 ;; Handle break preservation if required.
3109 (when (plist-get info :preserve-breaks)
3110 (setq output
3111 (replace-regexp-in-string
3112 "\\(\\\\\\\\\\)?[ \t]*\n"
3113 (concat (org-html-close-tag "br" nil info) "\n") output)))
3114 ;; Return value.
3115 output))
3118 ;; Planning
3120 (defun org-html-planning (planning _contents info)
3121 "Transcode a PLANNING element from Org to HTML.
3122 CONTENTS is nil. INFO is a plist used as a communication
3123 channel."
3124 (format
3125 "<p><span class=\"timestamp-wrapper\">%s</span></p>"
3126 (org-trim
3127 (mapconcat
3128 (lambda (pair)
3129 (let ((timestamp (cdr pair)))
3130 (when timestamp
3131 (let ((string (car pair)))
3132 (format "<span class=\"timestamp-kwd\">%s</span> \
3133 <span class=\"timestamp\">%s</span> "
3134 string
3135 (org-html-plain-text (org-timestamp-translate timestamp)
3136 info))))))
3137 `((,org-closed-string . ,(org-element-property :closed planning))
3138 (,org-deadline-string . ,(org-element-property :deadline planning))
3139 (,org-scheduled-string . ,(org-element-property :scheduled planning)))
3140 ""))))
3142 ;;;; Property Drawer
3144 (defun org-html-property-drawer (_property-drawer contents _info)
3145 "Transcode a PROPERTY-DRAWER element from Org to HTML.
3146 CONTENTS holds the contents of the drawer. INFO is a plist
3147 holding contextual information."
3148 (and (org-string-nw-p contents)
3149 (format "<pre class=\"example\">\n%s</pre>" contents)))
3151 ;;;; Quote Block
3153 (defun org-html-quote-block (quote-block contents _info)
3154 "Transcode a QUOTE-BLOCK element from Org to HTML.
3155 CONTENTS holds the contents of the block. INFO is a plist
3156 holding contextual information."
3157 (format "<blockquote%s>\n%s</blockquote>"
3158 (let* ((name (org-element-property :name quote-block))
3159 (attributes (org-export-read-attribute :attr_html quote-block))
3160 (a (org-html--make-attribute-string
3161 (if (or (not name) (plist-member attributes :id))
3162 attributes
3163 (plist-put attributes :id name)))))
3164 (if (org-string-nw-p a) (concat " " a) ""))
3165 contents))
3167 ;;;; Section
3169 (defun org-html-section (section contents info)
3170 "Transcode a SECTION element from Org to HTML.
3171 CONTENTS holds the contents of the section. INFO is a plist
3172 holding contextual information."
3173 (let ((parent (org-export-get-parent-headline section)))
3174 ;; Before first headline: no container, just return CONTENTS.
3175 (if (not parent) contents
3176 ;; Get div's class and id references.
3177 (let* ((class-num (+ (org-export-get-relative-level parent info)
3178 (1- (plist-get info :html-toplevel-hlevel))))
3179 (section-number
3180 (and (org-export-numbered-headline-p parent info)
3181 (mapconcat
3182 #'number-to-string
3183 (org-export-get-headline-number parent info) "-"))))
3184 ;; Build return value.
3185 (format "<div class=\"outline-text-%d\" id=\"text-%s\">\n%s</div>"
3186 class-num
3187 (or (org-element-property :CUSTOM_ID parent)
3188 section-number
3189 (org-export-get-reference parent info))
3190 (or contents ""))))))
3192 ;;;; Radio Target
3194 (defun org-html-radio-target (radio-target text info)
3195 "Transcode a RADIO-TARGET object from Org to HTML.
3196 TEXT is the text of the target. INFO is a plist holding
3197 contextual information."
3198 (let ((ref (org-export-get-reference radio-target info)))
3199 (org-html--anchor ref text nil info)))
3201 ;;;; Special Block
3203 (defun org-html-special-block (special-block contents info)
3204 "Transcode a SPECIAL-BLOCK element from Org to HTML.
3205 CONTENTS holds the contents of the block. INFO is a plist
3206 holding contextual information."
3207 (let* ((block-type (org-element-property :type special-block))
3208 (html5-fancy (and (org-html--html5-fancy-p info)
3209 (member block-type org-html-html5-elements)))
3210 (attributes (org-export-read-attribute :attr_html special-block)))
3211 (unless html5-fancy
3212 (let ((class (plist-get attributes :class)))
3213 (setq attributes (plist-put attributes :class
3214 (if class (concat class " " block-type)
3215 block-type)))))
3216 (let* ((contents (or contents ""))
3217 (name (org-element-property :name special-block))
3218 (a (org-html--make-attribute-string
3219 (if (or (not name) (plist-member attributes :id))
3220 attributes
3221 (plist-put attributes :id name))))
3222 (str (if (org-string-nw-p a) (concat " " a) "")))
3223 (if html5-fancy
3224 (format "<%s%s>\n%s</%s>" block-type str contents block-type)
3225 (format "<div%s>\n%s\n</div>" str contents)))))
3227 ;;;; Src Block
3229 (defun org-html-src-block (src-block _contents info)
3230 "Transcode a SRC-BLOCK element from Org to HTML.
3231 CONTENTS holds the contents of the item. INFO is a plist holding
3232 contextual information."
3233 (if (org-export-read-attribute :attr_html src-block :textarea)
3234 (org-html--textarea-block src-block)
3235 (let ((lang (org-element-property :language src-block))
3236 (caption (org-export-get-caption src-block))
3237 (code (org-html-format-code src-block info))
3238 (label (let ((lbl (and (org-element-property :name src-block)
3239 (org-export-get-reference src-block info))))
3240 (if lbl (format " id=\"%s\"" lbl) ""))))
3241 (if (not lang) (format "<pre class=\"example\"%s>\n%s</pre>" label code)
3242 (format
3243 "<div class=\"org-src-container\">\n%s%s\n</div>"
3244 (if (not caption) ""
3245 (format "<label class=\"org-src-name\">%s</label>"
3246 (org-export-data caption info)))
3247 (format "\n<pre class=\"src src-%s\"%s>%s</pre>" lang label code))))))
3249 ;;;; Statistics Cookie
3251 (defun org-html-statistics-cookie (statistics-cookie _contents _info)
3252 "Transcode a STATISTICS-COOKIE object from Org to HTML.
3253 CONTENTS is nil. INFO is a plist holding contextual information."
3254 (let ((cookie-value (org-element-property :value statistics-cookie)))
3255 (format "<code>%s</code>" cookie-value)))
3257 ;;;; Strike-Through
3259 (defun org-html-strike-through (_strike-through contents info)
3260 "Transcode STRIKE-THROUGH from Org to HTML.
3261 CONTENTS is the text with strike-through markup. INFO is a plist
3262 holding contextual information."
3263 (format
3264 (or (cdr (assq 'strike-through (plist-get info :html-text-markup-alist)))
3265 "%s")
3266 contents))
3268 ;;;; Subscript
3270 (defun org-html-subscript (_subscript contents _info)
3271 "Transcode a SUBSCRIPT object from Org to HTML.
3272 CONTENTS is the contents of the object. INFO is a plist holding
3273 contextual information."
3274 (format "<sub>%s</sub>" contents))
3276 ;;;; Superscript
3278 (defun org-html-superscript (_superscript contents _info)
3279 "Transcode a SUPERSCRIPT object from Org to HTML.
3280 CONTENTS is the contents of the object. INFO is a plist holding
3281 contextual information."
3282 (format "<sup>%s</sup>" contents))
3284 ;;;; Table Cell
3286 (defun org-html-table-cell (table-cell contents info)
3287 "Transcode a TABLE-CELL element from Org to HTML.
3288 CONTENTS is nil. INFO is a plist used as a communication
3289 channel."
3290 (let* ((table-row (org-export-get-parent table-cell))
3291 (table (org-export-get-parent-table table-cell))
3292 (cell-attrs
3293 (if (not (plist-get info :html-table-align-individual-fields)) ""
3294 (format (if (and (boundp 'org-html-format-table-no-css)
3295 org-html-format-table-no-css)
3296 " align=\"%s\"" " class=\"org-%s\"")
3297 (org-export-table-cell-alignment table-cell info)))))
3298 (when (or (not contents) (string= "" (org-trim contents)))
3299 (setq contents "&#xa0;"))
3300 (cond
3301 ((and (org-export-table-has-header-p table info)
3302 (= 1 (org-export-table-row-group table-row info)))
3303 (let ((header-tags (plist-get info :html-table-header-tags)))
3304 (concat "\n" (format (car header-tags) "col" cell-attrs)
3305 contents
3306 (cdr header-tags))))
3307 ((and (plist-get info :html-table-use-header-tags-for-first-column)
3308 (zerop (cdr (org-export-table-cell-address table-cell info))))
3309 (let ((header-tags (plist-get info :html-table-header-tags)))
3310 (concat "\n" (format (car header-tags) "row" cell-attrs)
3311 contents
3312 (cdr header-tags))))
3313 (t (let ((data-tags (plist-get info :html-table-data-tags)))
3314 (concat "\n" (format (car data-tags) cell-attrs)
3315 contents
3316 (cdr data-tags)))))))
3318 ;;;; Table Row
3320 (defun org-html-table-row (table-row contents info)
3321 "Transcode a TABLE-ROW element from Org to HTML.
3322 CONTENTS is the contents of the row. INFO is a plist used as a
3323 communication channel."
3324 ;; Rules are ignored since table separators are deduced from
3325 ;; borders of the current row.
3326 (when (eq (org-element-property :type table-row) 'standard)
3327 (let* ((group (org-export-table-row-group table-row info))
3328 (number (org-export-table-row-number table-row info))
3329 (start-group-p
3330 (org-export-table-row-starts-rowgroup-p table-row info))
3331 (end-group-p
3332 (org-export-table-row-ends-rowgroup-p table-row info))
3333 (topp (and (equal start-group-p '(top))
3334 (equal end-group-p '(below top))))
3335 (bottomp (and (equal start-group-p '(above))
3336 (equal end-group-p '(bottom above))))
3337 (row-open-tag
3338 (pcase (plist-get info :html-table-row-open-tag)
3339 ((and accessor (pred functionp))
3340 (funcall accessor
3341 number group start-group-p end-group-p topp bottomp))
3342 (accessor accessor)))
3343 (row-close-tag
3344 (pcase (plist-get info :html-table-row-close-tag)
3345 ((and accessor (pred functionp))
3346 (funcall accessor
3347 number group start-group-p end-group-p topp bottomp))
3348 (accessor accessor)))
3349 (group-tags
3350 (cond
3351 ;; Row belongs to second or subsequent groups.
3352 ((not (= 1 group)) '("<tbody>" . "\n</tbody>"))
3353 ;; Row is from first group. Table has >=1 groups.
3354 ((org-export-table-has-header-p
3355 (org-export-get-parent-table table-row) info)
3356 '("<thead>" . "\n</thead>"))
3357 ;; Row is from first and only group.
3358 (t '("<tbody>" . "\n</tbody>")))))
3359 (concat (and start-group-p (car group-tags))
3360 (concat "\n"
3361 row-open-tag
3362 contents
3363 "\n"
3364 row-close-tag)
3365 (and end-group-p (cdr group-tags))))))
3367 ;;;; Table
3369 (defun org-html-table-first-row-data-cells (table info)
3370 "Transcode the first row of TABLE.
3371 INFO is a plist used as a communication channel."
3372 (let ((table-row
3373 (org-element-map table 'table-row
3374 (lambda (row)
3375 (unless (eq (org-element-property :type row) 'rule) row))
3376 info 'first-match))
3377 (special-column-p (org-export-table-has-special-column-p table)))
3378 (if (not special-column-p) (org-element-contents table-row)
3379 (cdr (org-element-contents table-row)))))
3381 (defun org-html-table--table.el-table (table _info)
3382 "Format table.el tables into HTML.
3383 INFO is a plist used as a communication channel."
3384 (when (eq (org-element-property :type table) 'table.el)
3385 (require 'table)
3386 (let ((outbuf (with-current-buffer
3387 (get-buffer-create "*org-export-table*")
3388 (erase-buffer) (current-buffer))))
3389 (with-temp-buffer
3390 (insert (org-element-property :value table))
3391 (goto-char 1)
3392 (re-search-forward "^[ \t]*|[^|]" nil t)
3393 (table-generate-source 'html outbuf))
3394 (with-current-buffer outbuf
3395 (prog1 (org-trim (buffer-string))
3396 (kill-buffer) )))))
3398 (defun org-html-table (table contents info)
3399 "Transcode a TABLE element from Org to HTML.
3400 CONTENTS is the contents of the table. INFO is a plist holding
3401 contextual information."
3402 (case (org-element-property :type table)
3403 ;; Case 1: table.el table. Convert it using appropriate tools.
3404 (table.el (org-html-table--table.el-table table info))
3405 ;; Case 2: Standard table.
3407 (let* ((caption (org-export-get-caption table))
3408 (number (org-export-get-ordinal
3409 table info nil #'org-html--has-caption-p))
3410 (attributes
3411 (org-html--make-attribute-string
3412 (org-combine-plists
3413 (and (org-element-property :name table)
3414 (list :id (org-export-get-reference table info)))
3415 (and (not (org-html-html5-p info))
3416 (plist-get info :html-table-attributes))
3417 (org-export-read-attribute :attr_html table))))
3418 (alignspec
3419 (if (and (boundp 'org-html-format-table-no-css)
3420 org-html-format-table-no-css)
3421 "align=\"%s\"" "class=\"org-%s\""))
3422 (table-column-specs
3423 (function
3424 (lambda (table info)
3425 (mapconcat
3426 (lambda (table-cell)
3427 (let ((alignment (org-export-table-cell-alignment
3428 table-cell info)))
3429 (concat
3430 ;; Begin a colgroup?
3431 (when (org-export-table-cell-starts-colgroup-p
3432 table-cell info)
3433 "\n<colgroup>")
3434 ;; Add a column. Also specify its alignment.
3435 (format "\n%s"
3436 (org-html-close-tag
3437 "col" (concat " " (format alignspec alignment)) info))
3438 ;; End a colgroup?
3439 (when (org-export-table-cell-ends-colgroup-p
3440 table-cell info)
3441 "\n</colgroup>"))))
3442 (org-html-table-first-row-data-cells table info) "\n")))))
3443 (format "<table%s>\n%s\n%s\n%s</table>"
3444 (if (equal attributes "") "" (concat " " attributes))
3445 (if (not caption) ""
3446 (format (if (plist-get info :html-table-caption-above)
3447 "<caption class=\"t-above\">%s</caption>"
3448 "<caption class=\"t-bottom\">%s</caption>")
3449 (concat
3450 "<span class=\"table-number\">"
3451 (format (org-html--translate "Table %d:" info) number)
3452 "</span> " (org-export-data caption info))))
3453 (funcall table-column-specs table info)
3454 contents)))))
3456 ;;;; Target
3458 (defun org-html-target (target _contents info)
3459 "Transcode a TARGET object from Org to HTML.
3460 CONTENTS is nil. INFO is a plist holding contextual
3461 information."
3462 (let ((ref (org-export-get-reference target info)))
3463 (org-html--anchor ref nil nil info)))
3465 ;;;; Timestamp
3467 (defun org-html-timestamp (timestamp _contents info)
3468 "Transcode a TIMESTAMP object from Org to HTML.
3469 CONTENTS is nil. INFO is a plist holding contextual
3470 information."
3471 (let ((value (org-html-plain-text (org-timestamp-translate timestamp) info)))
3472 (format "<span class=\"timestamp-wrapper\"><span class=\"timestamp\">%s</span></span>"
3473 (replace-regexp-in-string "--" "&#x2013;" value))))
3475 ;;;; Underline
3477 (defun org-html-underline (_underline contents info)
3478 "Transcode UNDERLINE from Org to HTML.
3479 CONTENTS is the text with underline markup. INFO is a plist
3480 holding contextual information."
3481 (format (or (cdr (assq 'underline (plist-get info :html-text-markup-alist)))
3482 "%s")
3483 contents))
3485 ;;;; Verbatim
3487 (defun org-html-verbatim (verbatim _contents info)
3488 "Transcode VERBATIM from Org to HTML.
3489 CONTENTS is nil. INFO is a plist holding contextual
3490 information."
3491 (format (or (cdr (assq 'verbatim (plist-get info :html-text-markup-alist))) "%s")
3492 (org-html-encode-plain-text (org-element-property :value verbatim))))
3494 ;;;; Verse Block
3496 (defun org-html-verse-block (_verse-block contents info)
3497 "Transcode a VERSE-BLOCK element from Org to HTML.
3498 CONTENTS is verse block contents. INFO is a plist holding
3499 contextual information."
3500 ;; Replace each newline character with line break. Also replace
3501 ;; each blank line with a line break.
3502 (setq contents (replace-regexp-in-string
3503 "^ *\\\\\\\\$" (format "%s\n" (org-html-close-tag "br" nil info))
3504 (replace-regexp-in-string
3505 "\\(\\\\\\\\\\)?[ \t]*\n"
3506 (format "%s\n" (org-html-close-tag "br" nil info)) contents)))
3507 ;; Replace each white space at beginning of a line with a
3508 ;; non-breaking space.
3509 (while (string-match "^[ \t]+" contents)
3510 (let* ((num-ws (length (match-string 0 contents)))
3511 (ws (org-html--make-string num-ws "&#xa0;")))
3512 (setq contents (replace-match ws nil t contents))))
3513 (format "<p class=\"verse\">\n%s</p>" contents))
3516 ;;; Filter Functions
3518 (defun org-html-final-function (contents _backend info)
3519 "Filter to indent the HTML and convert HTML entities."
3520 (with-temp-buffer
3521 (insert contents)
3522 (set-auto-mode t)
3523 (if (plist-get info :html-indent)
3524 (indent-region (point-min) (point-max)))
3525 (buffer-substring-no-properties (point-min) (point-max))))
3528 ;;; End-user functions
3530 ;;;###autoload
3531 (defun org-html-export-as-html
3532 (&optional async subtreep visible-only body-only ext-plist)
3533 "Export current buffer to an HTML buffer.
3535 If narrowing is active in the current buffer, only export its
3536 narrowed part.
3538 If a region is active, export that region.
3540 A non-nil optional argument ASYNC means the process should happen
3541 asynchronously. The resulting buffer should be accessible
3542 through the `org-export-stack' interface.
3544 When optional argument SUBTREEP is non-nil, export the sub-tree
3545 at point, extracting information from the headline properties
3546 first.
3548 When optional argument VISIBLE-ONLY is non-nil, don't export
3549 contents of hidden elements.
3551 When optional argument BODY-ONLY is non-nil, only write code
3552 between \"<body>\" and \"</body>\" tags.
3554 EXT-PLIST, when provided, is a property list with external
3555 parameters overriding Org default settings, but still inferior to
3556 file-local settings.
3558 Export is done in a buffer named \"*Org HTML Export*\", which
3559 will be displayed when `org-export-show-temporary-export-buffer'
3560 is non-nil."
3561 (interactive)
3562 (org-export-to-buffer 'html "*Org HTML Export*"
3563 async subtreep visible-only body-only ext-plist
3564 (lambda () (set-auto-mode t))))
3566 ;;;###autoload
3567 (defun org-html-convert-region-to-html ()
3568 "Assume the current region has org-mode syntax, and convert it to HTML.
3569 This can be used in any buffer. For example, you can write an
3570 itemized list in org-mode syntax in an HTML buffer and use this
3571 command to convert it."
3572 (interactive)
3573 (org-export-replace-region-by 'html))
3575 ;;;###autoload
3576 (defun org-html-export-to-html
3577 (&optional async subtreep visible-only body-only ext-plist)
3578 "Export current buffer to a HTML file.
3580 If narrowing is active in the current buffer, only export its
3581 narrowed part.
3583 If a region is active, export that region.
3585 A non-nil optional argument ASYNC means the process should happen
3586 asynchronously. The resulting file should be accessible through
3587 the `org-export-stack' interface.
3589 When optional argument SUBTREEP is non-nil, export the sub-tree
3590 at point, extracting information from the headline properties
3591 first.
3593 When optional argument VISIBLE-ONLY is non-nil, don't export
3594 contents of hidden elements.
3596 When optional argument BODY-ONLY is non-nil, only write code
3597 between \"<body>\" and \"</body>\" tags.
3599 EXT-PLIST, when provided, is a property list with external
3600 parameters overriding Org default settings, but still inferior to
3601 file-local settings.
3603 Return output file's name."
3604 (interactive)
3605 (let* ((extension (concat "." (or (plist-get ext-plist :html-extension)
3606 org-html-extension
3607 "html")))
3608 (file (org-export-output-file-name extension subtreep))
3609 (org-export-coding-system org-html-coding-system))
3610 (org-export-to-file 'html file
3611 async subtreep visible-only body-only ext-plist)))
3613 ;;;###autoload
3614 (defun org-html-publish-to-html (plist filename pub-dir)
3615 "Publish an org file to HTML.
3617 FILENAME is the filename of the Org file to be published. PLIST
3618 is the property list for the given project. PUB-DIR is the
3619 publishing directory.
3621 Return output file name."
3622 (org-publish-org-to 'html filename
3623 (concat "." (or (plist-get plist :html-extension)
3624 org-html-extension
3625 "html"))
3626 plist pub-dir))
3629 (provide 'ox-html)
3631 ;; Local variables:
3632 ;; generated-autoload-file: "org-loaddefs.el"
3633 ;; End:
3635 ;;; ox-html.el ends here