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...)
1015 (setq id-file
(file-relative-name
1016 id-file
(file-name-directory org-current-export-file
)))
1017 (setq id-file
(concat (file-name-sans-extension id-file
)
1018 "." html-extension
))
1019 (setq rpl
(concat "<a href=\"" id-file
"#"
1020 (if (org-uuidgen-p path
) "ID-")
1023 (org-export-html-format-desc desc
)
1025 ((member type
'("http" "https"))
1026 ;; standard URL, just check if we need to inline an image
1027 (if (and (or (eq t org-export-html-inline-images
)
1028 (and org-export-html-inline-images
(not descp
)))
1030 path org-export-html-inline-image-extensions
))
1031 (setq rpl
(org-export-html-format-image
1032 (concat type
":" path
) org-par-open
))
1033 (setq link
(concat type
":" path
))
1034 (setq rpl
(concat "<a href=\""
1035 (org-export-html-format-href link
)
1037 (org-export-html-format-desc desc
)
1039 ((member type
'("ftp" "mailto" "news"))
1041 (setq link
(concat type
":" path
))
1042 (setq rpl
(concat "<a href=\""
1043 (org-export-html-format-href link
)
1045 (org-export-html-format-desc desc
)
1048 ((string= type
"coderef")
1049 (setq rpl
(format "<a href=\"#coderef-%s\" class=\"coderef\" onmouseover=\"CodeHighlightOn(this, 'coderef-%s');\" onmouseout=\"CodeHighlightOff(this, 'coderef-%s');\">%s</a>"
1051 (format (org-export-get-coderef-format path
(and descp desc
))
1052 (cdr (assoc path org-export-code-refs
))))))
1054 ((functionp (setq fnc
(nth 2 (assoc type org-link-protocols
))))
1055 ;; The link protocol has a function for format the link
1058 (funcall fnc
(org-link-unescape path
) desc1
'html
))))
1060 ((string= type
"file")
1062 (let* ((filename path
)
1063 (abs-p (file-name-absolute-p filename
))
1064 thefile file-is-image-p search
)
1066 (if (string-match "::\\(.*\\)" filename
)
1067 (setq search
(match-string 1 filename
)
1068 filename
(replace-match "" t nil filename
)))
1070 (if (functionp link-validate
)
1071 (funcall link-validate filename current-dir
)
1073 (setq file-is-image-p
1075 filename org-export-html-inline-image-extensions
))
1076 (setq thefile
(if abs-p
(expand-file-name filename
) filename
))
1077 (when (and org-export-html-link-org-files-as-html
1078 (string-match "\\.org$" thefile
))
1079 (setq thefile
(concat (substring thefile
0
1080 (match-beginning 0))
1081 "." html-extension
))
1083 ;; make sure this is can be used as target search
1084 (not (string-match "^[0-9]*$" search
))
1085 (not (string-match "^\\*" search
))
1086 (not (string-match "^/.*/$" search
)))
1087 (setq thefile
(concat thefile
"#"
1088 (org-solidify-link-text
1089 (org-link-unescape search
)))))
1090 (when (string-match "^file:" desc
)
1091 (setq desc
(replace-match "" t t desc
))
1092 (if (string-match "\\.org$" desc
)
1093 (setq desc
(replace-match "" t t desc
))))))
1094 (setq rpl
(if (and file-is-image-p
1095 (or (eq t org-export-html-inline-images
)
1096 (and org-export-html-inline-images
1099 (message "image %s %s" thefile org-par-open
)
1100 (org-export-html-format-image thefile org-par-open
))
1101 (concat "<a href=\"" thefile
"\"" attr
">"
1102 (org-export-html-format-desc desc
)
1104 (if (not valid
) (setq rpl desc
))))
1107 ;; just publish the path, as default
1108 (setq rpl
(concat "<i><" type
":"
1109 (save-match-data (org-link-unescape path
))
1111 (setq line
(replace-match rpl t t line
)
1112 start
(+ start
(length rpl
))))
1115 (if (and (string-match org-todo-line-regexp line
)
1116 (match-beginning 2))
1119 (concat (substring line
0 (match-beginning 2))
1121 (if (member (match-string 2 line
)
1124 " " (match-string 2 line
)
1125 "\"> " (org-export-html-get-todo-kwd-class-name
1126 (match-string 2 line
))
1127 "</span>" (substring line
(match-end 2)))))
1129 ;; Does this contain a reference to a footnote?
1130 (when org-export-with-footnotes
1132 (while (string-match "\\([^* \t].*?\\)\\[\\([0-9]+\\)\\]" line start
)
1133 (if (get-text-property (match-beginning 2) 'org-protected line
)
1134 (setq start
(match-end 2))
1135 (let ((n (match-string 2 line
)) extra a
)
1136 (if (setq a
(assoc n footref-seen
))
1138 (setcdr a
(1+ (cdr a
)))
1139 (setq extra
(format ".%d" (cdr a
))))
1141 (push (cons n
1) footref-seen
))
1145 "%s<sup><a class=\"footref\" name=\"fnr.%s%s\" href=\"#fn.%s\">%s</a></sup>"
1146 (match-string 1 line
) n extra n n
)
1150 ((string-match "^\\(\\*+\\)[ \t]+\\(.*\\)" line
)
1151 ;; This is a headline
1152 (setq level
(org-tr-level (- (match-end 1) (match-beginning 1)
1154 txt
(match-string 2 line
))
1155 (if (string-match quote-re0 txt
)
1156 (setq txt
(replace-match "" t t txt
)))
1157 (if (<= level
(max umax umax-toc
))
1158 (setq head-count
(+ head-count
1)))
1160 ;; Close any local lists before inserting a new header line
1161 (while local-list-type
1162 (org-close-li (car local-list-type
))
1163 (insert (format "</%sl>\n" (car local-list-type
)))
1164 (pop local-list-type
))
1165 (setq local-list-indent nil
1167 (setq first-heading-pos
(or first-heading-pos
(point)))
1168 (org-html-level-start level txt umax
1169 (and org-export-with-toc
(<= level umax
))
1173 (when (string-match quote-re line
)
1174 (org-close-par-maybe)
1178 ((string-match "^[ \t]*- __+[ \t]*$" line
)
1179 ;; Explicit list closure
1180 (when local-list-type
1181 (let ((ind (org-get-indentation line
)))
1182 (while (and local-list-indent
1183 (<= ind
(car local-list-indent
)))
1184 (org-close-li (car local-list-type
))
1185 (insert (format "</%sl>\n" (car local-list-type
)))
1186 (pop local-list-type
)
1187 (pop local-list-indent
))
1188 (or local-list-indent
(setq in-local-list nil
))))
1189 (throw 'nextline nil
))
1191 ((and org-export-with-tables
1192 (string-match "^\\([ \t]*\\)\\(|\\|\\+-+\\+\\)" line
))
1193 (when (not table-open
)
1195 (setq table-open t table-buffer nil table-orig-buffer nil
))
1198 (setq table-buffer
(cons line table-buffer
)
1199 table-orig-buffer
(cons origline table-orig-buffer
))
1200 (when (or (not lines
)
1201 (not (string-match "^\\([ \t]*\\)\\(|\\|\\+-+\\+\\)"
1203 (setq table-open nil
1204 table-buffer
(nreverse table-buffer
)
1205 table-orig-buffer
(nreverse table-orig-buffer
))
1206 (org-close-par-maybe)
1207 (insert (org-format-table-html table-buffer table-orig-buffer
))))
1212 ((eq llt t
) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\([0-9]+[.)]\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)")
1213 ((= llt ?.
) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\([0-9]+\\.\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)")
1214 ((= llt ?\
)) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\([0-9]+)\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)")
1215 (t (error "Invalid value of `org-plain-list-ordered-item-terminator'")))
1217 (setq ind
(or (get-text-property 0 'original-indentation line
)
1218 (org-get-string-indentation line
))
1219 item-type
(if (match-beginning 4) "o" "u")
1220 starter
(if (match-beginning 2)
1221 (substring (match-string 2 line
) 0 -
1))
1222 line
(substring line
(match-beginning 5))
1224 (if (and starter
(string-match "\\(.*?\\) ::[ \t]*" line
))
1226 item-tag
(match-string 1 line
)
1227 line
(substring line
(match-end 0))))
1228 (when (and (not (equal item-type
"d"))
1229 (not (string-match "[^ \t]" line
)))
1230 ;; empty line. Pretend indentation is large.
1231 (setq ind
(if org-empty-line-terminates-plain-lists
1233 (1+ (or (car local-list-indent
) 1)))))
1235 (while (and in-local-list
1236 (or (and (= ind
(car local-list-indent
))
1238 (< ind
(car local-list-indent
))))
1240 (org-close-li (car local-list-type
))
1241 (insert (format "</%sl>\n" (car local-list-type
)))
1242 (pop local-list-type
) (pop local-list-indent
)
1243 (setq in-local-list local-list-indent
))
1246 (or (not in-local-list
)
1247 (> ind
(car local-list-indent
))))
1248 ;; Start new (level of) list
1249 (org-close-par-maybe)
1251 ((equal item-type
"u") "<ul>\n<li>\n")
1252 ((equal item-type
"o") "<ol>\n<li>\n")
1253 ((equal item-type
"d")
1254 (format "<dl>\n<dt>%s</dt><dd>\n" item-tag
))))
1255 (push item-type local-list-type
)
1256 (push ind local-list-indent
)
1257 (setq in-local-list t
))
1259 ;; continue current list
1260 (org-close-li (car local-list-type
))
1262 ((equal (car local-list-type
) "d")
1263 (format "<dt>%s</dt><dd>\n" (or item-tag
"???")))
1266 ;; we did close a list, normal text follows: need <p>
1268 (if (string-match "^[ \t]*\\[\\([X ]\\)\\]" line
)
1271 (if (equal (match-string 1 line
) "X")
1273 "<b>[<span style=\"visibility:hidden;\">X</span>]</b>")
1276 ;; Empty lines start a new paragraph. If hand-formatted lists
1277 ;; are not fully interpreted, lines starting with "-", "+", "*"
1278 ;; also start a new paragraph.
1279 (if (string-match "^ [-+*]-\\|^[ \t]*$" line
) (org-open-par))
1281 ;; Is this the start of a footnote?
1282 (when org-export-with-footnotes
1283 (when (and (boundp 'footnote-section-tag-regexp
)
1284 (string-match (concat "^" footnote-section-tag-regexp
)
1287 (throw 'nextline nil
))
1288 (when (string-match "^[ \t]*\\[\\([0-9]+\\)\\]" line
)
1289 (org-close-par-maybe)
1290 (let ((n (match-string 1 line
)))
1291 (setq org-par-open t
1293 (format "<p class=\"footnote\"><sup><a class=\"footnum\" name=\"fn.%s\" href=\"#fnr.%s\">%s</a></sup>" n n n
) t t line
)))))
1295 ;; Check if the line break needs to be conserved
1297 ((string-match "\\\\\\\\[ \t]*$" line
)
1298 (setq line
(replace-match "<br/>" t t line
)))
1299 (org-export-preserve-breaks
1300 (setq line
(concat line
"<br/>"))))
1302 ;; Check if a paragraph should be started
1304 (while (and org-par-open
1305 (string-match "\\\\par\\>" line start
))
1306 ;; Leave a space in the </p> so that the footnote matcher
1307 ;; does not see this.
1308 (if (not (get-text-property (match-beginning 0)
1309 'org-protected line
))
1310 (setq line
(replace-match "</p ><p >" t t line
)))
1311 (setq start
(match-end 0))))
1313 (insert line
"\n")))))
1315 ;; Properly close all local lists and other lists
1320 ;; Close any local lists before inserting a new header line
1321 (while local-list-type
1322 (org-close-li (car local-list-type
))
1323 (insert (format "</%sl>\n" (car local-list-type
)))
1324 (pop local-list-type
))
1325 (setq local-list-indent nil
1327 (org-html-level-start 1 nil umax
1328 (and org-export-with-toc
(<= level umax
))
1330 ;; the </div> to close the last text-... div.
1331 (when (and (> umax
0) first-heading-pos
) (insert "</div>\n"))
1334 (goto-char (point-min))
1335 (while (re-search-forward "<p class=\"footnote\">[^\000]*?\\(</p>\\|\\'\\)" nil t
)
1336 (push (match-string 0) footnotes
)
1337 (replace-match "" t t
)))
1339 (insert (format org-export-html-footnotes-section
1340 (or (nth 4 lang-words
) "Footnotes")
1341 (mapconcat 'identity
(nreverse footnotes
) "\n"))
1343 (let ((bib (org-export-html-get-bibliography)))
1345 (insert "\n" bib
"\n")))
1347 (when (plist-get opt-plist
:auto-postamble
)
1348 (insert "<div id=\"postamble\">\n")
1349 (when (and org-export-author-info author
)
1350 (insert "<p class=\"author\"> "
1351 (nth 1 lang-words
) ": " author
"\n")
1353 (if (listp (split-string email
",+ *"))
1355 (insert "<a href=\"mailto:" e
"\"><"
1357 (split-string email
",+ *"))
1358 (insert "<a href=\"mailto:" email
"\"><"
1359 email
"></a>\n")))
1361 (when (and date org-export-time-stamp-file
)
1362 (insert "<p class=\"date\"> "
1363 (nth 2 lang-words
) ": "
1365 (when org-export-creator-info
1366 (insert (format "<p class=\"creator\">HTML generated by org-mode %s in emacs %s</p>\n"
1367 org-version emacs-major-version
)))
1368 (when org-export-html-validation-link
1369 (insert org-export-html-validation-link
"\n"))
1372 (if org-export-html-with-timestamp
1373 (insert org-export-html-html-helper-timestamp
))
1374 (insert (or (plist-get opt-plist
:postamble
) ""))
1375 (insert "\n</div>\n</body>\n</html>\n"))
1377 (unless (plist-get opt-plist
:buffer-will-be-killed
)
1379 (if (eq major-mode default-major-mode
) (html-mode)))
1381 ;; insert the table of contents
1382 (goto-char (point-min))
1384 (if (or (re-search-forward
1385 "<p>\\s-*\\[TABLE-OF-CONTENTS\\]\\s-*</p>" nil t
)
1387 "\\[TABLE-OF-CONTENTS\\]" nil t
))
1389 (goto-char (match-beginning 0))
1391 (goto-char first-heading-pos
)
1392 (when (looking-at "\\s-*</p>")
1393 (goto-char (match-end 0))
1395 (insert "<div id=\"table-of-contents\">\n")
1396 (mapc 'insert thetoc
)
1397 (insert "</div>\n"))
1398 ;; remove empty paragraphs and lists
1399 (goto-char (point-min))
1400 (while (re-search-forward "<p>[ \r\n\t]*</p>" nil t
)
1402 (goto-char (point-min))
1403 (while (re-search-forward "<li>[ \r\n\t]*</li>\n?" nil t
)
1405 (goto-char (point-min))
1406 (while (re-search-forward "</ul>\\s-*<ul>\n?" nil t
)
1408 ;; Convert whitespace place holders
1409 (goto-char (point-min))
1411 (while (setq beg
(next-single-property-change (point) 'org-whitespace
))
1412 (setq n
(get-text-property beg
'org-whitespace
)
1413 end
(next-single-property-change beg
'org-whitespace
))
1415 (delete-region beg end
)
1416 (insert (format "<span style=\"visibility:hidden;\">%s</span>"
1417 (make-string n ?x
)))))
1418 (or to-buffer
(save-buffer))
1419 (goto-char (point-min))
1420 (or (org-export-push-to-kill-ring "HTML")
1421 (message "Exporting... done"))
1422 (if (eq to-buffer
'string
)
1423 (prog1 (buffer-substring (point-min) (point-max))
1424 (kill-buffer (current-buffer)))
1425 (current-buffer)))))
1427 (defun org-export-html-format-href (s)
1428 "Make sure the S is valid as a href reference in an XHTML document."
1431 (while (string-match "&" s start
)
1432 (setq start
(+ (match-beginning 0) 3)
1433 s
(replace-match "&" t t s
)))))
1436 (defun org-export-html-format-desc (s)
1437 "Make sure the S is valid as a description in a link."
1438 (if (and s
(not (get-text-property 1 'org-protected s
)))
1440 (org-html-do-expand s
))
1443 (defun org-export-html-format-image (src par-open
)
1444 "Create image tag with source and attributes."
1446 (if (string-match "^ltxpng/" src
)
1447 (format "<img src=\"%s\"/>" src
)
1448 (let* ((caption (org-find-text-property-in-string 'org-caption src
))
1449 (attr (org-find-text-property-in-string 'org-attributes src
))
1450 (label (org-find-text-property-in-string 'org-label src
)))
1451 (format "%s<div %sclass=\"figure\">
1452 <p><img src=\"%s\"%s /></p>%s
1454 (if org-par-open
"</p>\n" "")
1455 (if label
(format "id=\"%s\" " label
) "")
1457 (if (string-match "\\<alt=" (or attr
""))
1459 (concat " " attr
" alt=\"" src
"\""))
1460 (if caption
(concat "\n<p>" caption
"</p>") "")
1461 (if org-par-open
"\n<p>" ""))))))
1463 (defun org-export-html-get-bibliography ()
1464 "Find bibliography, cut it out and return it."
1466 (let (beg end
(cnt 1) bib
)
1468 (goto-char (point-min))
1469 (when (re-search-forward "^[ \t]*<div \\(id\\|class\\)=\"bibliography\"" nil t
)
1470 (setq beg
(match-beginning 0))
1471 (while (re-search-forward "</?div\\>" nil t
)
1472 (setq cnt
(+ cnt
(if (string= (match-string 0) "<div") +1 -
1)))
1474 (and (looking-at ">") (forward-char 1))
1475 (setq bib
(buffer-substring beg
(point)))
1476 (delete-region beg
(point))
1477 (throw 'exit bib
))))
1480 (defvar org-table-number-regexp
) ; defined in org-table.el
1481 (defun org-format-table-html (lines olines
)
1482 "Find out which HTML converter to use and return the HTML code."
1484 (setq lines
(org-split-string lines
"\n")))
1485 (if (string-match "^[ \t]*|" (car lines
))
1486 ;; A normal org table
1487 (org-format-org-table-html lines
)
1488 ;; Table made by table.el - test for spanning
1489 (let* ((hlines (delq nil
(mapcar
1491 (if (string-match "^[ \t]*\\+-" x
) x
1494 (first (car hlines
))
1495 (ll (and (string-match "\\S-+" first
)
1496 (match-string 0 first
)))
1497 (re (concat "^[ \t]*" (regexp-quote ll
)))
1498 (spanning (delq nil
(mapcar (lambda (x) (not (string-match re x
)))
1500 (if (and (not spanning
)
1501 (not org-export-prefer-native-exporter-for-tables
))
1502 ;; We can use my own converter with HTML conversions
1503 (org-format-table-table-html lines
)
1504 ;; Need to use the code generator in table.el, with the original text.
1505 (org-format-table-table-html-using-table-generate-source olines
)))))
1507 (defvar org-table-number-fraction
) ; defined in org-table.el
1508 (defun org-format-org-table-html (lines &optional splice
)
1509 "Format a table into HTML."
1510 (require 'org-table
)
1511 ;; Get rid of hlines at beginning and end
1512 (if (string-match "^[ \t]*|-" (car lines
)) (setq lines
(cdr lines
)))
1513 (setq lines
(nreverse lines
))
1514 (if (string-match "^[ \t]*|-" (car lines
)) (setq lines
(cdr lines
)))
1515 (setq lines
(nreverse lines
))
1516 (when org-export-table-remove-special-lines
1517 ;; Check if the table has a marking column. If yes remove the
1518 ;; column and the special lines
1519 (setq lines
(org-table-clean-before-export lines
)))
1521 (let* ((caption (or (get-text-property 0 'org-caption
(car lines
))
1522 (get-text-property (or (next-single-property-change
1523 0 'org-caption
(car lines
))
1525 'org-caption
(car lines
))))
1526 (attributes (or (get-text-property 0 'org-attributes
(car lines
))
1527 (get-text-property (or (next-single-property-change
1528 0 'org-attributes
(car lines
))
1530 'org-attributes
(car lines
))))
1531 (html-table-tag (org-export-splice-attributes
1532 html-table-tag attributes
))
1533 (head (and org-export-highlight-first-table-line
1535 (lambda (x) (string-match "^[ \t]*|-" x
))
1539 tbopen line fields html gr colgropen rowstart rowend
)
1540 (if splice
(setq head nil
))
1541 (unless splice
(push (if head
"<thead>" "<tbody>") html
))
1543 (while (setq line
(pop lines
))
1545 (if (string-match "^[ \t]*|-" line
)
1548 (push (if head
"</thead>" "</tbody>") html
)
1549 (if lines
(push "<tbody>" html
) (setq tbopen nil
)))
1550 (setq head nil
) ;; head ends here, first time around
1552 (throw 'next-line t
)))
1553 ;; Break the line into fields
1554 (setq fields
(org-split-string line
"[ \t]*|[ \t]*"))
1555 (unless fnum
(setq fnum
(make-vector (length fields
) 0)))
1556 (setq nline
(1+ nline
) i -
1
1557 rowstart
(eval (car org-export-table-row-tags
))
1558 rowend
(eval (cdr org-export-table-row-tags
)))
1559 (push (concat rowstart
1563 (if (and (< i nline
)
1564 (string-match org-table-number-regexp x
))
1565 (incf (aref fnum i
)))
1569 (format (car org-export-table-header-tags
) "col")
1571 (cdr org-export-table-header-tags
)))
1572 ((and (= i
0) org-export-html-table-use-header-tags-for-first-column
)
1574 (format (car org-export-table-header-tags
) "row")
1576 (cdr org-export-table-header-tags
)))
1578 (concat (car org-export-table-data-tags
) x
1579 (cdr org-export-table-data-tags
)))))
1583 (unless splice
(if tbopen
(push "</tbody>" html
)))
1584 (unless splice
(push "</table>\n" html
))
1585 (setq html
(nreverse html
))
1587 ;; Put in col tags with the alignment (unfortunately often ignored...)
1592 (setq gr
(pop org-table-colgroup-info
))
1593 (format "<col align=\"%s\" />"
1594 (if (> (/ (float x
) nline
) org-table-number-fraction
)
1600 ;; Since the output of HTML table formatter can also be used in
1601 ;; DocBook document, we want to always include the caption to make
1602 ;; DocBook XML file valid.
1603 (push (format "<caption>%s</caption>" (or caption
"")) html
)
1604 (push html-table-tag html
))
1605 (concat (mapconcat 'identity html
"\n") "\n")))
1607 (defun org-export-splice-attributes (tag attributes
)
1608 "Read attributes in string ATTRIBUTES, add and replace in HTML tag TAG."
1609 (if (not attributes
)
1611 (let (oldatt newatt
)
1612 (setq oldatt
(org-extract-attributes-from-string tag
)
1614 newatt
(cdr (org-extract-attributes-from-string attributes
)))
1616 (setq oldatt
(plist-put oldatt
(pop newatt
) (pop newatt
))))
1617 (if (string-match ">" tag
)
1619 (replace-match (concat (org-attributes-to-string oldatt
) ">")
1623 (defun org-format-table-table-html (lines)
1624 "Format a table generated by table.el into HTML.
1625 This conversion does *not* use `table-generate-source' from table.el.
1626 This has the advantage that Org-mode's HTML conversions can be used.
1627 But it has the disadvantage, that no cell- or row-spanning is allowed."
1628 (let (line field-buffer
1629 (head org-export-highlight-first-table-line
)
1630 fields html empty i
)
1631 (setq html
(concat html-table-tag
"\n"))
1632 (while (setq line
(pop lines
))
1633 (setq empty
" ")
1635 (if (string-match "^[ \t]*\\+-" line
)
1646 (if (equal x
"") (setq x empty
))
1649 (format (car org-export-table-header-tags
) "col")
1651 (cdr org-export-table-header-tags
))
1652 (concat (car org-export-table-data-tags
) x
1653 (cdr org-export-table-data-tags
))))
1657 (setq field-buffer nil
)))
1659 (throw 'next-line t
)))
1660 ;; Break the line into fields and store the fields
1661 (setq fields
(org-split-string line
"[ \t]*|[ \t]*"))
1663 (setq field-buffer
(mapcar
1665 (concat x
"<br/>" (pop fields
)))
1667 (setq field-buffer fields
))))
1668 (setq html
(concat html
"</table>\n"))
1671 (defun org-format-table-table-html-using-table-generate-source (lines)
1672 "Format a table into html, using `table-generate-source' from table.el.
1673 This has the advantage that cell- or row-spanning is allowed.
1674 But it has the disadvantage, that Org-mode's HTML conversions cannot be used."
1676 (with-current-buffer (get-buffer-create " org-tmp1 ")
1678 (insert (mapconcat 'identity lines
"\n"))
1679 (goto-char (point-min))
1680 (if (not (re-search-forward "|[^+]" nil t
))
1681 (error "Error processing table"))
1682 (table-recognize-table)
1683 (with-current-buffer (get-buffer-create " org-tmp2 ") (erase-buffer))
1684 (table-generate-source 'html
" org-tmp2 ")
1685 (set-buffer " org-tmp2 ")
1686 (buffer-substring (point-min) (point-max))))
1688 (defun org-export-splice-style (style extra
)
1689 "Splice EXTRA into STYLE, just before \"</style>\"."
1690 (if (and (stringp extra
)
1691 (string-match "\\S-" extra
)
1692 (string-match "</style>" style
))
1693 (concat (substring style
0 (match-beginning 0))
1695 (substring style
(match-beginning 0)))
1698 (defun org-html-handle-time-stamps (s)
1699 "Format time stamps in string S, or remove them."
1702 (while (string-match org-maybe-keyword-time-regexp s
)
1703 (or b
(setq b
(substring s
0 (match-beginning 0))))
1705 r
(substring s
0 (match-beginning 0))
1706 " @<span class=\"timestamp-wrapper\">"
1708 (format "@<span class=\"timestamp-kwd\">%s @</span>"
1709 (match-string 1 s
)))
1710 (format " @<span class=\"timestamp\">%s@</span>"
1712 (org-translate-time (match-string 3 s
)) 1 -
1))
1714 s
(substring s
(match-end 0))))
1715 ;; Line break if line started and ended with time stamp stuff
1718 (setq r
(concat r s
))
1719 (unless (string-match "\\S-" (concat b s
))
1720 (setq r
(concat r
"@<br/>")))
1723 (defvar htmlize-buffer-places
) ; from htmlize.el
1724 (defun org-export-htmlize-region-for-paste (beg end
)
1725 "Convert the region to HTML, using htmlize.el.
1726 This is much like `htmlize-region-for-paste', only that it uses
1727 the settings define in the org-... variables."
1728 (let* ((htmlize-output-type org-export-htmlize-output-type
)
1729 (htmlize-css-name-prefix org-export-htmlize-css-font-prefix
)
1730 (htmlbuf (htmlize-region beg end
)))
1732 (with-current-buffer htmlbuf
1733 (buffer-substring (plist-get htmlize-buffer-places
'content-start
)
1734 (plist-get htmlize-buffer-places
'content-end
)))
1735 (kill-buffer htmlbuf
))))
1738 (defun org-export-htmlize-generate-css ()
1739 "Create the CSS for all font definitions in the current Emacs session.
1740 Use this to create face definitions in your CSS style file that can then
1741 be used by code snippets transformed by htmlize.
1742 This command just produces a buffer that contains class definitions for all
1743 faces used in the current Emacs session. You can copy and paste the ones you
1744 need into your CSS file.
1746 If you then set `org-export-htmlize-output-type' to `css', calls to
1747 the function `org-export-htmlize-region-for-paste' will produce code
1748 that uses these same face definitions."
1751 (and (get-buffer "*html*") (kill-buffer "*html*"))
1753 (let ((fl (face-list))
1754 (htmlize-css-name-prefix "org-")
1755 (htmlize-output-type 'css
)
1757 (while (setq f
(pop fl
)
1758 i
(and f
(face-attribute f
:inherit
)))
1759 (when (and (symbolp f
) (or (not i
) (not (listp i
))))
1760 (insert (org-add-props (copy-sequence "1") nil
'face f
))))
1761 (htmlize-region (point-min) (point-max))))
1762 (switch-to-buffer "*html*")
1763 (goto-char (point-min))
1764 (if (re-search-forward "<style" nil t
)
1765 (delete-region (point-min) (match-beginning 0)))
1766 (if (re-search-forward "</style>" nil t
)
1767 (delete-region (1+ (match-end 0)) (point-max)))
1768 (beginning-of-line 1)
1769 (if (looking-at " +") (replace-match ""))
1770 (goto-char (point-min)))
1772 (defun org-html-protect (s)
1773 ;; convert & to &, < to < and > to >
1775 (while (string-match "&" s start
)
1776 (setq s
(replace-match "&" t t s
)
1777 start
(1+ (match-beginning 0))))
1778 (while (string-match "<" s
)
1779 (setq s
(replace-match "<" t t s
)))
1780 (while (string-match ">" s
)
1781 (setq s
(replace-match ">" t t s
)))
1782 ; (while (string-match "\"" s)
1783 ; (setq s (replace-match """ t t s)))
1787 (defun org-html-expand (string)
1788 "Prepare STRING for HTML export. Applies all active conversions.
1789 If there are links in the string, don't modify these."
1790 (let* ((re (concat org-bracket-link-regexp
"\\|"
1791 (org-re "[ \t]+\\(:[[:alnum:]_@:]+:\\)[ \t]*$")))
1793 (while (setq m
(string-match re string
))
1794 (setq s
(substring string
0 m
)
1795 l
(match-string 0 string
)
1796 string
(substring string
(match-end 0)))
1797 (push (org-html-do-expand s
) res
)
1799 (push (org-html-do-expand string
) res
)
1800 (apply 'concat
(nreverse res
))))
1802 (defun org-html-do-expand (s)
1803 "Apply all active conversions to translate special ASCII to HTML."
1804 (setq s
(org-html-protect s
))
1805 (if org-export-html-expand
1806 (while (string-match "@<\\([^&]*\\)>" s
)
1807 (setq s
(replace-match "<\\1>" t nil s
))))
1808 (if org-export-with-emphasize
1809 (setq s
(org-export-html-convert-emphasize s
)))
1810 (if org-export-with-special-strings
1811 (setq s
(org-export-html-convert-special-strings s
)))
1812 (if org-export-with-sub-superscripts
1813 (setq s
(org-export-html-convert-sub-super s
)))
1814 (if org-export-with-TeX-macros
1815 (let ((start 0) wd ass
)
1816 (while (setq start
(string-match "\\\\\\([a-zA-Z]+\\)\\({}\\)?"
1818 (if (get-text-property (match-beginning 0) 'org-protected s
)
1819 (setq start
(match-end 0))
1820 (setq wd
(match-string 1 s
))
1821 (if (setq ass
(assoc wd org-html-entities
))
1822 (setq s
(replace-match (or (cdr ass
)
1823 (concat "&" (car ass
) ";"))
1825 (setq start
(+ start
(length wd
))))))))
1828 (defconst org-export-html-special-string-regexps
1829 '(("\\\\-" .
"­")
1830 ("---\\([^-]\\)" .
"—\\1")
1831 ("--\\([^-]\\)" .
"–\\1")
1832 ("\\.\\.\\." .
"…"))
1833 "Regular expressions for special string conversion.")
1835 (defun org-export-html-convert-special-strings (string)
1836 "Convert special characters in STRING to HTML."
1837 (let ((all org-export-html-special-string-regexps
)
1839 (while (setq a
(pop all
))
1840 (setq re
(car a
) rpl
(cdr a
) start
0)
1841 (while (string-match re string start
)
1842 (if (get-text-property (match-beginning 0) 'org-protected string
)
1843 (setq start
(match-end 0))
1844 (setq string
(replace-match rpl t nil string
)))))
1847 (defun org-export-html-convert-sub-super (string)
1848 "Convert sub- and superscripts in STRING to HTML."
1849 (let (key c
(s 0) (requireb (eq org-export-with-sub-superscripts
'{})))
1850 (while (string-match org-match-substring-regexp string s
)
1852 ((and requireb
(match-end 8)) (setq s
(match-end 2)))
1853 ((get-text-property (match-beginning 2) 'org-protected string
)
1854 (setq s
(match-end 2)))
1856 (setq s
(match-end 1)
1857 key
(if (string= (match-string 2 string
) "_") "sub" "sup")
1858 c
(or (match-string 8 string
)
1859 (match-string 6 string
)
1860 (match-string 5 string
))
1861 string
(replace-match
1862 (concat (match-string 1 string
)
1863 "<" key
">" c
"</" key
">")
1865 (while (string-match "\\\\\\([_^]\\)" string
)
1866 (setq string
(replace-match (match-string 1 string
) t t string
)))
1869 (defun org-export-html-convert-emphasize (string)
1872 (while (string-match org-emph-re string s
)
1874 (substring string
(match-beginning 3) (1+ (match-beginning 3)))
1875 (substring string
(match-beginning 4) (1+ (match-beginning 4)))))
1876 (setq s
(match-beginning 0)
1879 (match-string 1 string
)
1880 (nth 2 (assoc (match-string 3 string
) org-emphasis-alist
))
1881 (match-string 4 string
)
1882 (nth 3 (assoc (match-string 3 string
)
1883 org-emphasis-alist
))
1884 (match-string 5 string
))
1885 string
(replace-match rpl t t string
)
1886 s
(+ s
(- (length rpl
) 2)))
1890 (defun org-open-par ()
1891 "Insert <p>, but first close previous paragraph if any."
1892 (org-close-par-maybe)
1894 (setq org-par-open t
))
1895 (defun org-close-par-maybe ()
1896 "Close paragraph if there is one open."
1899 (setq org-par-open nil
)))
1900 (defun org-close-li (&optional type
)
1901 "Close <li> if necessary."
1902 (org-close-par-maybe)
1903 (insert (if (equal type
"d") "</dd>\n" "</li>\n")))
1905 (defvar in-local-list
)
1906 (defvar local-list-indent
)
1907 (defvar local-list-type
)
1908 (defun org-export-html-close-lists-maybe (line)
1909 (let ((ind (or (get-text-property 0 'original-indentation line
)))
1910 ; (and (string-match "\\S-" line)
1911 ; (org-get-indentation line))))
1914 (while (and in-local-list
1915 (<= ind
(car local-list-indent
)))
1917 (org-close-li (car local-list-type
))
1918 (insert (format "</%sl>\n" (car local-list-type
)))
1919 (pop local-list-type
) (pop local-list-indent
)
1920 (setq in-local-list local-list-indent
))
1921 (and didclose
(org-open-par)))))
1923 (defvar body-only
) ; dynamically scoped into this.
1924 (defun org-html-level-start (level title umax with-toc head-count
)
1925 "Insert a new level in HTML export.
1926 When TITLE is nil, just close all open levels."
1927 (org-close-par-maybe)
1928 (let* ((target (and title
(org-get-text-property-any 0 'target title
)))
1929 (extra-targets (assoc target org-export-target-aliases
))
1930 (preferred (cdr (assoc target org-export-preferred-target-alist
)))
1931 (remove (or preferred target
))
1933 snumber href suffix
)
1934 (setq extra-targets
(remove remove extra-targets
))
1936 (mapconcat (lambda (x)
1937 (if (org-uuidgen-p x
) (setq x
(concat "ID-" x
)))
1938 (format "<a name=\"%s\" id=\"%s\"></a>"
1943 (if (aref org-levels-open
(1- l
))
1945 (org-html-level-close l umax
)
1946 (aset org-levels-open
(1- l
) nil
)))
1949 ;; If title is nil, this means this function is called to close
1950 ;; all levels, so the rest is done only if title is given
1951 (when (string-match (org-re "\\(:[[:alnum:]_@:]+:\\)[ \t]*$") title
)
1952 (setq title
(replace-match
1953 (if org-export-with-tags
1956 " <span class=\"tag\">"
1959 (format "<span class=\"%s\">%s</span>"
1960 (org-export-html-get-tag-class-name x
)
1962 (org-split-string (match-string 1 title
) ":")
1969 (if (aref org-levels-open
(1- level
))
1973 (insert (format "<li id=\"%s\">" target
) extra-targets title
"<br/>\n")
1974 (insert "<li>" title
"<br/>\n")))
1975 (aset org-levels-open
(1- level
) t
)
1976 (org-close-par-maybe)
1978 (insert (format "<ul>\n<li id=\"%s\">" target
)
1979 extra-targets title
"<br/>\n")
1980 (insert "<ul>\n<li>" title
"<br/>\n"))))
1981 (aset org-levels-open
(1- level
) t
)
1982 (setq snumber
(org-section-number level
))
1983 (setq level
(+ level org-export-html-toplevel-hlevel -
1))
1984 (if (and org-export-with-section-numbers
(not body-only
))
1986 (format "<span class=\"section-number-%d\">%s</span>"
1989 (unless (= head-count
1) (insert "\n</div>\n"))
1990 (setq href
(cdr (assoc (concat "sec-" snumber
) org-export-preferred-target-alist
)))
1991 (setq suffix
(or href snumber
))
1992 (setq href
(or href
(concat "sec-" snumber
)))
1993 (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"
1994 suffix level level href
1996 title level level suffix
))
1999 (defun org-export-html-get-tag-class-name (tag)
2000 "Turn tag into a valid class name.
2001 Replaces invalid characters with \"_\" and then prepends a prefix."
2003 (while (string-match "[^a-zA-Z0-9_]" tag
)
2004 (setq tag
(replace-match "_" t t tag
))))
2005 (concat org-export-html-tag-class-prefix tag
))
2007 (defun org-export-html-get-todo-kwd-class-name (kwd)
2008 "Turn todo keyword into a valid class name.
2009 Replaces invalid characters with \"_\" and then prepends a prefix."
2011 (while (string-match "[^a-zA-Z0-9_]" kwd
)
2012 (setq kwd
(replace-match "_" t t kwd
))))
2013 (concat org-export-html-todo-kwd-class-prefix kwd
))
2015 (defun org-html-level-close (level max-outline-level
)
2016 "Terminate one level in HTML export."
2017 (if (<= level max-outline-level
)
2020 (insert "</ul>\n")))
2024 ;; arch-tag: 8109d84d-eb8f-460b-b1a8-f45f3a6c7ea1
2026 ;;; org-html.el ends here