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