1 ;;; org-html.el --- HTML export for Org-mode
3 ;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009
4 ;; Free Software Foundation, Inc.
6 ;; Author: Carsten Dominik <carsten at orgmode dot org>
7 ;; Keywords: outlines, hypermedia, calendar, wp
8 ;; Homepage: http://orgmode.org
11 ;; This file is part of GNU Emacs.
13 ;; GNU Emacs is free software: you can redistribute it and/or modify
14 ;; it under the terms of the GNU General Public License as published by
15 ;; the Free Software Foundation, either version 3 of the License, or
16 ;; (at your option) any later version.
18 ;; GNU Emacs is distributed in the hope that it will be useful,
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;; GNU General Public License for more details.
23 ;; You should have received a copy of the GNU General Public License
24 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
25 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
31 (declare-function org-id-find-id-file
"org-id" (id))
32 (declare-function htmlize-region
"ext:htmlize" (beg end
))
34 (defcustom org-export-html-footnotes-section
"<div id=\"footnotes\">
35 <h2 class=\"footnotes\">%s: </h2>
36 <div id=\"text-footnotes\">
40 "Format for the footnotes section.
41 Should contain a two instances of %s. The first will be replaced with the
42 language-specific word for \"Footnotes\", the second one will be replaced
43 by the footnotes themselves."
44 :group
'org-export-html
47 (defgroup org-export-html nil
48 "Options specific for HTML export of Org-mode files."
49 :tag
"Org Export HTML"
52 (defcustom org-export-html-coding-system nil
53 "Coding system for HTML export, defaults to buffer-file-coding-system."
54 :group
'org-export-html
57 (defcustom org-export-html-extension
"html"
58 "The extension for exported HTML files."
59 :group
'org-export-html
62 (defcustom org-export-html-xml-declaration
63 '(("html" .
"<?xml version=\"1.0\" encoding=\"%s\"?>")
64 ("php" .
"<?php echo \"<?xml version=\\\"1.0\\\" encoding=\\\"%s\\\" ?>\"; ?>"))
65 "The extension for exported HTML files.
66 %s will be replaced with the charset of the exported file.
67 This may be a string, or an alist with export extensions
68 and corresponding declarations."
69 :group
'org-export-html
71 (string :tag
"Single declaration")
72 (repeat :tag
"Dependent on extension"
73 (cons (string :tag
"Extension")
74 (string :tag
"Declaration")))))
76 (defcustom org-export-html-style-include-scripts t
77 "Non-nil means, include the javascript snippets in exported HTML files.
78 The actual script is defined in `org-export-html-scripts' and should
80 :group
'org-export-html
83 (defconst org-export-html-scripts
84 "<script type=\"text/javascript\">
85 <!--/*--><![CDATA[/*><!--*/
86 function CodeHighlightOn(elem, id)
88 var target = document.getElementById(id);
90 elem.cacheClassElem = elem.className;
91 elem.cacheClassTarget = target.className;
92 target.className = \"code-highlighted\";
93 elem.className = \"code-highlighted\";
96 function CodeHighlightOff(elem, id)
98 var target = document.getElementById(id);
99 if(elem.cacheClassElem)
100 elem.className = elem.cacheClassElem;
101 if(elem.cacheClassTarget)
102 target.className = elem.cacheClassTarget;
106 "Basic javascript that is needed by HTML files produced by Org-mode.")
108 (defconst org-export-html-style-default
109 "<style type=\"text/css\">
110 <!--/*--><![CDATA[/*><!--*/
111 html { font-family: Times, serif; font-size: 12pt; }
112 .title { text-align: center; }
113 .todo { color: red; }
114 .done { color: green; }
115 .tag { background-color: #add8e6; font-weight:normal }
117 .timestamp { color: #bebebe; }
118 .timestamp-kwd { color: #5f9ea0; }
119 p.verse { margin-left: 3% }
121 border: 1pt solid #AEBDCC;
122 background-color: #F3F5F7;
124 font-family: courier, monospace;
128 table { border-collapse: collapse; }
129 td, th { vertical-align: top; }
130 dt { font-weight: bold; }
131 div.figure { padding: 0.5em; }
132 div.figure p { text-align: center; }
133 .linenr { font-size:smaller }
134 .code-highlighted {background-color:#ffff00;}
135 .org-info-js_info-navigation { border-style:none; }
136 #org-info-js_console-label { font-size:10px; font-weight:bold;
137 white-space:nowrap; }
138 .org-info-js_search-highlight {background-color:#ffff00; color:#000000;
142 "The default style specification for exported HTML files.
143 Please use the variables `org-export-html-style' and
144 `org-export-html-style-extra' to add to this style. If you wish to not
145 have the default style included, customize the variable
146 `org-export-html-style-include-default'.")
148 (defcustom org-export-html-style-include-default t
149 "Non-nil means, include the default style in exported HTML files.
150 The actual style is defined in `org-export-html-style-default' and should
151 not be modified. Use the variables `org-export-html-style' to add
152 your own style information."
153 :group
'org-export-html
156 (put 'org-export-html-style
'safe-local-variable
'booleanp
)
158 (defcustom org-export-html-style
""
159 "Org-wide style definitions for exported HTML files.
161 This variable needs to contain the full HTML structure to provide a style,
162 including the surrounding HTML tags. If you set the value of this variable,
163 you should consider to include definitions for the following classes:
164 title, todo, done, timestamp, timestamp-kwd, tag, target.
166 For example, a valid value would be:
168 <style type=\"text/css\">
170 p { font-weight: normal; color: gray; }
172 .title { text-align: center; }
173 .todo, .timestamp-kwd { color: red; }
174 .done { color: green; }
178 If you'd like to refer to en external style file, use something like
180 <link rel=\"stylesheet\" type=\"text/css\" href=\"mystyles.css\">
182 As the value of this option simply gets inserted into the HTML <head> header,
183 you can \"misuse\" it to add arbitrary text to the header.
184 See also the variable `org-export-html-style-extra'."
185 :group
'org-export-html
188 (put 'org-export-html-style
'safe-local-variable
'stringp
)
190 (defcustom org-export-html-style-extra
""
191 "Additional style information for HTML export.
192 The value of this variable is inserted into the HTML buffer right after
193 the value of `org-export-html-style'. Use this variable for per-file
194 settings of style information, and do not forget to surround the style
195 settings with <style>...</style> tags."
196 :group
'org-export-html
199 (put 'org-export-html-style-extra
'safe-local-variable
'stringp
)
201 (defcustom org-export-html-tag-class-prefix
""
202 "Prefix to clas names for TODO keywords.
203 Each tag gets a class given by the tag itself, with this prefix.
204 The default prefix is empty because it is nice to just use the keyword
205 as a class name. But if you get into conflicts with other, existing
206 CSS classes, then this prefic can be very useful."
207 :group
'org-export-html
210 (defcustom org-export-html-todo-kwd-class-prefix
""
211 "Prefix to clas names for TODO keywords.
212 Each TODO keyword gets a class given by the keyword itself, with this prefix.
213 The default prefix is empty because it is nice to just use the keyword
214 as a class name. But if you get into conflicts with other, existing
215 CSS classes, then this prefic can be very useful."
216 :group
'org-export-html
219 (defcustom org-export-html-title-format
"<h1 class=\"title\">%s</h1>\n"
220 "Format for typesetting the document title in HTML export."
221 :group
'org-export-html
224 (defcustom org-export-html-toplevel-hlevel
2
225 "The <H> level for level 1 headings in HTML export.
226 This is also important for the classes that will be wrapped around headlines
227 and outline structure. If this variable is 1, the top-level headlines will
228 be <h1>, and the corresponding classes will be outline-1, section-number-1,
229 and outline-text-1. If this is 2, all of these will get a 2 instead.
230 The default for this variable is 2, because we use <h1> for formatting the
232 :group
'org-export-html
235 (defcustom org-export-html-link-org-files-as-html t
236 "Non-nil means, make file links to `file.org' point to `file.html'.
237 When org-mode is exporting an org-mode file to HTML, links to
238 non-html files are directly put into a href tag in HTML.
239 However, links to other Org-mode files (recognized by the
240 extension `.org.) should become links to the corresponding html
241 file, assuming that the linked org-mode file will also be
243 When nil, the links still point to the plain `.org' file."
244 :group
'org-export-html
247 (defcustom org-export-html-inline-images
'maybe
248 "Non-nil means, inline images into exported HTML pages.
249 This is done using an <img> tag. When nil, an anchor with href is used to
250 link to the image. If this option is `maybe', then images in links with
251 an empty description will be inlined, while images with a description will
253 :group
'org-export-html
254 :type
'(choice (const :tag
"Never" nil
)
255 (const :tag
"Always" t
)
256 (const :tag
"When there is no description" maybe
)))
258 (defcustom org-export-html-inline-image-extensions
259 '("png" "jpeg" "jpg" "gif")
260 "Extensions of image files that can be inlined into HTML."
261 :group
'org-export-html
262 :type
'(repeat (string :tag
"Extension")))
264 (defcustom org-export-html-table-tag
265 "<table border=\"2\" cellspacing=\"0\" cellpadding=\"6\" rules=\"groups\" frame=\"hsides\">"
266 "The HTML tag that is used to start a table.
267 This must be a <table> tag, but you may change the options like
268 borders and spacing."
269 :group
'org-export-html
272 (defcustom org-export-table-header-tags
'("<th scope=\"%s\">" .
"</th>")
273 "The opening tag for table header fields.
274 This is customizable so that alignment options can be specified.
275 %s will be filled with the scope of the field, either row or col.
276 See also the variable `org-export-html-table-use-header-tags-for-first-column'."
277 :group
'org-export-tables
278 :type
'(cons (string :tag
"Opening tag") (string :tag
"Closing tag")))
280 (defcustom org-export-table-data-tags
'("<td>" .
"</td>")
281 "The opening tag for table data fields.
282 This is customizable so that alignment options can be specified."
283 :group
'org-export-tables
284 :type
'(cons (string :tag
"Opening tag") (string :tag
"Closing tag")))
286 (defcustom org-export-table-row-tags
'("<tr>" .
"</tr>")
287 "The opening tag for table data fields.
288 This is customizable so that alignment options can be specified.
289 Instead of strings, these can be Lisp forms that will be evaluated
290 for each row in order to construct the table row tags. During evaluation,
291 the variable `head' will be true when this is a header line, nil when this
292 is a body line. And the variable `nline' will contain the line number,
293 starting from 1 in the first header line. For example
295 (setq org-export-table-row-tags
298 (if (= (mod nline 2) 1)
299 \"<tr class=\\\"tr-odd\\\">\"
300 \"<tr class=\\\"tr-even\\\">\"))
303 will give even lines the class \"tr-even\" and odd lines the class \"tr-odd\"."
304 :group
'org-export-tables
306 (choice :tag
"Opening tag"
307 (string :tag
"Specify")
309 (choice :tag
"Closing tag"
310 (string :tag
"Specify")
315 (defcustom org-export-html-table-use-header-tags-for-first-column nil
316 "Non-nil means, format column one in tables with header tags.
317 When nil, also column one will use data tags."
318 :group
'org-export-tables
321 (defcustom org-export-html-validation-link nil
322 "Non-nil means, add validationlink to postamble of HTML exported files."
323 :group
'org-export-html
325 (const :tag
"Nothing" nil
)
326 (const :tag
"XHTML 1.0" "<p class=\"xhtml-validation\"><a href=\"http://validator.w3.org/check?uri=referer\">Validate XHTML 1.0</a></p>")
327 (string :tag
"Specify full HTML")))
330 (defcustom org-export-html-with-timestamp nil
331 "If non-nil, write `org-export-html-html-helper-timestamp'
332 into the exported HTML text. Otherwise, the buffer will just be saved
334 :group
'org-export-html
337 (defcustom org-export-html-html-helper-timestamp
338 "<br/><br/><hr><p><!-- hhmts start --> <!-- hhmts end --></p>\n"
339 "The HTML tag used as timestamp delimiter for HTML-helper-mode."
340 :group
'org-export-html
343 (defgroup org-export-htmlize nil
344 "Options for processing examples with htmlize.el."
345 :tag
"Org Export Htmlize"
346 :group
'org-export-html
)
348 (defcustom org-export-htmlize-output-type
'inline-css
349 "Output type to be used by htmlize when formatting code snippets.
350 We use as default `inline-css', in order to make the resulting
351 HTML self-containing.
352 However, this will fail when using Emacs in batch mode for export, because
353 then no rich font definitions are in place. It will also not be good if
354 people with different Emacs setup contribute HTML files to a website,
355 because the fonts will represent the individual setups. In these cases,
356 it is much better to let Org/Htmlize assign classes only, and to use
357 a style file to define the look of these classes.
358 To get a start for your css file, start Emacs session nnd make sure that
359 all the faces you are interested in are defined, for example by loading files
360 in all modes you want. Then, use the command
361 \\[org-export-htmlize-generate-css] to extract class definitions."
362 :group
'org-export-htmlize
363 :type
'(choice (const css
) (const inline-css
)))
365 (defcustom org-export-htmlize-css-font-prefix
"org-"
366 "The prefix for CSS class names for htmlize font specifications."
367 :group
'org-export-htmlize
370 (defcustom org-export-htmlized-org-css-url nil
371 "URL pointing to a CSS file defining text colors for htmlized Emacs buffers.
372 Normally when creating an htmlized version of an Org buffer, htmlize will
373 create CSS to define the font colors. However, this does not work when
374 converting in batch mode, and it also can look bad if different people
375 with different fontification setup work on the same website.
376 When this variable is non-nil, creating an htmlized version of an Org buffer
377 using `org-export-as-org' will remove the internal CSS section and replace it
378 with a link to this URL."
379 :group
'org-export-htmlize
381 (const :tag
"Keep internal css" nil
)
382 (string :tag
"URL or local href")))
384 ;;; Variables, constants, and parameter plists
386 (defvar org-export-html-preamble nil
387 "Preamble, to be inserted just before <body>. Set by publishing functions.")
388 (defvar org-export-html-postamble nil
389 "Preamble, to be inserted just after </body>. Set by publishing functions.")
390 (defvar org-export-html-auto-preamble t
391 "Should default preamble be inserted? Set by publishing functions.")
392 (defvar org-export-html-auto-postamble t
393 "Should default postamble be inserted? Set by publishing functions.")
397 (defvar org-export-html-after-blockquotes-hook nil
398 "Hook run during HTML export, after blockquote, verse, center are done.")
402 (defun org-export-html-preprocess (parameters)
403 ;; Convert LaTeX fragments to images
404 (when (and org-current-export-file
405 (plist-get parameters
:LaTeX-fragments
))
407 (concat "ltxpng/" (file-name-sans-extension
408 (file-name-nondirectory
409 org-current-export-file
)))
410 org-current-export-dir nil
"Creating LaTeX image %s"))
411 (message "Exporting..."))
414 (defun org-export-as-html-and-open (arg)
415 "Export the outline as HTML and immediately open it with a browser.
416 If there is an active region, export only the region.
417 The prefix ARG specifies how many levels of the outline should become
418 headlines. The default is 3. Lower levels will become bulleted lists."
420 (org-export-as-html arg
'hidden
)
421 (org-open-file buffer-file-name
))
424 (defun org-export-as-html-batch ()
425 "Call `org-export-as-html', may be used in batch processing as
427 --load=$HOME/lib/emacs/org.el
428 --eval \"(setq org-export-headline-levels 2)\"
429 --visit=MyFile --funcall org-export-as-html-batch"
430 (org-export-as-html org-export-headline-levels
'hidden
))
433 (defun org-export-as-html-to-buffer (arg)
434 "Call `org-export-as-html` with output to a temporary buffer.
435 No file is created. The prefix ARG is passed through to `org-export-as-html'."
437 (org-export-as-html arg nil nil
"*Org HTML Export*")
438 (when org-export-show-temporary-export-buffer
439 (switch-to-buffer-other-window "*Org HTML Export*")))
442 (defun org-replace-region-by-html (beg end
)
443 "Assume the current region has org-mode syntax, and convert it to HTML.
444 This can be used in any buffer. For example, you could write an
445 itemized list in org-mode syntax in an HTML buffer and then use this
446 command to convert it."
448 (let (reg html buf pop-up-frames
)
449 (save-window-excursion
451 (setq html
(org-export-region-as-html
453 (setq reg
(buffer-substring beg end
)
454 buf
(get-buffer-create "*Org tmp*"))
455 (with-current-buffer buf
459 (setq html
(org-export-region-as-html
460 (point-min) (point-max) t
'string
)))
462 (delete-region beg end
)
466 (defun org-export-region-as-html (beg end
&optional body-only buffer
)
467 "Convert region from BEG to END in org-mode buffer to HTML.
468 If prefix arg BODY-ONLY is set, omit file header, footer, and table of
469 contents, and only produce the region of converted text, useful for
470 cut-and-paste operations.
471 If BUFFER is a buffer or a string, use/create that buffer as a target
472 of the converted HTML. If BUFFER is the symbol `string', return the
473 produced HTML as a string and leave not buffer behind. For example,
474 a Lisp program could call this function in the following way:
476 (setq html (org-export-region-as-html beg end t 'string))
478 When called interactively, the output buffer is selected, and shown
479 in a window. A non-interactive call will only return the buffer."
481 (when (interactive-p)
482 (setq buffer
"*Org HTML Export*"))
483 (let ((transient-mark-mode t
) (zmacs-regions t
)
485 (setq ext-plist
(plist-put ext-plist
:ignore-subree-p t
))
487 (set-mark (point)) ;; to activate the region
489 (setq rtn
(org-export-as-html
492 (if (fboundp 'deactivate-mark
) (deactivate-mark))
493 (if (and (interactive-p) (bufferp rtn
))
494 (switch-to-buffer-other-window rtn
)
497 (defvar html-table-tag nil
) ; dynamically scoped into this.
498 (defvar org-par-open nil
)
500 (defun org-export-as-html (arg &optional hidden ext-plist
501 to-buffer body-only pub-dir
)
502 "Export the outline as a pretty HTML file.
503 If there is an active region, export only the region. The prefix
504 ARG specifies how many levels of the outline should become
505 headlines. The default is 3. Lower levels will become bulleted
506 lists. HIDDEN is obsolete and does nothing.
507 EXT-PLIST is a property list with external parameters overriding
508 org-mode's default settings, but still inferior to file-local
509 settings. When TO-BUFFER is non-nil, create a buffer with that
510 name and export to that buffer. If TO-BUFFER is the symbol
511 `string', don't leave any buffer behind but just return the
512 resulting HTML as a string. When BODY-ONLY is set, don't produce
513 the file header and footer, simply return the content of
514 <body>...</body>, without even the body tags themselves. When
515 PUB-DIR is set, use this as the publishing directory."
518 ;; Make sure we have a file name when we need it.
519 (when (and (not (or to-buffer body-only
))
520 (not buffer-file-name
))
521 (if (buffer-base-buffer)
522 (org-set-local 'buffer-file-name
523 (with-current-buffer (buffer-base-buffer)
525 (error "Need a file name to be able to export.")))
527 (message "Exporting...")
528 (setq-default org-todo-line-regexp org-todo-line-regexp
)
529 (setq-default org-deadline-line-regexp org-deadline-line-regexp
)
530 (setq-default org-done-keywords org-done-keywords
)
531 (setq-default org-maybe-keyword-time-regexp org-maybe-keyword-time-regexp
)
533 (org-export-process-option-filters
534 (org-combine-plists (org-default-export-plist)
536 (org-infile-export-plist))))
537 (body-only (or body-only
(plist-get opt-plist
:body-only
)))
538 (style (concat (if (plist-get opt-plist
:style-include-default
)
539 org-export-html-style-default
)
540 (plist-get opt-plist
:style
)
541 (plist-get opt-plist
:style-extra
)
543 (if (plist-get opt-plist
:style-include-scripts
)
544 org-export-html-scripts
)))
545 (html-extension (plist-get opt-plist
:html-extension
))
546 (link-validate (plist-get opt-plist
:link-validation-function
))
547 valid thetoc have-headings first-heading-pos
548 (odd org-odd-levels-only
)
549 (region-p (org-region-active-p))
550 (rbeg (and region-p
(region-beginning)))
551 (rend (and region-p
(region-end)))
553 (if (plist-get opt-plist
:ignore-subree-p
)
558 (and (org-at-heading-p)
559 (>= (org-end-of-subtree t t
) rend
))))))
560 (level-offset (if subtree-p
563 (+ (funcall outline-level
)
564 (if org-odd-levels-only
1 0)))
566 (opt-plist (setq org-export-opt-plist
568 (org-export-add-subtree-options opt-plist rbeg
)
570 ;; The following two are dynamically scoped into other
572 (org-current-export-dir
573 (or pub-dir
(org-export-directory :html opt-plist
)))
574 (org-current-export-file buffer-file-name
)
575 (level 0) (line "") (origline "") txt todo
578 (filename (if to-buffer nil
581 (file-name-sans-extension
583 (org-entry-get (region-beginning)
584 "EXPORT_FILE_NAME" t
))
585 (file-name-nondirectory buffer-file-name
)))
587 (file-name-as-directory
588 (or pub-dir
(org-export-directory :html opt-plist
))))))
589 (current-dir (if buffer-file-name
590 (file-name-directory buffer-file-name
)
592 (buffer (if to-buffer
594 ((eq to-buffer
'string
) (get-buffer-create "*Org HTML Export*"))
595 (t (get-buffer-create to-buffer
)))
596 (find-file-noselect filename
)))
597 (org-levels-open (make-vector org-level-max nil
))
598 (date (plist-get opt-plist
:date
))
599 (author (plist-get opt-plist
:author
))
600 (title (or (and subtree-p
(org-export-get-title-from-subtree))
601 (plist-get opt-plist
:title
)
603 (plist-get opt-plist
:skip-before-1st-heading
))
604 (org-export-grab-title-from-buffer))
605 (and buffer-file-name
606 (file-name-sans-extension
607 (file-name-nondirectory buffer-file-name
)))
609 (html-table-tag (plist-get opt-plist
:html-table-tag
))
610 (quote-re0 (concat "^[ \t]*" org-quote-string
"\\>"))
611 (quote-re (concat "^\\(\\*+\\)\\([ \t]+" org-quote-string
"\\>\\)"))
616 (local-list-type nil
)
617 (local-list-indent nil
)
618 (llt org-plain-list-ordered-item-terminator
)
619 (email (plist-get opt-plist
:email
))
620 (language (plist-get opt-plist
:language
))
621 (keywords (plist-get opt-plist
:keywords
))
622 (description (plist-get opt-plist
:description
))
626 (coding-system (and (boundp 'buffer-file-coding-system
)
627 buffer-file-coding-system
))
628 (coding-system-for-write (or org-export-html-coding-system
630 (save-buffer-coding-system (or org-export-html-coding-system
632 (charset (and coding-system-for-write
633 (fboundp 'coding-system-get
)
634 (coding-system-get coding-system-for-write
638 (if region-p
(region-beginning) (point-min))
639 (if region-p
(region-end) (point-max))))
642 (org-export-preprocess-string
646 :skip-before-1st-heading
647 (plist-get opt-plist
:skip-before-1st-heading
)
648 :drawers
(plist-get opt-plist
:drawers
)
649 :todo-keywords
(plist-get opt-plist
:todo-keywords
)
650 :tags
(plist-get opt-plist
:tags
)
651 :priority
(plist-get opt-plist
:priority
)
652 :footnotes
(plist-get opt-plist
:footnotes
)
653 :timestamps
(plist-get opt-plist
:timestamps
)
655 (plist-get opt-plist
:archived-trees
)
656 :select-tags
(plist-get opt-plist
:select-tags
)
657 :exclude-tags
(plist-get opt-plist
:exclude-tags
)
659 (plist-get opt-plist
:text
)
661 (plist-get opt-plist
:LaTeX-fragments
))
664 table-buffer table-orig-buffer
665 ind item-type starter didclose
666 rpl path attr desc descp desc1 desc2 link
668 footnotes footref-seen
672 (let ((inhibit-read-only t
))
674 (remove-text-properties (point-min) (point-max)
675 '(:org-license-to-kill t
))))
677 (message "Exporting...")
679 (setq org-min-level
(org-get-min-level lines level-offset
))
680 (setq org-last-level org-min-level
)
681 (org-init-section-numbers)
684 ((and date
(string-match "%" date
))
685 (setq date
(format-time-string date
)))
687 (t (setq date
(format-time-string "%Y-%m-%d %T %Z"))))
689 ;; Get the language-dependent settings
690 (setq lang-words
(or (assoc language org-export-language-setup
)
691 (assoc "en" org-export-language-setup
)))
693 ;; Switch to the output buffer
695 (let ((inhibit-read-only t
)) (erase-buffer))
698 (and (fboundp 'set-buffer-file-coding-system
)
699 (set-buffer-file-coding-system coding-system-for-write
))
701 (let ((case-fold-search nil
)
702 (org-odd-levels-only odd
))
703 ;; create local variables for all options, to make sure all called
704 ;; functions get the correct information
706 (set (make-local-variable (nth 2 x
))
707 (plist-get opt-plist
(car x
))))
708 org-export-plist-vars
)
709 (setq umax
(if arg
(prefix-numeric-value arg
)
710 org-export-headline-levels
))
711 (setq umax-toc
(if (integerp org-export-with-toc
)
712 (min org-export-with-toc umax
)
718 <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"
719 \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">
720 <html xmlns=\"http://www.w3.org/1999/xhtml\"
721 lang=\"%s\" xml:lang=\"%s\">
724 <meta http-equiv=\"Content-Type\" content=\"text/html;charset=%s\"/>
725 <meta name=\"generator\" content=\"Org-mode\"/>
726 <meta name=\"generated\" content=\"%s\"/>
727 <meta name=\"author\" content=\"%s\"/>
728 <meta name=\"description\" content=\"%s\"/>
729 <meta name=\"keywords\" content=\"%s\"/>
736 (or (and (stringp org-export-html-xml-declaration
)
737 org-export-html-xml-declaration
)
738 (cdr (assoc html-extension org-export-html-xml-declaration
))
739 (cdr (assoc "html" org-export-html-xml-declaration
))
742 (or charset
"iso-8859-1"))
743 language language
(org-html-expand title
)
744 (or charset
"iso-8859-1")
745 date author description keywords
748 (insert (or (plist-get opt-plist
:preamble
) ""))
750 (when (plist-get opt-plist
:auto-preamble
)
751 (if title
(insert (format org-export-html-title-format
752 (org-html-expand title
))))))
754 (if (and org-export-with-toc
(not body-only
))
756 (push (format "<h%d>%s</h%d>\n"
757 org-export-html-toplevel-hlevel
759 org-export-html-toplevel-hlevel
)
761 (push "<div id=\"text-table-of-contents\">\n" thetoc
)
762 (push "<ul>\n<li>" thetoc
)
764 (mapcar '(lambda (line)
765 (if (string-match org-todo-line-regexp line
)
766 ;; This is a headline
768 (setq have-headings t
)
769 (setq level
(- (match-end 1) (match-beginning 1)
771 level
(org-tr-level level
)
774 (org-export-cleanup-toc-line
775 (match-string 3 line
))))
777 (or (and org-export-mark-todo-in-toc
779 (not (member (match-string 2 line
)
782 (and org-export-mark-todo-in-toc
784 (org-search-todo-below
787 (org-re "[ \t]+:\\([[:alnum:]_@:]+\\):[ \t]*$") txt
)
788 (setq txt
(replace-match " <span class=\"tag\"> \\1</span>" t nil txt
)))
789 (if (string-match quote-re0 txt
)
790 (setq txt
(replace-match "" t t txt
)))
791 (setq snumber
(org-section-number level
))
792 (if org-export-with-section-numbers
793 (setq txt
(concat snumber
" " txt
)))
794 (if (<= level
(max umax umax-toc
))
795 (setq head-count
(+ head-count
1)))
796 (if (<= level umax-toc
)
798 (if (> level org-last-level
)
800 (setq cnt
(- level org-last-level
))
801 (while (>= (setq cnt
(1- cnt
)) 0)
802 (push "\n<ul>\n<li>" thetoc
))
804 (if (< level org-last-level
)
806 (setq cnt
(- org-last-level level
))
807 (while (>= (setq cnt
(1- cnt
)) 0)
808 (push "</li>\n</ul>" thetoc
))
811 (while (string-match org-any-target-regexp line
)
812 (setq line
(replace-match
813 (concat "@<span class=\"target\">" (match-string 1 line
) "@</span> ")
815 (while (string-match "<\\(<\\)+\\|>\\(>\\)+" txt
)
816 (setq txt
(replace-match "" t t txt
)))
817 (setq href
(format "sec-%s" snumber
))
818 (setq href
(or (cdr (assoc href org-export-preferred-target-alist
)) href
))
822 "</li>\n<li><a href=\"#%s\"><span class=\"todo\">%s</span></a>"
823 "</li>\n<li><a href=\"#%s\">%s</a>")
826 (setq org-last-level level
))
830 (while (> org-last-level
(1- org-min-level
))
831 (setq org-last-level
(1- org-last-level
))
832 (push "</li>\n</ul>\n" thetoc
))
833 (push "</div>\n" thetoc
)
834 (setq thetoc
(if have-headings
(nreverse thetoc
) nil
))))
837 (org-init-section-numbers)
841 (while (setq line
(pop lines
) origline line
)
844 ;; end of quote section?
845 (when (and inquote
(string-match "^\\*+ " line
))
849 ;; inside a quote section?
851 (insert (org-html-protect line
) "\n")
852 (throw 'nextline nil
))
854 ;; Fixed-width, verbatim lines (examples)
855 (when (and org-export-with-fixed-width
856 (string-match "^[ \t]*:\\(\\([ \t]\\|$\\)\\(.*\\)\\)" line
))
859 (org-close-par-maybe)
861 (insert "<pre class=\"example\">\n"))
862 (insert (org-html-protect (match-string 3 line
)) "\n")
863 (when (or (not lines
)
864 (not (string-match "^[ \t]*:\\(\\([ \t]\\|$\\)\\(.*\\)\\)"
869 (throw 'nextline nil
))
871 (org-export-html-close-lists-maybe line
)
874 (when (get-text-property 0 'org-protected line
)
875 (let (par (ind (get-text-property 0 'original-indentation line
)))
876 (when (re-search-backward
877 "\\(<p>\\)\\([ \t\r\n]*\\)\\=" (- (point) 100) t
)
878 (setq par
(match-string 1))
879 (replace-match "\\2\n"))
882 (or (= (length (car lines
)) 0)
884 (equal ind
(get-text-property 0 'original-indentation
(car lines
))))
885 (or (= (length (car lines
)) 0)
886 (get-text-property 0 'org-protected
(car lines
))))
887 (insert (pop lines
) "\n"))
888 (and par
(insert "<p>\n")))
889 (throw 'nextline nil
))
892 (when (string-match "^[ \t]*-\\{5,\\}[ \t]*$" line
)
894 (insert "\n</p>\n<hr/>\n<p>\n")
895 (insert "\n<hr/>\n"))
896 (throw 'nextline nil
))
898 ;; Blockquotes, verse, and center
899 (when (equal "ORG-BLOCKQUOTE-START" line
)
900 (org-close-par-maybe)
901 (insert "<blockquote>\n")
903 (throw 'nextline nil
))
904 (when (equal "ORG-BLOCKQUOTE-END" line
)
905 (org-close-par-maybe)
906 (insert "\n</blockquote>\n")
908 (throw 'nextline nil
))
909 (when (equal "ORG-VERSE-START" line
)
910 (org-close-par-maybe)
911 (insert "\n<p class=\"verse\">\n")
913 (throw 'nextline nil
))
914 (when (equal "ORG-VERSE-END" line
)
918 (throw 'nextline nil
))
919 (when (equal "ORG-CENTER-START" line
)
920 (org-close-par-maybe)
921 (insert "\n<div style=\"text-align: center\">")
923 (throw 'nextline nil
))
924 (when (equal "ORG-CENTER-END" line
)
925 (org-close-par-maybe)
928 (throw 'nextline nil
))
929 (run-hooks 'org-export-html-after-blockquotes-hook
)
931 (let ((i (org-get-string-indentation line
)))
933 (setq line
(concat (mapconcat 'identity
934 (make-list (* 2 i
) "\\nbsp") "")
935 " " (org-trim line
))))
936 (unless (string-match "\\\\\\\\[ \t]*$" line
)
937 (setq line
(concat line
"\\\\")))))
939 ;; make targets to anchors
941 "<<<?\\([^<>]*\\)>>>?\\((INVISIBLE)\\)?[ \t]*\n?" line
)
944 (setq line
(replace-match
946 "@<a name=\"%s\" id=\"%s\">@</a>"
947 (org-solidify-link-text (match-string 1 line
))
948 (org-solidify-link-text (match-string 1 line
)))
950 ((and org-export-with-toc
(equal (string-to-char line
) ?
*))
951 ;; FIXME: NOT DEPENDENT on TOC?????????????????????
952 (setq line
(replace-match
953 (concat "@<span class=\"target\">" (match-string 1 line
) "@</span> ")
954 ; (concat "@<i>" (match-string 1 line) "@</i> ")
957 (setq line
(replace-match
958 (concat "@<a name=\""
959 (org-solidify-link-text (match-string 1 line
))
960 "\" class=\"target\">" (match-string 1 line
) "@</a> ")
963 (setq line
(org-html-handle-time-stamps line
))
965 ;; replace "&" by "&", "<" and ">" by "<" and ">"
966 ;; handle @<..> HTML tags (replace "@>..<" by "<..>")
967 ;; Also handle sub_superscripts and checkboxes
968 (or (string-match org-table-hline-regexp line
)
969 (setq line
(org-html-expand line
)))
973 (while (string-match org-bracket-link-analytic-regexp
++ line start
)
974 (setq start
(match-beginning 0))
975 (setq path
(save-match-data (org-link-unescape
976 (match-string 3 line
))))
978 ((match-end 2) (match-string 2 line
))
980 (or (file-name-absolute-p path
)
981 (string-match "^\\.\\.?/" path
)))
984 (setq path
(org-extract-attributes (org-link-unescape path
)))
985 (setq attr
(get-text-property 0 'org-attributes path
))
986 (setq desc1
(if (match-end 5) (match-string 5 line
))
987 desc2
(if (match-end 2) (concat type
":" path
) path
)
988 descp
(and desc1
(not (equal desc1 desc2
)))
989 desc
(or desc1 desc2
))
990 ;; Make an image out of the description if that is so wanted
991 (when (and descp
(org-file-image-p
992 desc org-export-html-inline-image-extensions
))
994 (if (string-match "^file:" desc
)
995 (setq desc
(substring desc
(match-end 0)))))
996 (setq desc
(org-add-props
997 (concat "<img src=\"" desc
"\"/>")
998 '(org-protected t
))))
999 ;; FIXME: do we need to unescape here somewhere?
1001 ((equal type
"internal")
1005 (if (= (string-to-char path
) ?
#) "" "#")
1006 (org-solidify-link-text
1007 (save-match-data (org-link-unescape path
)) nil
)
1009 (org-export-html-format-desc desc
)
1011 ((and (equal type
"id")
1012 (setq id-file
(org-id-find-id-file path
)))
1013 ;; This is an id: link to another file (if it was the same file,
1014 ;; it would have become an internal link...)
1016 (setq id-file
(file-relative-name
1017 id-file
(file-name-directory org-current-export-file
)))
1018 (setq id-file
(concat (file-name-sans-extension id-file
)
1019 "." html-extension
))
1020 (setq rpl
(concat "<a href=\"" id-file
"#"
1021 (if (org-uuidgen-p path
) "ID-")
1024 (org-export-html-format-desc desc
)
1026 ((member type
'("http" "https"))
1027 ;; standard URL, just check if we need to inline an image
1028 (if (and (or (eq t org-export-html-inline-images
)
1029 (and org-export-html-inline-images
(not descp
)))
1031 path org-export-html-inline-image-extensions
))
1032 (setq rpl
(org-export-html-format-image
1033 (concat type
":" path
) org-par-open
))
1034 (setq link
(concat type
":" path
))
1035 (setq rpl
(concat "<a href=\""
1036 (org-export-html-format-href link
)
1038 (org-export-html-format-desc desc
)
1040 ((member type
'("ftp" "mailto" "news"))
1042 (setq link
(concat type
":" path
))
1043 (setq rpl
(concat "<a href=\""
1044 (org-export-html-format-href link
)
1046 (org-export-html-format-desc desc
)
1049 ((string= type
"coderef")
1050 (setq rpl
(format "<a href=\"#coderef-%s\" class=\"coderef\" onmouseover=\"CodeHighlightOn(this, 'coderef-%s');\" onmouseout=\"CodeHighlightOff(this, 'coderef-%s');\">%s</a>"
1052 (format (org-export-get-coderef-format path
(and descp desc
))
1053 (cdr (assoc path org-export-code-refs
))))))
1055 ((functionp (setq fnc
(nth 2 (assoc type org-link-protocols
))))
1056 ;; The link protocol has a function for format the link
1059 (funcall fnc
(org-link-unescape path
) desc1
'html
))))
1061 ((string= type
"file")
1063 (let* ((filename path
)
1064 (abs-p (file-name-absolute-p filename
))
1065 thefile file-is-image-p search
)
1067 (if (string-match "::\\(.*\\)" filename
)
1068 (setq search
(match-string 1 filename
)
1069 filename
(replace-match "" t nil filename
)))
1071 (if (functionp link-validate
)
1072 (funcall link-validate filename current-dir
)
1074 (setq file-is-image-p
1076 filename org-export-html-inline-image-extensions
))
1077 (setq thefile
(if abs-p
(expand-file-name filename
) filename
))
1078 (when (and org-export-html-link-org-files-as-html
1079 (string-match "\\.org$" thefile
))
1080 (setq thefile
(concat (substring thefile
0
1081 (match-beginning 0))
1082 "." html-extension
))
1084 ;; make sure this is can be used as target search
1085 (not (string-match "^[0-9]*$" search
))
1086 (not (string-match "^\\*" search
))
1087 (not (string-match "^/.*/$" search
)))
1088 (setq thefile
(concat thefile
"#"
1089 (org-solidify-link-text
1090 (org-link-unescape search
)))))
1091 (when (string-match "^file:" desc
)
1092 (setq desc
(replace-match "" t t desc
))
1093 (if (string-match "\\.org$" desc
)
1094 (setq desc
(replace-match "" t t desc
))))))
1095 (setq rpl
(if (and file-is-image-p
1096 (or (eq t org-export-html-inline-images
)
1097 (and org-export-html-inline-images
1100 (message "image %s %s" thefile org-par-open
)
1101 (org-export-html-format-image thefile org-par-open
))
1102 (concat "<a href=\"" thefile
"\"" attr
">"
1103 (org-export-html-format-desc desc
)
1105 (if (not valid
) (setq rpl desc
))))
1108 ;; just publish the path, as default
1109 (setq rpl
(concat "<i><" type
":"
1110 (save-match-data (org-link-unescape path
))
1112 (setq line
(replace-match rpl t t line
)
1113 start
(+ start
(length rpl
))))
1116 (if (and (string-match org-todo-line-regexp line
)
1117 (match-beginning 2))
1120 (concat (substring line
0 (match-beginning 2))
1122 (if (member (match-string 2 line
)
1125 " " (match-string 2 line
)
1126 "\"> " (org-export-html-get-todo-kwd-class-name
1127 (match-string 2 line
))
1128 "</span>" (substring line
(match-end 2)))))
1130 ;; Does this contain a reference to a footnote?
1131 (when org-export-with-footnotes
1133 (while (string-match "\\([^* \t].*?\\)\\[\\([0-9]+\\)\\]" line start
)
1134 (if (get-text-property (match-beginning 2) 'org-protected line
)
1135 (setq start
(match-end 2))
1136 (let ((n (match-string 2 line
)) extra a
)
1137 (if (setq a
(assoc n footref-seen
))
1139 (setcdr a
(1+ (cdr a
)))
1140 (setq extra
(format ".%d" (cdr a
))))
1142 (push (cons n
1) footref-seen
))
1146 "%s<sup><a class=\"footref\" name=\"fnr.%s%s\" href=\"#fn.%s\">%s</a></sup>"
1147 (match-string 1 line
) n extra n n
)
1151 ((string-match "^\\(\\*+\\)[ \t]+\\(.*\\)" line
)
1152 ;; This is a headline
1153 (setq level
(org-tr-level (- (match-end 1) (match-beginning 1)
1155 txt
(match-string 2 line
))
1156 (if (string-match quote-re0 txt
)
1157 (setq txt
(replace-match "" t t txt
)))
1158 (if (<= level
(max umax umax-toc
))
1159 (setq head-count
(+ head-count
1)))
1161 ;; Close any local lists before inserting a new header line
1162 (while local-list-type
1163 (org-close-li (car local-list-type
))
1164 (insert (format "</%sl>\n" (car local-list-type
)))
1165 (pop local-list-type
))
1166 (setq local-list-indent nil
1168 (setq first-heading-pos
(or first-heading-pos
(point)))
1169 (org-html-level-start level txt umax
1170 (and org-export-with-toc
(<= level umax
))
1174 (when (string-match quote-re line
)
1175 (org-close-par-maybe)
1179 ((string-match "^[ \t]*- __+[ \t]*$" line
)
1180 ;; Explicit list closure
1181 (when local-list-type
1182 (let ((ind (org-get-indentation line
)))
1183 (while (and local-list-indent
1184 (<= ind
(car local-list-indent
)))
1185 (org-close-li (car local-list-type
))
1186 (insert (format "</%sl>\n" (car local-list-type
)))
1187 (pop local-list-type
)
1188 (pop local-list-indent
))
1189 (or local-list-indent
(setq in-local-list nil
))))
1190 (throw 'nextline nil
))
1192 ((and org-export-with-tables
1193 (string-match "^\\([ \t]*\\)\\(|\\|\\+-+\\+\\)" line
))
1194 (when (not table-open
)
1196 (setq table-open t table-buffer nil table-orig-buffer nil
))
1199 (setq table-buffer
(cons line table-buffer
)
1200 table-orig-buffer
(cons origline table-orig-buffer
))
1201 (when (or (not lines
)
1202 (not (string-match "^\\([ \t]*\\)\\(|\\|\\+-+\\+\\)"
1204 (setq table-open nil
1205 table-buffer
(nreverse table-buffer
)
1206 table-orig-buffer
(nreverse table-orig-buffer
))
1207 (org-close-par-maybe)
1208 (insert (org-format-table-html table-buffer table-orig-buffer
))))
1213 ((eq llt t
) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\([0-9]+[.)]\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)")
1214 ((= llt ?.
) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\([0-9]+\\.\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)")
1215 ((= llt ?\
)) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\([0-9]+)\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)")
1216 (t (error "Invalid value of `org-plain-list-ordered-item-terminator'")))
1218 (setq ind
(or (get-text-property 0 'original-indentation line
)
1219 (org-get-string-indentation line
))
1220 item-type
(if (match-beginning 4) "o" "u")
1221 starter
(if (match-beginning 2)
1222 (substring (match-string 2 line
) 0 -
1))
1223 line
(substring line
(match-beginning 5))
1225 (if (and starter
(string-match "\\(.*?\\) ::[ \t]*" line
))
1227 item-tag
(match-string 1 line
)
1228 line
(substring line
(match-end 0))))
1229 (when (and (not (equal item-type
"d"))
1230 (not (string-match "[^ \t]" line
)))
1231 ;; empty line. Pretend indentation is large.
1232 (setq ind
(if org-empty-line-terminates-plain-lists
1234 (1+ (or (car local-list-indent
) 1)))))
1236 (while (and in-local-list
1237 (or (and (= ind
(car local-list-indent
))
1239 (< ind
(car local-list-indent
))))
1241 (org-close-li (car local-list-type
))
1242 (insert (format "</%sl>\n" (car local-list-type
)))
1243 (pop local-list-type
) (pop local-list-indent
)
1244 (setq in-local-list local-list-indent
))
1247 (or (not in-local-list
)
1248 (> ind
(car local-list-indent
))))
1249 ;; Start new (level of) list
1250 (org-close-par-maybe)
1252 ((equal item-type
"u") "<ul>\n<li>\n")
1253 ((equal item-type
"o") "<ol>\n<li>\n")
1254 ((equal item-type
"d")
1255 (format "<dl>\n<dt>%s</dt><dd>\n" item-tag
))))
1256 (push item-type local-list-type
)
1257 (push ind local-list-indent
)
1258 (setq in-local-list t
))
1260 ;; continue current list
1261 (org-close-li (car local-list-type
))
1263 ((equal (car local-list-type
) "d")
1264 (format "<dt>%s</dt><dd>\n" (or item-tag
"???")))
1267 ;; we did close a list, normal text follows: need <p>
1269 (if (string-match "^[ \t]*\\[\\([X ]\\)\\]" line
)
1272 (if (equal (match-string 1 line
) "X")
1274 "<b>[<span style=\"visibility:hidden;\">X</span>]</b>")
1277 ;; Empty lines start a new paragraph. If hand-formatted lists
1278 ;; are not fully interpreted, lines starting with "-", "+", "*"
1279 ;; also start a new paragraph.
1280 (if (string-match "^ [-+*]-\\|^[ \t]*$" line
) (org-open-par))
1282 ;; Is this the start of a footnote?
1283 (when org-export-with-footnotes
1284 (when (and (boundp 'footnote-section-tag-regexp
)
1285 (string-match (concat "^" footnote-section-tag-regexp
)
1288 (throw 'nextline nil
))
1289 (when (string-match "^[ \t]*\\[\\([0-9]+\\)\\]" line
)
1290 (org-close-par-maybe)
1291 (let ((n (match-string 1 line
)))
1292 (setq org-par-open t
1294 (format "<p class=\"footnote\"><sup><a class=\"footnum\" name=\"fn.%s\" href=\"#fnr.%s\">%s</a></sup>" n n n
) t t line
)))))
1296 ;; Check if the line break needs to be conserved
1298 ((string-match "\\\\\\\\[ \t]*$" line
)
1299 (setq line
(replace-match "<br/>" t t line
)))
1300 (org-export-preserve-breaks
1301 (setq line
(concat line
"<br/>"))))
1303 ;; Check if a paragraph should be started
1305 (while (and org-par-open
1306 (string-match "\\\\par\\>" line start
))
1307 ;; Leave a space in the </p> so that the footnote matcher
1308 ;; does not see this.
1309 (if (not (get-text-property (match-beginning 0)
1310 'org-protected line
))
1311 (setq line
(replace-match "</p ><p >" t t line
)))
1312 (setq start
(match-end 0))))
1314 (insert line
"\n")))))
1316 ;; Properly close all local lists and other lists
1321 ;; Close any local lists before inserting a new header line
1322 (while local-list-type
1323 (org-close-li (car local-list-type
))
1324 (insert (format "</%sl>\n" (car local-list-type
)))
1325 (pop local-list-type
))
1326 (setq local-list-indent nil
1328 (org-html-level-start 1 nil umax
1329 (and org-export-with-toc
(<= level umax
))
1331 ;; the </div> to close the last text-... div.
1332 (when (and (> umax
0) first-heading-pos
) (insert "</div>\n"))
1335 (goto-char (point-min))
1336 (while (re-search-forward "<p class=\"footnote\">[^\000]*?\\(</p>\\|\\'\\)" nil t
)
1337 (push (match-string 0) footnotes
)
1338 (replace-match "" t t
)))
1340 (insert (format org-export-html-footnotes-section
1341 (or (nth 4 lang-words
) "Footnotes")
1342 (mapconcat 'identity
(nreverse footnotes
) "\n"))
1344 (let ((bib (org-export-html-get-bibliography)))
1346 (insert "\n" bib
"\n")))
1348 (when (plist-get opt-plist
:auto-postamble
)
1349 (insert "<div id=\"postamble\">\n")
1350 (when (and org-export-author-info author
)
1351 (insert "<p class=\"author\"> "
1352 (nth 1 lang-words
) ": " author
"\n")
1354 (if (listp (split-string email
",+ *"))
1356 (insert "<a href=\"mailto:" e
"\"><"
1358 (split-string email
",+ *"))
1359 (insert "<a href=\"mailto:" email
"\"><"
1360 email
"></a>\n")))
1362 (when (and date org-export-time-stamp-file
)
1363 (insert "<p class=\"date\"> "
1364 (nth 2 lang-words
) ": "
1366 (when org-export-creator-info
1367 (insert (format "<p class=\"creator\">HTML generated by org-mode %s in emacs %s</p>\n"
1368 org-version emacs-major-version
)))
1369 (when org-export-html-validation-link
1370 (insert org-export-html-validation-link
"\n"))
1373 (if org-export-html-with-timestamp
1374 (insert org-export-html-html-helper-timestamp
))
1375 (insert (or (plist-get opt-plist
:postamble
) ""))
1376 (insert "\n</div>\n</body>\n</html>\n"))
1378 (unless (plist-get opt-plist
:buffer-will-be-killed
)
1380 (if (eq major-mode default-major-mode
) (html-mode)))
1382 ;; insert the table of contents
1383 (goto-char (point-min))
1385 (if (or (re-search-forward
1386 "<p>\\s-*\\[TABLE-OF-CONTENTS\\]\\s-*</p>" nil t
)
1388 "\\[TABLE-OF-CONTENTS\\]" nil t
))
1390 (goto-char (match-beginning 0))
1392 (goto-char first-heading-pos
)
1393 (when (looking-at "\\s-*</p>")
1394 (goto-char (match-end 0))
1396 (insert "<div id=\"table-of-contents\">\n")
1397 (mapc 'insert thetoc
)
1398 (insert "</div>\n"))
1399 ;; remove empty paragraphs and lists
1400 (goto-char (point-min))
1401 (while (re-search-forward "<p>[ \r\n\t]*</p>" nil t
)
1403 (goto-char (point-min))
1404 (while (re-search-forward "<li>[ \r\n\t]*</li>\n?" nil t
)
1406 (goto-char (point-min))
1407 (while (re-search-forward "</ul>\\s-*<ul>\n?" nil t
)
1409 ;; Convert whitespace place holders
1410 (goto-char (point-min))
1412 (while (setq beg
(next-single-property-change (point) 'org-whitespace
))
1413 (setq n
(get-text-property beg
'org-whitespace
)
1414 end
(next-single-property-change beg
'org-whitespace
))
1416 (delete-region beg end
)
1417 (insert (format "<span style=\"visibility:hidden;\">%s</span>"
1418 (make-string n ?x
)))))
1419 (or to-buffer
(save-buffer))
1420 (goto-char (point-min))
1421 (or (org-export-push-to-kill-ring "HTML")
1422 (message "Exporting... done"))
1423 (if (eq to-buffer
'string
)
1424 (prog1 (buffer-substring (point-min) (point-max))
1425 (kill-buffer (current-buffer)))
1426 (current-buffer)))))
1428 (defun org-export-html-format-href (s)
1429 "Make sure the S is valid as a href reference in an XHTML document."
1432 (while (string-match "&" s start
)
1433 (setq start
(+ (match-beginning 0) 3)
1434 s
(replace-match "&" t t s
)))))
1437 (defun org-export-html-format-desc (s)
1438 "Make sure the S is valid as a description in a link."
1439 (if (and s
(not (get-text-property 1 'org-protected s
)))
1441 (org-html-do-expand s
))
1444 (defun org-export-html-format-image (src par-open
)
1445 "Create image tag with source and attributes."
1447 (if (string-match "^ltxpng/" src
)
1448 (format "<img src=\"%s\"/>" src
)
1449 (let* ((caption (org-find-text-property-in-string 'org-caption src
))
1450 (attr (org-find-text-property-in-string 'org-attributes src
))
1451 (label (org-find-text-property-in-string 'org-label src
)))
1452 (format "%s<div %sclass=\"figure\">
1453 <p><img src=\"%s\"%s /></p>%s
1455 (if org-par-open
"</p>\n" "")
1456 (if label
(format "id=\"%s\" " label
) "")
1458 (if (string-match "\\<alt=" (or attr
""))
1460 (concat " " attr
" alt=\"" src
"\""))
1461 (if caption
(concat "\n<p>" caption
"</p>") "")
1462 (if org-par-open
"\n<p>" ""))))))
1464 (defun org-export-html-get-bibliography ()
1465 "Find bibliography, cut it out and return it."
1467 (let (beg end
(cnt 1) bib
)
1469 (goto-char (point-min))
1470 (when (re-search-forward "^[ \t]*<div \\(id\\|class\\)=\"bibliography\"" nil t
)
1471 (setq beg
(match-beginning 0))
1472 (while (re-search-forward "</?div\\>" nil t
)
1473 (setq cnt
(+ cnt
(if (string= (match-string 0) "<div") +1 -
1)))
1475 (and (looking-at ">") (forward-char 1))
1476 (setq bib
(buffer-substring beg
(point)))
1477 (delete-region beg
(point))
1478 (throw 'exit bib
))))
1481 (defvar org-table-number-regexp
) ; defined in org-table.el
1482 (defun org-format-table-html (lines olines
)
1483 "Find out which HTML converter to use and return the HTML code."
1485 (setq lines
(org-split-string lines
"\n")))
1486 (if (string-match "^[ \t]*|" (car lines
))
1487 ;; A normal org table
1488 (org-format-org-table-html lines
)
1489 ;; Table made by table.el - test for spanning
1490 (let* ((hlines (delq nil
(mapcar
1492 (if (string-match "^[ \t]*\\+-" x
) x
1495 (first (car hlines
))
1496 (ll (and (string-match "\\S-+" first
)
1497 (match-string 0 first
)))
1498 (re (concat "^[ \t]*" (regexp-quote ll
)))
1499 (spanning (delq nil
(mapcar (lambda (x) (not (string-match re x
)))
1501 (if (and (not spanning
)
1502 (not org-export-prefer-native-exporter-for-tables
))
1503 ;; We can use my own converter with HTML conversions
1504 (org-format-table-table-html lines
)
1505 ;; Need to use the code generator in table.el, with the original text.
1506 (org-format-table-table-html-using-table-generate-source olines
)))))
1508 (defvar org-table-number-fraction
) ; defined in org-table.el
1509 (defun org-format-org-table-html (lines &optional splice
)
1510 "Format a table into HTML."
1511 (require 'org-table
)
1512 ;; Get rid of hlines at beginning and end
1513 (if (string-match "^[ \t]*|-" (car lines
)) (setq lines
(cdr lines
)))
1514 (setq lines
(nreverse lines
))
1515 (if (string-match "^[ \t]*|-" (car lines
)) (setq lines
(cdr lines
)))
1516 (setq lines
(nreverse lines
))
1517 (when org-export-table-remove-special-lines
1518 ;; Check if the table has a marking column. If yes remove the
1519 ;; column and the special lines
1520 (setq lines
(org-table-clean-before-export lines
)))
1522 (let* ((caption (or (get-text-property 0 'org-caption
(car lines
))
1523 (get-text-property (or (next-single-property-change
1524 0 'org-caption
(car lines
))
1526 'org-caption
(car lines
))))
1527 (attributes (or (get-text-property 0 'org-attributes
(car lines
))
1528 (get-text-property (or (next-single-property-change
1529 0 'org-attributes
(car lines
))
1531 'org-attributes
(car lines
))))
1532 (html-table-tag (org-export-splice-attributes
1533 html-table-tag attributes
))
1534 (head (and org-export-highlight-first-table-line
1536 (lambda (x) (string-match "^[ \t]*|-" x
))
1540 tbopen line fields html gr colgropen rowstart rowend
)
1541 (if splice
(setq head nil
))
1542 (unless splice
(push (if head
"<thead>" "<tbody>") html
))
1544 (while (setq line
(pop lines
))
1546 (if (string-match "^[ \t]*|-" line
)
1549 (push (if head
"</thead>" "</tbody>") html
)
1550 (if lines
(push "<tbody>" html
) (setq tbopen nil
)))
1551 (setq head nil
) ;; head ends here, first time around
1553 (throw 'next-line t
)))
1554 ;; Break the line into fields
1555 (setq fields
(org-split-string line
"[ \t]*|[ \t]*"))
1556 (unless fnum
(setq fnum
(make-vector (length fields
) 0)))
1557 (setq nline
(1+ nline
) i -
1
1558 rowstart
(eval (car org-export-table-row-tags
))
1559 rowend
(eval (cdr org-export-table-row-tags
)))
1560 (push (concat rowstart
1564 (if (and (< i nline
)
1565 (string-match org-table-number-regexp x
))
1566 (incf (aref fnum i
)))
1570 (format (car org-export-table-header-tags
) "col")
1572 (cdr org-export-table-header-tags
)))
1573 ((and (= i
0) org-export-html-table-use-header-tags-for-first-column
)
1575 (format (car org-export-table-header-tags
) "row")
1577 (cdr org-export-table-header-tags
)))
1579 (concat (car org-export-table-data-tags
) x
1580 (cdr org-export-table-data-tags
)))))
1584 (unless splice
(if tbopen
(push "</tbody>" html
)))
1585 (unless splice
(push "</table>\n" html
))
1586 (setq html
(nreverse html
))
1588 ;; Put in col tags with the alignment (unfortunately often ignored...)
1593 (setq gr
(pop org-table-colgroup-info
))
1594 (format "<col align=\"%s\" />"
1595 (if (> (/ (float x
) nline
) org-table-number-fraction
)
1601 ;; Since the output of HTML table formatter can also be used in
1602 ;; DocBook document, we want to always include the caption to make
1603 ;; DocBook XML file valid.
1604 (push (format "<caption>%s</caption>" (or caption
"")) html
)
1605 (push html-table-tag html
))
1606 (concat (mapconcat 'identity html
"\n") "\n")))
1608 (defun org-export-splice-attributes (tag attributes
)
1609 "Read attributes in string ATTRIBUTES, add and replace in HTML tag TAG."
1610 (if (not attributes
)
1612 (let (oldatt newatt
)
1613 (setq oldatt
(org-extract-attributes-from-string tag
)
1615 newatt
(cdr (org-extract-attributes-from-string attributes
)))
1617 (setq oldatt
(plist-put oldatt
(pop newatt
) (pop newatt
))))
1618 (if (string-match ">" tag
)
1620 (replace-match (concat (org-attributes-to-string oldatt
) ">")
1624 (defun org-format-table-table-html (lines)
1625 "Format a table generated by table.el into HTML.
1626 This conversion does *not* use `table-generate-source' from table.el.
1627 This has the advantage that Org-mode's HTML conversions can be used.
1628 But it has the disadvantage, that no cell- or row-spanning is allowed."
1629 (let (line field-buffer
1630 (head org-export-highlight-first-table-line
)
1631 fields html empty i
)
1632 (setq html
(concat html-table-tag
"\n"))
1633 (while (setq line
(pop lines
))
1634 (setq empty
" ")
1636 (if (string-match "^[ \t]*\\+-" line
)
1647 (if (equal x
"") (setq x empty
))
1650 (format (car org-export-table-header-tags
) "col")
1652 (cdr org-export-table-header-tags
))
1653 (concat (car org-export-table-data-tags
) x
1654 (cdr org-export-table-data-tags
))))
1658 (setq field-buffer nil
)))
1660 (throw 'next-line t
)))
1661 ;; Break the line into fields and store the fields
1662 (setq fields
(org-split-string line
"[ \t]*|[ \t]*"))
1664 (setq field-buffer
(mapcar
1666 (concat x
"<br/>" (pop fields
)))
1668 (setq field-buffer fields
))))
1669 (setq html
(concat html
"</table>\n"))
1672 (defun org-format-table-table-html-using-table-generate-source (lines)
1673 "Format a table into html, using `table-generate-source' from table.el.
1674 This has the advantage that cell- or row-spanning is allowed.
1675 But it has the disadvantage, that Org-mode's HTML conversions cannot be used."
1677 (with-current-buffer (get-buffer-create " org-tmp1 ")
1679 (insert (mapconcat 'identity lines
"\n"))
1680 (goto-char (point-min))
1681 (if (not (re-search-forward "|[^+]" nil t
))
1682 (error "Error processing table"))
1683 (table-recognize-table)
1684 (with-current-buffer (get-buffer-create " org-tmp2 ") (erase-buffer))
1685 (table-generate-source 'html
" org-tmp2 ")
1686 (set-buffer " org-tmp2 ")
1687 (buffer-substring (point-min) (point-max))))
1689 (defun org-export-splice-style (style extra
)
1690 "Splice EXTRA into STYLE, just before \"</style>\"."
1691 (if (and (stringp extra
)
1692 (string-match "\\S-" extra
)
1693 (string-match "</style>" style
))
1694 (concat (substring style
0 (match-beginning 0))
1696 (substring style
(match-beginning 0)))
1699 (defun org-html-handle-time-stamps (s)
1700 "Format time stamps in string S, or remove them."
1703 (while (string-match org-maybe-keyword-time-regexp s
)
1704 (or b
(setq b
(substring s
0 (match-beginning 0))))
1706 r
(substring s
0 (match-beginning 0))
1707 " @<span class=\"timestamp-wrapper\">"
1709 (format "@<span class=\"timestamp-kwd\">%s @</span>"
1710 (match-string 1 s
)))
1711 (format " @<span class=\"timestamp\">%s@</span>"
1713 (org-translate-time (match-string 3 s
)) 1 -
1))
1715 s
(substring s
(match-end 0))))
1716 ;; Line break if line started and ended with time stamp stuff
1719 (setq r
(concat r s
))
1720 (unless (string-match "\\S-" (concat b s
))
1721 (setq r
(concat r
"@<br/>")))
1724 (defvar htmlize-buffer-places
) ; from htmlize.el
1725 (defun org-export-htmlize-region-for-paste (beg end
)
1726 "Convert the region to HTML, using htmlize.el.
1727 This is much like `htmlize-region-for-paste', only that it uses
1728 the settings define in the org-... variables."
1729 (let* ((htmlize-output-type org-export-htmlize-output-type
)
1730 (htmlize-css-name-prefix org-export-htmlize-css-font-prefix
)
1731 (htmlbuf (htmlize-region beg end
)))
1733 (with-current-buffer htmlbuf
1734 (buffer-substring (plist-get htmlize-buffer-places
'content-start
)
1735 (plist-get htmlize-buffer-places
'content-end
)))
1736 (kill-buffer htmlbuf
))))
1739 (defun org-export-htmlize-generate-css ()
1740 "Create the CSS for all font definitions in the current Emacs session.
1741 Use this to create face definitions in your CSS style file that can then
1742 be used by code snippets transformed by htmlize.
1743 This command just produces a buffer that contains class definitions for all
1744 faces used in the current Emacs session. You can copy and paste the ones you
1745 need into your CSS file.
1747 If you then set `org-export-htmlize-output-type' to `css', calls to
1748 the function `org-export-htmlize-region-for-paste' will produce code
1749 that uses these same face definitions."
1752 (and (get-buffer "*html*") (kill-buffer "*html*"))
1754 (let ((fl (face-list))
1755 (htmlize-css-name-prefix "org-")
1756 (htmlize-output-type 'css
)
1758 (while (setq f
(pop fl
)
1759 i
(and f
(face-attribute f
:inherit
)))
1760 (when (and (symbolp f
) (or (not i
) (not (listp i
))))
1761 (insert (org-add-props (copy-sequence "1") nil
'face f
))))
1762 (htmlize-region (point-min) (point-max))))
1763 (switch-to-buffer "*html*")
1764 (goto-char (point-min))
1765 (if (re-search-forward "<style" nil t
)
1766 (delete-region (point-min) (match-beginning 0)))
1767 (if (re-search-forward "</style>" nil t
)
1768 (delete-region (1+ (match-end 0)) (point-max)))
1769 (beginning-of-line 1)
1770 (if (looking-at " +") (replace-match ""))
1771 (goto-char (point-min)))
1773 (defun org-html-protect (s)
1774 ;; convert & to &, < to < and > to >
1776 (while (string-match "&" s start
)
1777 (setq s
(replace-match "&" t t s
)
1778 start
(1+ (match-beginning 0))))
1779 (while (string-match "<" s
)
1780 (setq s
(replace-match "<" t t s
)))
1781 (while (string-match ">" s
)
1782 (setq s
(replace-match ">" t t s
)))
1783 ; (while (string-match "\"" s)
1784 ; (setq s (replace-match """ t t s)))
1788 (defun org-html-expand (string)
1789 "Prepare STRING for HTML export. Applies all active conversions.
1790 If there are links in the string, don't modify these."
1791 (let* ((re (concat org-bracket-link-regexp
"\\|"
1792 (org-re "[ \t]+\\(:[[:alnum:]_@:]+:\\)[ \t]*$")))
1794 (while (setq m
(string-match re string
))
1795 (setq s
(substring string
0 m
)
1796 l
(match-string 0 string
)
1797 string
(substring string
(match-end 0)))
1798 (push (org-html-do-expand s
) res
)
1800 (push (org-html-do-expand string
) res
)
1801 (apply 'concat
(nreverse res
))))
1803 (defun org-html-do-expand (s)
1804 "Apply all active conversions to translate special ASCII to HTML."
1805 (setq s
(org-html-protect s
))
1806 (if org-export-html-expand
1807 (while (string-match "@<\\([^&]*\\)>" s
)
1808 (setq s
(replace-match "<\\1>" t nil s
))))
1809 (if org-export-with-emphasize
1810 (setq s
(org-export-html-convert-emphasize s
)))
1811 (if org-export-with-special-strings
1812 (setq s
(org-export-html-convert-special-strings s
)))
1813 (if org-export-with-sub-superscripts
1814 (setq s
(org-export-html-convert-sub-super s
)))
1815 (if org-export-with-TeX-macros
1816 (let ((start 0) wd ass
)
1817 (while (setq start
(string-match "\\\\\\([a-zA-Z]+\\)\\({}\\)?"
1819 (if (get-text-property (match-beginning 0) 'org-protected s
)
1820 (setq start
(match-end 0))
1821 (setq wd
(match-string 1 s
))
1822 (if (setq ass
(assoc wd org-html-entities
))
1823 (setq s
(replace-match (or (cdr ass
)
1824 (concat "&" (car ass
) ";"))
1826 (setq start
(+ start
(length wd
))))))))
1829 (defconst org-export-html-special-string-regexps
1830 '(("\\\\-" .
"­")
1831 ("---\\([^-]\\)" .
"—\\1")
1832 ("--\\([^-]\\)" .
"–\\1")
1833 ("\\.\\.\\." .
"…"))
1834 "Regular expressions for special string conversion.")
1836 (defun org-export-html-convert-special-strings (string)
1837 "Convert special characters in STRING to HTML."
1838 (let ((all org-export-html-special-string-regexps
)
1840 (while (setq a
(pop all
))
1841 (setq re
(car a
) rpl
(cdr a
) start
0)
1842 (while (string-match re string start
)
1843 (if (get-text-property (match-beginning 0) 'org-protected string
)
1844 (setq start
(match-end 0))
1845 (setq string
(replace-match rpl t nil string
)))))
1848 (defun org-export-html-convert-sub-super (string)
1849 "Convert sub- and superscripts in STRING to HTML."
1850 (let (key c
(s 0) (requireb (eq org-export-with-sub-superscripts
'{})))
1851 (while (string-match org-match-substring-regexp string s
)
1853 ((and requireb
(match-end 8)) (setq s
(match-end 2)))
1854 ((get-text-property (match-beginning 2) 'org-protected string
)
1855 (setq s
(match-end 2)))
1857 (setq s
(match-end 1)
1858 key
(if (string= (match-string 2 string
) "_") "sub" "sup")
1859 c
(or (match-string 8 string
)
1860 (match-string 6 string
)
1861 (match-string 5 string
))
1862 string
(replace-match
1863 (concat (match-string 1 string
)
1864 "<" key
">" c
"</" key
">")
1866 (while (string-match "\\\\\\([_^]\\)" string
)
1867 (setq string
(replace-match (match-string 1 string
) t t string
)))
1870 (defun org-export-html-convert-emphasize (string)
1873 (while (string-match org-emph-re string s
)
1875 (substring string
(match-beginning 3) (1+ (match-beginning 3)))
1876 (substring string
(match-beginning 4) (1+ (match-beginning 4)))))
1877 (setq s
(match-beginning 0)
1880 (match-string 1 string
)
1881 (nth 2 (assoc (match-string 3 string
) org-emphasis-alist
))
1882 (match-string 4 string
)
1883 (nth 3 (assoc (match-string 3 string
)
1884 org-emphasis-alist
))
1885 (match-string 5 string
))
1886 string
(replace-match rpl t t string
)
1887 s
(+ s
(- (length rpl
) 2)))
1891 (defun org-open-par ()
1892 "Insert <p>, but first close previous paragraph if any."
1893 (org-close-par-maybe)
1895 (setq org-par-open t
))
1896 (defun org-close-par-maybe ()
1897 "Close paragraph if there is one open."
1900 (setq org-par-open nil
)))
1901 (defun org-close-li (&optional type
)
1902 "Close <li> if necessary."
1903 (org-close-par-maybe)
1904 (insert (if (equal type
"d") "</dd>\n" "</li>\n")))
1906 (defvar in-local-list
)
1907 (defvar local-list-indent
)
1908 (defvar local-list-type
)
1909 (defun org-export-html-close-lists-maybe (line)
1910 (let ((ind (or (get-text-property 0 'original-indentation line
)))
1911 ; (and (string-match "\\S-" line)
1912 ; (org-get-indentation line))))
1915 (while (and in-local-list
1916 (<= ind
(car local-list-indent
)))
1918 (org-close-li (car local-list-type
))
1919 (insert (format "</%sl>\n" (car local-list-type
)))
1920 (pop local-list-type
) (pop local-list-indent
)
1921 (setq in-local-list local-list-indent
))
1922 (and didclose
(org-open-par)))))
1924 (defvar body-only
) ; dynamically scoped into this.
1925 (defun org-html-level-start (level title umax with-toc head-count
)
1926 "Insert a new level in HTML export.
1927 When TITLE is nil, just close all open levels."
1928 (org-close-par-maybe)
1929 (let* ((target (and title
(org-get-text-property-any 0 'target title
)))
1930 (extra-targets (assoc target org-export-target-aliases
))
1931 (preferred (cdr (assoc target org-export-preferred-target-alist
)))
1932 (remove (or preferred target
))
1934 snumber href suffix
)
1935 (setq extra-targets
(remove remove extra-targets
))
1937 (mapconcat (lambda (x)
1938 (if (org-uuidgen-p x
) (setq x
(concat "ID-" x
)))
1939 (format "<a name=\"%s\" id=\"%s\"></a>"
1944 (if (aref org-levels-open
(1- l
))
1946 (org-html-level-close l umax
)
1947 (aset org-levels-open
(1- l
) nil
)))
1950 ;; If title is nil, this means this function is called to close
1951 ;; all levels, so the rest is done only if title is given
1952 (when (string-match (org-re "\\(:[[:alnum:]_@:]+:\\)[ \t]*$") title
)
1953 (setq title
(replace-match
1954 (if org-export-with-tags
1957 " <span class=\"tag\">"
1960 (format "<span class=\"%s\">%s</span>"
1961 (org-export-html-get-tag-class-name x
)
1963 (org-split-string (match-string 1 title
) ":")
1970 (if (aref org-levels-open
(1- level
))
1974 (insert (format "<li id=\"%s\">" target
) extra-targets title
"<br/>\n")
1975 (insert "<li>" title
"<br/>\n")))
1976 (aset org-levels-open
(1- level
) t
)
1977 (org-close-par-maybe)
1979 (insert (format "<ul>\n<li id=\"%s\">" target
)
1980 extra-targets title
"<br/>\n")
1981 (insert "<ul>\n<li>" title
"<br/>\n"))))
1982 (aset org-levels-open
(1- level
) t
)
1983 (setq snumber
(org-section-number level
))
1984 (setq level
(+ level org-export-html-toplevel-hlevel -
1))
1985 (if (and org-export-with-section-numbers
(not body-only
))
1987 (format "<span class=\"section-number-%d\">%s</span>"
1990 (unless (= head-count
1) (insert "\n</div>\n"))
1991 (setq href
(cdr (assoc (concat "sec-" snumber
) org-export-preferred-target-alist
)))
1992 (setq suffix
(or href snumber
))
1993 (setq href
(or href
(concat "sec-" snumber
)))
1994 (insert (format "\n<div id=\"outline-container-%s\" class=\"outline-%d\">\n<h%d id=\"%s\">%s%s</h%d>\n<div class=\"outline-text-%d\" id=\"text-%s\">\n"
1995 suffix level level href
1997 title level level suffix
))
2000 (defun org-export-html-get-tag-class-name (tag)
2001 "Turn tag into a valid class name.
2002 Replaces invalid characters with \"_\" and then prepends a prefix."
2004 (while (string-match "[^a-zA-Z0-9_]" tag
)
2005 (setq tag
(replace-match "_" t t tag
))))
2006 (concat org-export-html-tag-class-prefix tag
))
2008 (defun org-export-html-get-todo-kwd-class-name (kwd)
2009 "Turn todo keyword into a valid class name.
2010 Replaces invalid characters with \"_\" and then prepends a prefix."
2012 (while (string-match "[^a-zA-Z0-9_]" kwd
)
2013 (setq kwd
(replace-match "_" t t kwd
))))
2014 (concat org-export-html-todo-kwd-class-prefix kwd
))
2016 (defun org-html-level-close (level max-outline-level
)
2017 "Terminate one level in HTML export."
2018 (if (<= level max-outline-level
)
2021 (insert "</ul>\n")))
2025 ;; arch-tag: 8109d84d-eb8f-460b-b1a8-f45f3a6c7ea1
2027 ;;; org-html.el ends here