org-element: Rename `time-stamp' object type into `timestamp'
[org-mode/org-mode-NeilSmithlineMods.git] / contrib / lisp / org-e-html.el
blob20a7c67f39a3ac4ce0f6ceeff4cb6aba184d7385
1 ;;; org-e-html.el --- HTML Back-End For Org Export Engine
3 ;; Copyright (C) 2011-2012 Free Software Foundation, Inc.
5 ;; Author: Jambunathan K <kjambunathan at gmail dot com>
6 ;; Keywords: outlines, hypermedia, calendar, wp
8 ;; This program is free software; you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation, either version 3 of the License, or
11 ;; (at your option) any later version.
13 ;; This program is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;; GNU General Public License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
21 ;;; Commentary:
23 ;; This library implements a HTML back-end for Org generic exporter.
25 ;; To test it, run
27 ;; M-: (org-export-to-buffer 'e-html "*Test e-HTML*") RET
29 ;; in an org-mode buffer then switch to the buffer to see the HTML
30 ;; export. See contrib/lisp/org-export.el for more details on how
31 ;; this exporter works.
33 ;;; Code:
35 ;;; org-e-html.el
36 ;;; Dependencies
38 (require 'format-spec)
39 (eval-when-compile (require 'cl) (require 'table))
43 ;;; Function Declarations
45 (declare-function org-element-get-property "org-element" (property element))
46 (declare-function org-element-normalize-string "org-element" (s))
47 (declare-function org-element-parse-secondary-string
48 "org-element" (string restriction &optional buffer))
49 (defvar org-element-string-restrictions)
50 (defvar org-element-object-restrictions)
52 (declare-function org-export-data "org-export" (data info))
53 (declare-function org-export-directory "org-export" (type plist))
54 (declare-function org-export-expand-macro "org-export" (macro info))
55 (declare-function org-export-first-sibling-p "org-export" (headline info))
56 (declare-function org-export-footnote-first-reference-p "org-export"
57 (footnote-reference info))
58 (declare-function org-export-get-coderef-format "org-export" (path desc))
59 (declare-function org-export-get-footnote-definition "org-export"
60 (footnote-reference info))
61 (declare-function org-export-get-footnote-number "org-export" (footnote info))
62 (declare-function org-export-get-previous-element "org-export" (blob info))
63 (declare-function org-export-get-relative-level "org-export" (headline info))
64 (declare-function org-export-handle-code
65 "org-export" (element info &optional num-fmt ref-fmt delayed))
66 (declare-function org-export-inline-image-p "org-export"
67 (link &optional extensions))
68 (declare-function org-export-last-sibling-p "org-export" (headline info))
69 (declare-function org-export-low-level-p "org-export" (headline info))
70 (declare-function org-export-output-file-name
71 "org-export" (extension &optional subtreep pub-dir))
72 (declare-function org-export-resolve-coderef "org-export" (ref info))
73 (declare-function org-export-resolve-fuzzy-link "org-export" (link info))
74 (declare-function org-export-secondary-string "org-export" (secondary info))
75 (declare-function org-export-solidify-link-text "org-export" (s))
76 (declare-function
77 org-export-to-buffer "org-export"
78 (backend buffer &optional subtreep visible-only body-only ext-plist))
79 (declare-function
80 org-export-to-file "org-export"
81 (backend file &optional subtreep visible-only body-only ext-plist))
83 (declare-function org-id-find-id-file "org-id" (id))
84 (declare-function htmlize-region "ext:htmlize" (beg end))
85 (declare-function org-pop-to-buffer-same-window
86 "org-compat" (&optional buffer-or-name norecord label))
91 ;;; Internal Variables
93 (defconst org-e-html-option-alist
94 '((:agenda-style nil nil org-agenda-export-html-style)
95 (:convert-org-links nil nil org-e-html-link-org-files-as-html)
96 ;; FIXME Use (org-xml-encode-org-text-skip-links s) ??
97 ;; (:expand-quoted-html nil "@" org-e-html-expand)
98 (:inline-images nil nil org-e-html-inline-images)
99 ;; (:link-home nil nil org-e-html-link-home) FIXME
100 ;; (:link-up nil nil org-e-html-link-up) FIXME
101 (:style nil nil org-e-html-style)
102 (:style-extra nil nil org-e-html-style-extra)
103 (:style-include-default nil nil org-e-html-style-include-default)
104 (:style-include-scripts nil nil org-e-html-style-include-scripts)
105 ;; (:timestamp nil nil org-e-html-with-timestamp)
106 (:html-extension nil nil org-e-html-extension)
107 (:html-postamble nil nil org-e-html-postamble)
108 (:html-preamble nil nil org-e-html-preamble)
109 (:html-table-tag nil nil org-e-html-table-tag)
110 (:xml-declaration nil nil org-e-html-xml-declaration)
111 (:LaTeX-fragments nil "LaTeX" org-export-with-LaTeX-fragments)
112 (:mathjax "MATHJAX" nil "" space))
113 "Alist between export properties and ways to set them.
115 The car of the alist is the property name, and the cdr is a list
116 like \(KEYWORD OPTION DEFAULT BEHAVIOUR\) where:
118 KEYWORD is a string representing a buffer keyword, or nil.
119 OPTION is a string that could be found in an #+OPTIONS: line.
120 DEFAULT is the default value for the property.
121 BEHAVIOUR determine how Org should handle multiple keywords for
122 the same property. It is a symbol among:
123 nil Keep old value and discard the new one.
124 t Replace old value with the new one.
125 `space' Concatenate the values, separating them with a space.
126 `newline' Concatenate the values, separating them with
127 a newline.
128 `split' Split values at white spaces, and cons them to the
129 previous list.
131 KEYWORD and OPTION have precedence over DEFAULT.
133 All these properties should be back-end agnostic. For back-end
134 specific properties, define a similar variable named
135 `org-BACKEND-option-alist', replacing BACKEND with the name of
136 the appropriate back-end. You can also redefine properties
137 there, as they have precedence over these.")
139 ;; FIXME: it already exists in org-e-html.el
140 (defconst org-e-html-cvt-link-fn
142 "Function to convert link URLs to exportable URLs.
143 Takes two arguments, TYPE and PATH.
144 Returns exportable url as (TYPE PATH), or nil to signal that it
145 didn't handle this case.
146 Intended to be locally bound around a call to `org-export-as-html'." )
151 (defvar org-e-html-format-table-no-css)
152 (defvar htmlize-buffer-places) ; from htmlize.el
153 (defvar body-only) ; dynamically scoped into this.
157 ;;; User Configuration Variables
159 (defgroup org-export-e-html nil
160 "Options for exporting Org mode files to HTML."
161 :tag "Org Export HTML"
162 :group 'org-export)
164 ;;;; Debugging
166 (defcustom org-e-html-pretty-output nil
167 "Enable this to generate pretty HTML."
168 :group 'org-export-e-html
169 :type 'boolean)
172 ;;;; Document
174 (defcustom org-e-html-extension "html"
175 "The extension for exported HTML files."
176 :group 'org-export-e-html
177 :type 'string)
179 (defcustom org-e-html-xml-declaration
180 '(("html" . "<?xml version=\"1.0\" encoding=\"%s\"?>")
181 ("php" . "<?php echo \"<?xml version=\\\"1.0\\\" encoding=\\\"%s\\\" ?>\"; ?>"))
182 "The extension for exported HTML files.
183 %s will be replaced with the charset of the exported file.
184 This may be a string, or an alist with export extensions
185 and corresponding declarations."
186 :group 'org-export-e-html
187 :type '(choice
188 (string :tag "Single declaration")
189 (repeat :tag "Dependent on extension"
190 (cons (string :tag "Extension")
191 (string :tag "Declaration")))))
193 ;; Use `org-export-coding-system' instead
194 ;; (defcustom org-e-html-coding-system nil
195 ;; "Coding system for HTML export, defaults to `buffer-file-coding-system'."
196 ;; :group 'org-export-e-html
197 ;; :type 'coding-system)
199 (defvar org-e-html-content-div "content"
200 "The name of the container DIV that holds all the page contents.
202 This variable is obsolete since Org version 7.7.
203 Please set `org-e-html-divs' instead.")
205 (defcustom org-e-html-divs '("preamble" "content" "postamble")
206 "The name of the main divs for HTML export.
207 This is a list of three strings, the first one for the preamble
208 DIV, the second one for the content DIV and the third one for the
209 postamble DIV."
210 :group 'org-export-e-html
211 :type '(list
212 (string :tag " Div for the preamble:")
213 (string :tag " Div for the content:")
214 (string :tag "Div for the postamble:")))
217 ;;;; Document Header (Styles)
219 (defconst org-e-html-style-default
220 "<style type=\"text/css\">
221 <!--/*--><![CDATA[/*><!--*/
222 html { font-family: Times, serif; font-size: 12pt; }
223 .title { text-align: center; }
224 .todo { color: red; }
225 .done { color: green; }
226 .tag { background-color: #add8e6; font-weight:normal }
227 .target { }
228 .timestamp { color: #bebebe; }
229 .timestamp-kwd { color: #5f9ea0; }
230 .right {margin-left:auto; margin-right:0px; text-align:right;}
231 .left {margin-left:0px; margin-right:auto; text-align:left;}
232 .center {margin-left:auto; margin-right:auto; text-align:center;}
233 p.verse { margin-left: 3% }
234 pre {
235 border: 1pt solid #AEBDCC;
236 background-color: #F3F5F7;
237 padding: 5pt;
238 font-family: courier, monospace;
239 font-size: 90%;
240 overflow:auto;
242 table { border-collapse: collapse; }
243 td, th { vertical-align: top; }
244 th.right { text-align:center; }
245 th.left { text-align:center; }
246 th.center { text-align:center; }
247 td.right { text-align:right; }
248 td.left { text-align:left; }
249 td.center { text-align:center; }
250 dt { font-weight: bold; }
251 div.figure { padding: 0.5em; }
252 div.figure p { text-align: center; }
253 div.inlinetask {
254 padding:10px;
255 border:2px solid gray;
256 margin:10px;
257 background: #ffffcc;
259 textarea { overflow-x: auto; }
260 .linenr { font-size:smaller }
261 .code-highlighted {background-color:#ffff00;}
262 .org-info-js_info-navigation { border-style:none; }
263 #org-info-js_console-label { font-size:10px; font-weight:bold;
264 white-space:nowrap; }
265 .org-info-js_search-highlight {background-color:#ffff00; color:#000000;
266 font-weight:bold; }
267 /*]]>*/-->
268 </style>"
269 "The default style specification for exported HTML files.
270 Please use the variables `org-e-html-style' and
271 `org-e-html-style-extra' to add to this style. If you wish to not
272 have the default style included, customize the variable
273 `org-e-html-style-include-default'.")
275 (defcustom org-e-html-style-include-default t
276 "Non-nil means include the default style in exported HTML files.
277 The actual style is defined in `org-e-html-style-default' and should
278 not be modified. Use the variables `org-e-html-style' to add
279 your own style information."
280 :group 'org-export-e-html
281 :type 'boolean)
282 ;;;###autoload
283 (put 'org-e-html-style-include-default 'safe-local-variable 'booleanp)
285 (defcustom org-e-html-style ""
286 "Org-wide style definitions for exported HTML files.
288 This variable needs to contain the full HTML structure to provide a style,
289 including the surrounding HTML tags. If you set the value of this variable,
290 you should consider to include definitions for the following classes:
291 title, todo, done, timestamp, timestamp-kwd, tag, target.
293 For example, a valid value would be:
295 <style type=\"text/css\">
296 <![CDATA[
297 p { font-weight: normal; color: gray; }
298 h1 { color: black; }
299 .title { text-align: center; }
300 .todo, .timestamp-kwd { color: red; }
301 .done { color: green; }
303 </style>
305 If you'd like to refer to an external style file, use something like
307 <link rel=\"stylesheet\" type=\"text/css\" href=\"mystyles.css\">
309 As the value of this option simply gets inserted into the HTML <head> header,
310 you can \"misuse\" it to add arbitrary text to the header.
311 See also the variable `org-e-html-style-extra'."
312 :group 'org-export-e-html
313 :type 'string)
314 ;;;###autoload
315 (put 'org-e-html-style 'safe-local-variable 'stringp)
317 (defcustom org-e-html-style-extra ""
318 "Additional style information for HTML export.
319 The value of this variable is inserted into the HTML buffer right after
320 the value of `org-e-html-style'. Use this variable for per-file
321 settings of style information, and do not forget to surround the style
322 settings with <style>...</style> tags."
323 :group 'org-export-e-html
324 :type 'string)
325 ;;;###autoload
326 (put 'org-e-html-style-extra 'safe-local-variable 'stringp)
328 (defcustom org-e-html-mathjax-options
329 '((path "http://orgmode.org/mathjax/MathJax.js")
330 (scale "100")
331 (align "center")
332 (indent "2em")
333 (mathml nil))
334 "Options for MathJax setup.
336 path The path where to find MathJax
337 scale Scaling for the HTML-CSS backend, usually between 100 and 133
338 align How to align display math: left, center, or right
339 indent If align is not center, how far from the left/right side?
340 mathml Should a MathML player be used if available?
341 This is faster and reduces bandwidth use, but currently
342 sometimes has lower spacing quality. Therefore, the default is
343 nil. When browsers get better, this switch can be flipped.
345 You can also customize this for each buffer, using something like
347 #+MATHJAX: scale:\"133\" align:\"right\" mathml:t path:\"/MathJax/\""
348 :group 'org-export-e-html
349 :type '(list :greedy t
350 (list :tag "path (the path from where to load MathJax.js)"
351 (const :format " " path) (string))
352 (list :tag "scale (scaling for the displayed math)"
353 (const :format " " scale) (string))
354 (list :tag "align (alignment of displayed equations)"
355 (const :format " " align) (string))
356 (list :tag "indent (indentation with left or right alignment)"
357 (const :format " " indent) (string))
358 (list :tag "mathml (should MathML display be used is possible)"
359 (const :format " " mathml) (boolean))))
362 ;;;; Document Header (Scripts)
364 (defcustom org-e-html-style-include-scripts t
365 "Non-nil means include the JavaScript snippets in exported HTML files.
366 The actual script is defined in `org-e-html-scripts' and should
367 not be modified."
368 :group 'org-export-e-html
369 :type 'boolean)
371 (defconst org-e-html-scripts
372 "<script type=\"text/javascript\">
373 <!--/*--><![CDATA[/*><!--*/
374 function CodeHighlightOn(elem, id)
376 var target = document.getElementById(id);
377 if(null != target) {
378 elem.cacheClassElem = elem.className;
379 elem.cacheClassTarget = target.className;
380 target.className = \"code-highlighted\";
381 elem.className = \"code-highlighted\";
384 function CodeHighlightOff(elem, id)
386 var target = document.getElementById(id);
387 if(elem.cacheClassElem)
388 elem.className = elem.cacheClassElem;
389 if(elem.cacheClassTarget)
390 target.className = elem.cacheClassTarget;
392 /*]]>*///-->
393 </script>"
394 "Basic JavaScript that is needed by HTML files produced by Org-mode.")
397 ;;;; Document Header (Mathjax)
399 (defcustom org-e-html-mathjax-template
400 "<script type=\"text/javascript\" src=\"%PATH\">
401 <!--/*--><![CDATA[/*><!--*/
402 MathJax.Hub.Config({
403 // Only one of the two following lines, depending on user settings
404 // First allows browser-native MathML display, second forces HTML/CSS
405 :MMLYES: config: [\"MMLorHTML.js\"], jax: [\"input/TeX\"],
406 :MMLNO: jax: [\"input/TeX\", \"output/HTML-CSS\"],
407 extensions: [\"tex2jax.js\",\"TeX/AMSmath.js\",\"TeX/AMSsymbols.js\",
408 \"TeX/noUndefined.js\"],
409 tex2jax: {
410 inlineMath: [ [\"\\\\(\",\"\\\\)\"] ],
411 displayMath: [ ['$$','$$'], [\"\\\\[\",\"\\\\]\"], [\"\\\\begin{displaymath}\",\"\\\\end{displaymath}\"] ],
412 skipTags: [\"script\",\"noscript\",\"style\",\"textarea\",\"pre\",\"code\"],
413 ignoreClass: \"tex2jax_ignore\",
414 processEscapes: false,
415 processEnvironments: true,
416 preview: \"TeX\"
418 showProcessingMessages: true,
419 displayAlign: \"%ALIGN\",
420 displayIndent: \"%INDENT\",
422 \"HTML-CSS\": {
423 scale: %SCALE,
424 availableFonts: [\"STIX\",\"TeX\"],
425 preferredFont: \"TeX\",
426 webFont: \"TeX\",
427 imageFont: \"TeX\",
428 showMathMenu: true,
430 MMLorHTML: {
431 prefer: {
432 MSIE: \"MML\",
433 Firefox: \"MML\",
434 Opera: \"HTML\",
435 other: \"HTML\"
439 /*]]>*///-->
440 </script>"
441 "The MathJax setup for XHTML files."
442 :group 'org-export-e-html
443 :type 'string)
446 ;;;; Preamble
448 (defcustom org-e-html-preamble t
449 "Non-nil means insert a preamble in HTML export.
451 When `t', insert a string as defined by one of the formatting
452 strings in `org-e-html-preamble-format'. When set to a
453 string, this string overrides `org-e-html-preamble-format'.
454 When set to a function, apply this function and insert the
455 returned string. The function takes the property list of export
456 options as its only argument.
458 Setting :html-preamble in publishing projects will take
459 precedence over this variable."
460 :group 'org-export-e-html
461 :type '(choice (const :tag "No preamble" nil)
462 (const :tag "Default preamble" t)
463 (string :tag "Custom formatting string")
464 (function :tag "Function (must return a string)")))
466 (defcustom org-e-html-preamble-format '(("en" ""))
467 "The format for the HTML preamble.
469 %t stands for the title.
470 %a stands for the author's name.
471 %e stands for the author's email.
472 %d stands for the date.
474 If you need to use a \"%\" character, you need to escape it
475 like that: \"%%\"."
476 :group 'org-export-e-html
477 :type 'string)
479 (defcustom org-e-html-home/up-format
480 "<div id=\"org-div-home-and-up\" style=\"text-align:right;font-size:70%%;white-space:nowrap;\">
481 <a accesskey=\"h\" href=\"%s\"> UP </a>
483 <a accesskey=\"H\" href=\"%s\"> HOME </a>
484 </div>"
485 "Snippet used to insert the HOME and UP links.
486 This is a format string, the first %s will receive the UP link,
487 the second the HOME link. If both `org-e-html-link-up' and
488 `org-e-html-link-home' are empty, the entire snippet will be
489 ignored."
490 :group 'org-export-e-html
491 :type 'string)
493 ;;;; Postamble
495 (defcustom org-e-html-postamble 'auto
496 "Non-nil means insert a postamble in HTML export.
498 When `t', insert a string as defined by the formatting string in
499 `org-e-html-postamble-format'. When set to a string, this
500 string overrides `org-e-html-postamble-format'. When set to
501 'auto, discard `org-e-html-postamble-format' and honor
502 `org-export-author/email/creator-info' variables. When set to a
503 function, apply this function and insert the returned string.
504 The function takes the property list of export options as its
505 only argument.
507 Setting :html-postamble in publishing projects will take
508 precedence over this variable."
509 :group 'org-export-e-html
510 :type '(choice (const :tag "No postamble" nil)
511 (const :tag "Auto preamble" 'auto)
512 (const :tag "Default formatting string" t)
513 (string :tag "Custom formatting string")
514 (function :tag "Function (must return a string)")))
516 (defcustom org-e-html-postamble-format
517 '(("en" "<p class=\"author\">Author: %a (%e)</p>
518 <p class=\"date\">Date: %d</p>
519 <p class=\"creator\">Generated by %c</p>
520 <p class=\"xhtml-validation\">%v</p>
522 "The format for the HTML postamble.
524 %a stands for the author's name.
525 %e stands for the author's email.
526 %d stands for the date.
527 %c will be replaced by information about Org/Emacs versions.
528 %v will be replaced by `org-e-html-validation-link'.
530 If you need to use a \"%\" character, you need to escape it
531 like that: \"%%\"."
532 :group 'org-export-e-html
533 :type 'string)
535 (defcustom org-e-html-validation-link
536 "<a href=\"http://validator.w3.org/check?uri=referer\">Validate XHTML 1.0</a>"
537 "Link to HTML validation service."
538 :group 'org-export-e-html
539 :type 'string)
541 ;; FIXME Obsolete since Org 7.7
542 ;; Use the :timestamp option or `org-export-time-stamp-file' instead
543 ;;;; Emphasis
545 (defcustom org-e-html-protect-char-alist
546 '(("&" . "&amp;")
547 ("<" . "&lt;")
548 (">" . "&gt;"))
549 "Alist of characters to be converted by `org-e-html-protect'."
550 :group 'org-export-e-html
551 :type '(repeat (cons (string :tag "Character")
552 (string :tag "HTML equivalent"))))
554 (defconst org-e-html-special-string-regexps
555 '(("\\\\-" . "&shy;")
556 ("---\\([^-]\\)" . "&mdash;\\1")
557 ("--\\([^-]\\)" . "&ndash;\\1")
558 ("\\.\\.\\." . "&hellip;"))
559 "Regular expressions for special string conversion.")
562 ;;;; Todos
564 (defcustom org-e-html-todo-kwd-class-prefix ""
565 "Prefix to class names for TODO keywords.
566 Each TODO keyword gets a class given by the keyword itself, with this prefix.
567 The default prefix is empty because it is nice to just use the keyword
568 as a class name. But if you get into conflicts with other, existing
569 CSS classes, then this prefix can be very useful."
570 :group 'org-export-e-html
571 :type 'string)
574 ;;;; Tags
576 (defcustom org-e-html-tag-class-prefix ""
577 "Prefix to class names for TODO keywords.
578 Each tag gets a class given by the tag itself, with this prefix.
579 The default prefix is empty because it is nice to just use the keyword
580 as a class name. But if you get into conflicts with other, existing
581 CSS classes, then this prefix can be very useful."
582 :group 'org-export-e-html
583 :type 'string)
585 ;;;; Timestamps
586 ;;;; Statistics Cookie
587 ;;;; Subscript
588 ;;;; Superscript
590 ;;;; Inline images
592 (defcustom org-e-html-inline-images 'maybe
593 "Non-nil means inline images into exported HTML pages.
594 This is done using an <img> tag. When nil, an anchor with href is used to
595 link to the image. If this option is `maybe', then images in links with
596 an empty description will be inlined, while images with a description will
597 be linked only."
598 :group 'org-export-e-html
599 :type '(choice (const :tag "Never" nil)
600 (const :tag "Always" t)
601 (const :tag "When there is no description" maybe)))
603 (defcustom org-e-html-inline-image-extensions
604 '("png" "jpeg" "jpg" "gif" "svg")
605 "Extensions of image files that can be inlined into HTML."
606 :group 'org-export-e-html
607 :type '(repeat (string :tag "Extension")))
610 ;;;; Block
611 ;;;; Comment
612 ;;;; Comment Block
613 ;;;; Drawer
614 ;;;; Dynamic Block
615 ;;;; Emphasis
616 ;;;; Entity
617 ;;;; Example Block
618 ;;;; Export Snippet
619 ;;;; Export Block
620 ;;;; Fixed Width
621 ;;;; Footnotes
623 (defcustom org-e-html-footnotes-section "<div id=\"footnotes\">
624 <h2 class=\"footnotes\">%s: </h2>
625 <div id=\"text-footnotes\">
627 </div>
628 </div>"
629 "Format for the footnotes section.
630 Should contain a two instances of %s. The first will be replaced with the
631 language-specific word for \"Footnotes\", the second one will be replaced
632 by the footnotes themselves."
633 :group 'org-export-e-html
634 :type 'string)
636 (defcustom org-e-html-footnote-format "<sup>%s</sup>"
637 "The format for the footnote reference.
638 %s will be replaced by the footnote reference itself."
639 :group 'org-export-e-html
640 :type 'string)
642 (defcustom org-e-html-footnote-separator "<sup>, </sup>"
643 "Text used to separate footnotes."
644 :group 'org-export-e-html
645 :type 'string)
648 ;;;; Headline
649 ;;;; Horizontal Rule
650 ;;;; Inline Babel Call
651 ;;;; Inline Src Block
652 ;;;; Inlinetask
653 ;;;; Item
654 ;;;; Keyword
655 ;;;; Latex Environment
656 ;;;; Latex Fragment
657 ;;;; Line Break
658 ;;;; Link
659 ;;;; Babel Call
660 ;;;; Macro
661 ;;;; Paragraph
662 ;;;; Plain List
663 ;;;; Plain Text
664 ;;;; Property Drawer
665 ;;;; Quote Block
666 ;;;; Quote Section
667 ;;;; Section
668 ;;;; Radio Target
669 ;;;; Special Block
670 ;;;; Src Block
672 (defgroup org-export-e-htmlize nil
673 "Options for processing examples with htmlize.el."
674 :tag "Org Export Htmlize"
675 :group 'org-export-e-html)
677 (defcustom org-export-e-htmlize-output-type 'inline-css
678 "Output type to be used by htmlize when formatting code snippets.
679 Choices are `css', to export the CSS selectors only, or `inline-css', to
680 export the CSS attribute values inline in the HTML. We use as default
681 `inline-css', in order to make the resulting HTML self-containing.
683 However, this will fail when using Emacs in batch mode for export, because
684 then no rich font definitions are in place. It will also not be good if
685 people with different Emacs setup contribute HTML files to a website,
686 because the fonts will represent the individual setups. In these cases,
687 it is much better to let Org/Htmlize assign classes only, and to use
688 a style file to define the look of these classes.
689 To get a start for your css file, start Emacs session and make sure that
690 all the faces you are interested in are defined, for example by loading files
691 in all modes you want. Then, use the command
692 \\[org-export-e-htmlize-generate-css] to extract class definitions."
693 :group 'org-export-e-htmlize
694 :type '(choice (const css) (const inline-css)))
696 (defcustom org-export-e-htmlize-css-font-prefix "org-"
697 "The prefix for CSS class names for htmlize font specifications."
698 :group 'org-export-e-htmlize
699 :type 'string)
701 (defcustom org-export-e-htmlized-org-css-url nil
702 "URL pointing to a CSS file defining text colors for htmlized Emacs buffers.
703 Normally when creating an htmlized version of an Org buffer, htmlize will
704 create CSS to define the font colors. However, this does not work when
705 converting in batch mode, and it also can look bad if different people
706 with different fontification setup work on the same website.
707 When this variable is non-nil, creating an htmlized version of an Org buffer
708 using `org-export-as-org' will remove the internal CSS section and replace it
709 with a link to this URL."
710 :group 'org-export-e-htmlize
711 :type '(choice
712 (const :tag "Keep internal css" nil)
713 (string :tag "URL or local href")))
716 ;;;; Table
718 (defcustom org-e-html-table-tag
719 "<table border=\"2\" cellspacing=\"0\" cellpadding=\"6\" rules=\"groups\" frame=\"hsides\">"
720 "The HTML tag that is used to start a table.
721 This must be a <table> tag, but you may change the options like
722 borders and spacing."
723 :group 'org-export-e-html
724 :type 'string)
726 (defcustom org-e-html-table-header-tags '("<th scope=\"%s\"%s>" . "</th>")
727 "The opening tag for table header fields.
728 This is customizable so that alignment options can be specified.
729 The first %s will be filled with the scope of the field, either row or col.
730 The second %s will be replaced by a style entry to align the field.
731 See also the variable `org-e-html-table-use-header-tags-for-first-column'.
732 See also the variable `org-e-html-table-align-individual-fields'."
733 :group 'org-export-tables ; FIXME: change group?
734 :type '(cons (string :tag "Opening tag") (string :tag "Closing tag")))
736 (defcustom org-e-html-table-data-tags '("<td%s>" . "</td>")
737 "The opening tag for table data fields.
738 This is customizable so that alignment options can be specified.
739 The first %s will be filled with the scope of the field, either row or col.
740 The second %s will be replaced by a style entry to align the field.
741 See also the variable `org-e-html-table-align-individual-fields'."
742 :group 'org-export-tables
743 :type '(cons (string :tag "Opening tag") (string :tag "Closing tag")))
745 (defcustom org-e-html-table-row-tags '("<tr>" . "</tr>")
746 "The opening tag for table data fields.
747 This is customizable so that alignment options can be specified.
748 Instead of strings, these can be Lisp forms that will be evaluated
749 for each row in order to construct the table row tags. During evaluation,
750 the variable `head' will be true when this is a header line, nil when this
751 is a body line. And the variable `nline' will contain the line number,
752 starting from 1 in the first header line. For example
754 (setq org-e-html-table-row-tags
755 (cons '(if head
756 \"<tr>\"
757 (if (= (mod nline 2) 1)
758 \"<tr class=\\\"tr-odd\\\">\"
759 \"<tr class=\\\"tr-even\\\">\"))
760 \"</tr>\"))
762 will give even lines the class \"tr-even\" and odd lines the class \"tr-odd\"."
763 :group 'org-export-tables
764 :type '(cons
765 (choice :tag "Opening tag"
766 (string :tag "Specify")
767 (sexp))
768 (choice :tag "Closing tag"
769 (string :tag "Specify")
770 (sexp))))
772 (defcustom org-e-html-table-align-individual-fields t
773 "Non-nil means attach style attributes for alignment to each table field.
774 When nil, alignment will only be specified in the column tags, but this
775 is ignored by some browsers (like Firefox, Safari). Opera does it right
776 though."
777 :group 'org-export-tables
778 :type 'boolean)
780 (defcustom org-e-html-table-use-header-tags-for-first-column nil
781 "Non-nil means format column one in tables with header tags.
782 When nil, also column one will use data tags."
783 :group 'org-export-tables
784 :type 'boolean)
787 ;;;; Target
788 ;;;; Timestamp
790 ;;;; Verbatim
791 ;;;; Verse Block
792 ;;;; Headline
794 (defcustom org-e-html-toplevel-hlevel 2
795 "The <H> level for level 1 headings in HTML export.
796 This is also important for the classes that will be wrapped around headlines
797 and outline structure. If this variable is 1, the top-level headlines will
798 be <h1>, and the corresponding classes will be outline-1, section-number-1,
799 and outline-text-1. If this is 2, all of these will get a 2 instead.
800 The default for this variable is 2, because we use <h1> for formatting the
801 document title."
802 :group 'org-export-e-html
803 :type 'string)
806 ;;;; Links
807 ;;;; Drawers
808 ;;;; Inlinetasks
809 ;;;; Publishing
811 (defcustom org-e-html-link-org-files-as-html t
812 "Non-nil means make file links to `file.org' point to `file.html'.
813 When org-mode is exporting an org-mode file to HTML, links to
814 non-html files are directly put into a href tag in HTML.
815 However, links to other Org-mode files (recognized by the
816 extension `.org.) should become links to the corresponding html
817 file, assuming that the linked org-mode file will also be
818 converted to HTML.
819 When nil, the links still point to the plain `.org' file."
820 :group 'org-export-e-html
821 :type 'boolean)
824 ;;;; Compilation
828 ;;; User Configurable Variables (MAYBE)
830 ;;;; Preamble
832 (defcustom org-e-html-date-format
833 "\\today"
834 "Format string for \\date{...}."
835 :group 'org-export-e-html
836 :type 'boolean)
838 ;;;; Headline
840 (defcustom org-e-html-format-headline-function nil
841 "Function to format headline text.
843 This function will be called with 5 arguments:
844 TODO the todo keyword \(string or nil\).
845 TODO-TYPE the type of todo \(symbol: `todo', `done', nil\)
846 PRIORITY the priority of the headline \(integer or nil\)
847 TEXT the main headline text \(string\).
848 TAGS the tags string, separated with colons \(string or nil\).
850 The function result will be used in the section format string.
852 As an example, one could set the variable to the following, in
853 order to reproduce the default set-up:
855 \(defun org-e-html-format-headline \(todo todo-type priority text tags\)
856 \"Default format function for an headline.\"
857 \(concat \(when todo
858 \(format \"\\\\textbf{\\\\textsc{\\\\textsf{%s}}} \" todo\)\)
859 \(when priority
860 \(format \"\\\\framebox{\\\\#%c} \" priority\)\)
861 text
862 \(when tags \(format \"\\\\hfill{}\\\\textsc{%s}\" tags\)\)\)\)"
863 :group 'org-export-e-html
864 :type 'function)
867 ;;;; Text Markup
869 (defcustom org-e-html-text-markup-alist
870 '((bold . "<b>%s</b>")
871 (code . "<code>%s</code>")
872 (italic . "<i>%s</i>")
873 (strike-through . "<del>%s</del>")
874 (underline . "<span style=\"text-decoration:underline;\">%s</span>")
875 (verbatim . "<code>%s</code>"))
876 "Alist of HTML expressions to convert text markup
878 The key must be a symbol among `bold', `code', `italic',
879 `strike-through', `underline' and `verbatim'. The value is
880 a formatting string to wrap fontified text with.
882 If no association can be found for a given markup, text will be
883 returned as-is."
884 :group 'org-export-e-html
885 :type '(alist :key-type (symbol :tag "Markup type")
886 :value-type (string :tag "Format string"))
887 :options '(bold code italic strike-through underline verbatim))
890 ;;;; Footnotes
892 (defcustom org-e-html-footnote-separator "<sup>, </sup>"
893 "Text used to separate footnotes."
894 :group 'org-export-e-html
895 :type 'string)
898 ;;;; Timestamps
900 (defcustom org-e-html-active-timestamp-format "\\textit{%s}"
901 "A printf format string to be applied to active timestamps."
902 :group 'org-export-e-html
903 :type 'string)
905 (defcustom org-e-html-inactive-timestamp-format "\\textit{%s}"
906 "A printf format string to be applied to inactive timestamps."
907 :group 'org-export-e-html
908 :type 'string)
910 (defcustom org-e-html-diary-timestamp-format "\\textit{%s}"
911 "A printf format string to be applied to diary timestamps."
912 :group 'org-export-e-html
913 :type 'string)
916 ;;;; Links
918 (defcustom org-e-html-inline-image-rules
919 '(("file" . "\\.\\(jpeg\\|jpg\\|png\\|gif\\|svg\\)\\'")
920 ("http" . "\\.\\(jpeg\\|jpg\\|png\\|gif\\|svg\\)\\'")
921 ("https" . "\\.\\(jpeg\\|jpg\\|png\\|gif\\|svg\\)\\'"))
922 "Rules characterizing image files that can be inlined into HTML.
924 A rule consists in an association whose key is the type of link
925 to consider, and value is a regexp that will be matched against
926 link's path.
928 Note that, by default, the image extension *actually* allowed
929 depend on the way the HTML file is processed. When used with
930 pdflatex, pdf, jpg and png images are OK. When processing
931 through dvi to Postscript, only ps and eps are allowed. The
932 default we use here encompasses both."
933 :group 'org-export-e-html
934 :type '(alist :key-type (string :tag "Type")
935 :value-type (regexp :tag "Path")))
937 ;;;; Tables
939 (defcustom org-e-html-table-caption-above t
940 "When non-nil, place caption string at the beginning of the table.
941 Otherwise, place it near the end."
942 :group 'org-export-e-html
943 :type 'boolean)
945 ;;;; Drawers
947 (defcustom org-e-html-format-drawer-function nil
948 "Function called to format a drawer in HTML code.
950 The function must accept two parameters:
951 NAME the drawer name, like \"LOGBOOK\"
952 CONTENTS the contents of the drawer.
954 The function should return the string to be exported.
956 For example, the variable could be set to the following function
957 in order to mimic default behaviour:
959 \(defun org-e-html-format-drawer-default \(name contents\)
960 \"Format a drawer element for HTML export.\"
961 contents\)"
962 :group 'org-export-e-html
963 :type 'function)
966 ;;;; Inlinetasks
968 (defcustom org-e-html-format-inlinetask-function nil
969 "Function called to format an inlinetask in HTML code.
971 The function must accept six parameters:
972 TODO the todo keyword, as a string
973 TODO-TYPE the todo type, a symbol among `todo', `done' and nil.
974 PRIORITY the inlinetask priority, as a string
975 NAME the inlinetask name, as a string.
976 TAGS the inlinetask tags, as a string.
977 CONTENTS the contents of the inlinetask, as a string.
979 The function should return the string to be exported.
981 For example, the variable could be set to the following function
982 in order to mimic default behaviour:
984 \(defun org-e-html-format-inlinetask \(todo type priority name tags contents\)
985 \"Format an inline task element for HTML export.\"
986 \(let \(\(full-title
987 \(concat
988 \(when todo
989 \(format \"\\\\textbf{\\\\textsf{\\\\textsc{%s}}} \" todo\)\)
990 \(when priority \(format \"\\\\framebox{\\\\#%c} \" priority\)\)
991 title
992 \(when tags \(format \"\\\\hfill{}\\\\textsc{%s}\" tags\)\)\)\)\)
993 \(format \(concat \"\\\\begin{center}\\n\"
994 \"\\\\fbox{\\n\"
995 \"\\\\begin{minipage}[c]{.6\\\\textwidth}\\n\"
996 \"%s\\n\\n\"
997 \"\\\\rule[.8em]{\\\\textwidth}{2pt}\\n\\n\"
998 \"%s\"
999 \"\\\\end{minipage}}\"
1000 \"\\\\end{center}\"\)
1001 full-title contents\)\)"
1002 :group 'org-export-e-html
1003 :type 'function)
1006 ;; Src blocks
1008 ;;;; Plain text
1010 (defcustom org-e-html-quotes
1011 '(("fr"
1012 ("\\(\\s-\\|[[(]\\|^\\)\"" . "«~")
1013 ("\\(\\S-\\)\"" . "~»")
1014 ("\\(\\s-\\|(\\|^\\)'" . "'"))
1015 ("en"
1016 ("\\(\\s-\\|[[(]\\|^\\)\"" . "``")
1017 ("\\(\\S-\\)\"" . "''")
1018 ("\\(\\s-\\|(\\|^\\)'" . "`")))
1019 "Alist for quotes to use when converting english double-quotes.
1021 The CAR of each item in this alist is the language code.
1022 The CDR of each item in this alist is a list of three CONS:
1023 - the first CONS defines the opening quote;
1024 - the second CONS defines the closing quote;
1025 - the last CONS defines single quotes.
1027 For each item in a CONS, the first string is a regexp
1028 for allowed characters before/after the quote, the second
1029 string defines the replacement string for this quote."
1030 :group 'org-export-e-html
1031 :type '(list
1032 (cons :tag "Opening quote"
1033 (string :tag "Regexp for char before")
1034 (string :tag "Replacement quote "))
1035 (cons :tag "Closing quote"
1036 (string :tag "Regexp for char after ")
1037 (string :tag "Replacement quote "))
1038 (cons :tag "Single quote"
1039 (string :tag "Regexp for char before")
1040 (string :tag "Replacement quote "))))
1042 ;;;; Compilation
1046 ;;; Internal Functions (HTML)
1048 (defun org-e-html-cvt-org-as-html (opt-plist type path)
1049 "Convert an org filename to an equivalent html filename.
1050 If TYPE is not file, just return `nil'.
1051 See variable `org-e-html-link-org-files-as-html'."
1052 (save-match-data
1053 (and
1054 org-e-html-link-org-files-as-html
1055 (string= type "file")
1056 (string-match "\\.org$" path)
1057 (progn
1058 (list
1059 "file"
1060 (concat
1061 (substring path 0 (match-beginning 0))
1062 "." (plist-get opt-plist :html-extension)))))))
1064 (defun org-e-html-format-org-link (opt-plist type-1 path fragment desc attr
1065 descp)
1066 "Make an HTML link.
1067 OPT-PLIST is an options list.
1068 TYPE is the device-type of the link (THIS://foo.html).
1069 PATH is the path of the link (http://THIS#location).
1070 FRAGMENT is the fragment part of the link, if any (foo.html#THIS).
1071 DESC is the link description, if any.
1072 ATTR is a string of other attributes of the \"a\" element."
1073 (declare (special org-lparse-par-open))
1074 (save-match-data
1075 (let* ((may-inline-p
1076 (and (member type-1 '("http" "https" "file"))
1077 (org-lparse-should-inline-p path descp)
1078 (not fragment)))
1079 (type (if (equal type-1 "id") "file" type-1))
1080 (filename path)
1081 ;;First pass. Just sanity stuff.
1082 (components-1
1083 (cond
1084 ((string= type "file")
1085 (list
1086 type
1087 ;;Substitute just if original path was absolute.
1088 ;;(Otherwise path must remain relative)
1089 (if (file-name-absolute-p path)
1090 (concat "file://" (expand-file-name path))
1091 path)))
1092 ((string= type "")
1093 (list nil path))
1094 (t (list type path))))
1096 ;;Second pass. Components converted so they can refer
1097 ;;to a remote site.
1098 (components-2
1100 (and org-e-html-cvt-link-fn
1101 (apply org-e-html-cvt-link-fn
1102 opt-plist components-1))
1103 (apply #'org-e-html-cvt-org-as-html
1104 opt-plist components-1)
1105 components-1))
1106 (type (first components-2))
1107 (thefile (second components-2)))
1110 ;;Third pass. Build final link except for leading type
1111 ;;spec.
1112 (cond
1113 ((or
1114 (not type)
1115 (string= type "http")
1116 (string= type "https")
1117 (string= type "file")
1118 (string= type "coderef"))
1119 (if fragment
1120 (setq thefile (concat thefile "#" fragment))))
1122 (t))
1124 ;;Final URL-build, for all types.
1125 (setq thefile
1126 (let
1127 ((str (org-xml-format-href thefile)))
1128 (if (and type (not (or (string= "file" type)
1129 (string= "coderef" type))))
1130 (concat type ":" str)
1131 str)))
1133 (if may-inline-p
1134 (ignore) ;; (org-e-html-format-image thefile)
1135 (org-lparse-format
1136 'LINK (org-xml-format-desc desc) thefile attr)))))
1138 ;; (caption (and caption (org-xml-encode-org-text caption)))
1139 ;; alt = (file-name-nondirectory path)
1141 (defun org-e-html-format-inline-image (src &optional
1142 caption label attr standalone-p)
1143 (let* ((id (if (not label) ""
1144 (format " id=\"%s\"" (org-export-solidify-link-text label))))
1145 (attr (concat attr
1146 (cond
1147 ((string-match "\\<alt=" (or attr "")) "")
1148 ((string-match "^ltxpng/" src)
1149 (format " alt=\"%s\""
1150 (org-e-html-encode-plain-text
1151 (org-find-text-property-in-string
1152 'org-latex-src src))))
1153 (t (format " alt=\"%s\""
1154 (file-name-nondirectory src)))))))
1155 (cond
1156 (standalone-p
1157 (let ((img (format "<img src=\"%s\" %s/>" src attr)))
1158 (format "\n<div%s class=\"figure\">%s%s\n</div>"
1159 id (format "\n<p>%s</p>" img)
1160 (when caption (format "\n<p>%s</p>" caption)))))
1161 (t (format "<img src=\"%s\" %s/>" src (concat attr id))))))
1163 ;;;; Bibliography
1165 (defun org-e-html-bibliography ()
1166 "Find bibliography, cut it out and return it."
1167 (catch 'exit
1168 (let (beg end (cnt 1) bib)
1169 (save-excursion
1170 (goto-char (point-min))
1171 (when (re-search-forward
1172 "^[ \t]*<div \\(id\\|class\\)=\"bibliography\"" nil t)
1173 (setq beg (match-beginning 0))
1174 (while (re-search-forward "</?div\\>" nil t)
1175 (setq cnt (+ cnt (if (string= (match-string 0) "<div") +1 -1)))
1176 (when (= cnt 0)
1177 (and (looking-at ">") (forward-char 1))
1178 (setq bib (buffer-substring beg (point)))
1179 (delete-region beg (point))
1180 (throw 'exit bib))))
1181 nil))))
1183 ;;;; Table
1185 (defun org-e-html-format-table (lines olines)
1186 (let ((org-e-html-format-table-no-css nil))
1187 (org-lparse-format-table lines olines)))
1189 (defun org-e-html-splice-attributes (tag attributes)
1190 "Read attributes in string ATTRIBUTES, add and replace in HTML tag TAG."
1191 (if (not attributes)
1193 (let (oldatt newatt)
1194 (setq oldatt (org-extract-attributes-from-string tag)
1195 tag (pop oldatt)
1196 newatt (cdr (org-extract-attributes-from-string attributes)))
1197 (while newatt
1198 (setq oldatt (plist-put oldatt (pop newatt) (pop newatt))))
1199 (if (string-match ">" tag)
1200 (setq tag
1201 (replace-match (concat (org-attributes-to-string oldatt) ">")
1202 t t tag)))
1203 tag)))
1205 (defun org-export-splice-style (style extra)
1206 "Splice EXTRA into STYLE, just before \"</style>\"."
1207 (if (and (stringp extra)
1208 (string-match "\\S-" extra)
1209 (string-match "</style>" style))
1210 (concat (substring style 0 (match-beginning 0))
1211 "\n" extra "\n"
1212 (substring style (match-beginning 0)))
1213 style))
1215 (defun org-export-e-htmlize-region-for-paste (beg end)
1216 "Convert the region to HTML, using htmlize.el.
1217 This is much like `htmlize-region-for-paste', only that it uses
1218 the settings define in the org-... variables."
1219 (let* ((htmlize-output-type org-export-e-htmlize-output-type)
1220 (htmlize-css-name-prefix org-export-e-htmlize-css-font-prefix)
1221 (htmlbuf (htmlize-region beg end)))
1222 (unwind-protect
1223 (with-current-buffer htmlbuf
1224 (buffer-substring (plist-get htmlize-buffer-places 'content-start)
1225 (plist-get htmlize-buffer-places 'content-end)))
1226 (kill-buffer htmlbuf))))
1228 ;;;###autoload
1229 (defun org-export-e-htmlize-generate-css ()
1230 "Create the CSS for all font definitions in the current Emacs session.
1231 Use this to create face definitions in your CSS style file that can then
1232 be used by code snippets transformed by htmlize.
1233 This command just produces a buffer that contains class definitions for all
1234 faces used in the current Emacs session. You can copy and paste the ones you
1235 need into your CSS file.
1237 If you then set `org-export-e-htmlize-output-type' to `css', calls to
1238 the function `org-export-e-htmlize-region-for-paste' will produce code
1239 that uses these same face definitions."
1240 (interactive)
1241 (require 'htmlize)
1242 (and (get-buffer "*html*") (kill-buffer "*html*"))
1243 (with-temp-buffer
1244 (let ((fl (face-list))
1245 (htmlize-css-name-prefix "org-")
1246 (htmlize-output-type 'css)
1247 f i)
1248 (while (setq f (pop fl)
1249 i (and f (face-attribute f :inherit)))
1250 (when (and (symbolp f) (or (not i) (not (listp i))))
1251 (insert (org-add-props (copy-sequence "1") nil 'face f))))
1252 (htmlize-region (point-min) (point-max))))
1253 (org-pop-to-buffer-same-window "*html*")
1254 (goto-char (point-min))
1255 (if (re-search-forward "<style" nil t)
1256 (delete-region (point-min) (match-beginning 0)))
1257 (if (re-search-forward "</style>" nil t)
1258 (delete-region (1+ (match-end 0)) (point-max)))
1259 (beginning-of-line 1)
1260 (if (looking-at " +") (replace-match ""))
1261 (goto-char (point-min)))
1263 (defun org-e-html-make-string (n string)
1264 (let (out) (dotimes (i n out) (setq out (concat string out)))))
1266 (defun org-e-html-toc-text (toc-entries)
1267 (let* ((prev-level (1- (nth 1 (car toc-entries))))
1268 (start-level prev-level))
1269 (concat
1270 (mapconcat
1271 (lambda (entry)
1272 (let ((headline (nth 0 entry))
1273 (level (nth 1 entry)))
1274 (concat
1275 (let* ((cnt (- level prev-level))
1276 (times (if (> cnt 0) (1- cnt) (- cnt)))
1277 rtn)
1278 (setq prev-level level)
1279 (concat
1280 (org-e-html-make-string
1281 times (cond ((> cnt 0) "\n<ul>\n<li>")
1282 ((< cnt 0) "</li>\n</ul>\n")))
1283 (if (> cnt 0) "\n<ul>\n<li>" "</li>\n<li>")))
1284 headline)))
1285 toc-entries "")
1286 (org-e-html-make-string
1287 (- prev-level start-level) "</li>\n</ul>\n"))))
1289 (defun* org-e-html-format-toc-headline
1290 (todo todo-type priority text tags
1291 &key level section-number headline-label &allow-other-keys)
1292 (let ((headline (concat
1293 section-number (and section-number ". ")
1294 text
1295 (and tags "&nbsp;&nbsp;&nbsp;") (org-e-html--tags tags))))
1296 (format "<a href=\"#%s\">%s</a>"
1297 headline-label
1298 (if (not nil) headline
1299 (format "<span class=\"%s\">%s</span>" todo-type headline)))))
1301 (defun org-e-html-toc (depth info)
1302 (assert (wholenump depth))
1303 (let* ((headlines (org-export-collect-headlines info depth))
1304 (toc-entries
1305 (loop for headline in headlines collect
1306 (list (org-e-html-format-headline--wrap
1307 headline info 'org-e-html-format-toc-headline)
1308 (org-export-get-relative-level headline info)))))
1309 (when toc-entries
1310 (let* ((lang-specific-heading
1311 (nth 3 (or (assoc (plist-get info :language)
1312 org-export-language-setup)
1313 (assoc "en" org-export-language-setup)))))
1314 (concat
1315 "<div id=\"table-of-contents\">\n"
1316 (format "<h%d>%s</h%d>\n"
1317 org-e-html-toplevel-hlevel
1318 lang-specific-heading
1319 org-e-html-toplevel-hlevel)
1320 "<div id=\"text-table-of-contents\">"
1321 (org-e-html-toc-text toc-entries)
1322 "</div>\n"
1323 "</div>\n")))))
1325 ;; (defun org-e-html-format-line (line)
1326 ;; (case org-lparse-dyn-current-environment
1327 ;; ((quote fixedwidth) (concat (org-e-html-encode-plain-text line) "\n"))
1328 ;; (t (concat line "\n"))))
1330 (defun org-e-html-fix-class-name (kwd) ; audit callers of this function
1331 "Turn todo keyword into a valid class name.
1332 Replaces invalid characters with \"_\"."
1333 (save-match-data
1334 (while (string-match "[^a-zA-Z0-9_]" kwd)
1335 (setq kwd (replace-match "_" t t kwd))))
1336 kwd)
1338 (defun org-e-html-format-footnote-reference (n def refcnt)
1339 (let ((extra (if (= refcnt 1) "" (format ".%d" refcnt))))
1340 (format org-e-html-footnote-format
1341 (format
1342 "<a class=\"footref\" name=\"fnr.%s%s\" href=\"#fn.%s\">%s</a>"
1343 n extra n n))))
1345 (defun org-e-html-format-footnotes-section (section-name definitions)
1346 (if (not definitions) ""
1347 (format org-e-html-footnotes-section section-name definitions)))
1349 (defun org-e-html-format-footnote-definition (fn)
1350 (let ((n (car fn)) (def (cdr fn)))
1351 (format
1352 "<tr>\n<td>%s</td>\n<td>%s</td>\n</tr>\n"
1353 (format
1354 (format org-e-html-footnote-format
1355 "<a class=\"footnum\" name=\"fn.%s\" href=\"#fnr.%s\">%s</a>")
1356 n n n) def)))
1358 (defun org-e-html-footnote-section (info)
1359 (let* ((fn-alist (org-export-collect-footnote-definitions
1360 (plist-get info :parse-tree) info))
1362 (fn-alist
1363 (loop for (n type raw) in fn-alist collect
1364 (cons n (if (equal (org-element-type raw) 'org-data)
1365 (org-trim (org-export-data raw info))
1366 (format "<p>%s</p>"
1367 (org-trim
1368 (org-export-secondary-string raw info))))))))
1369 (when fn-alist
1370 (org-e-html-format-footnotes-section
1371 (nth 4 (or (assoc (plist-get info :language)
1372 org-export-language-setup)
1373 (assoc "en" org-export-language-setup)))
1374 (format
1375 "<table>\n%s\n</table>\n"
1376 (mapconcat 'org-e-html-format-footnote-definition fn-alist "\n"))))))
1378 (defun org-e-html-format-date (info)
1379 (let ((date (plist-get info :date)))
1380 (cond
1381 ((and date (string-match "%" date))
1382 (format-time-string date))
1383 (date date)
1384 (t (format-time-string "%Y-%m-%d %T %Z")))))
1388 ;;; Internal Functions (Ngz)
1390 (defun org-e-html--caption/label-string (caption label info)
1391 "Return caption and label HTML string for floats.
1393 CAPTION is a cons cell of secondary strings, the car being the
1394 standard caption and the cdr its short form. LABEL is a string
1395 representing the label. INFO is a plist holding contextual
1396 information.
1398 If there's no caption nor label, return the empty string.
1400 For non-floats, see `org-e-html--wrap-label'."
1401 (setq label nil) ;; FIXME
1403 (let ((label-str (if label (format "\\label{%s}" label) "")))
1404 (cond
1405 ((and (not caption) (not label)) "")
1406 ((not caption) (format "\\label{%s}\n" label))
1407 ;; Option caption format with short name.
1408 ((cdr caption)
1409 (format "\\caption[%s]{%s%s}\n"
1410 (org-export-secondary-string (cdr caption) info)
1411 label-str
1412 (org-export-secondary-string (car caption) info)))
1413 ;; Standard caption format.
1414 ;; (t (format "\\caption{%s%s}\n"
1415 ;; label-str
1416 ;; (org-export-secondary-string (car caption) info)))
1418 (t (org-export-secondary-string (car caption) info)))))
1420 (defun org-e-html--find-verb-separator (s)
1421 "Return a character not used in string S.
1422 This is used to choose a separator for constructs like \\verb."
1423 (let ((ll "~,./?;':\"|!@#%^&-_=+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ<>()[]{}"))
1424 (loop for c across ll
1425 when (not (string-match (regexp-quote (char-to-string c)) s))
1426 return (char-to-string c))))
1428 (defun org-e-html--quotation-marks (text info)
1429 "Export quotation marks depending on language conventions.
1430 TEXT is a string containing quotation marks to be replaced. INFO
1431 is a plist used as a communication channel."
1432 (mapc (lambda(l)
1433 (let ((start 0))
1434 (while (setq start (string-match (car l) text start))
1435 (let ((new-quote (concat (match-string 1 text) (cdr l))))
1436 (setq text (replace-match new-quote t t text))))))
1437 (cdr (or (assoc (plist-get info :language) org-e-html-quotes)
1438 ;; Falls back on English.
1439 (assoc "en" org-e-html-quotes))))
1440 text)
1442 (defun org-e-html--wrap-label (element output)
1443 "Wrap label associated to ELEMENT around OUTPUT, if appropriate.
1444 This function shouldn't be used for floats. See
1445 `org-e-html--caption/label-string'."
1446 ;; (let ((label (org-element-property :name element)))
1447 ;; (if (or (not output) (not label) (string= output "") (string= label ""))
1448 ;; output
1449 ;; (concat (format "\\label{%s}\n" label) output)))
1450 output)
1454 ;;; Template
1456 (defun org-e-html-meta-info (info)
1457 (let* ((title (org-export-secondary-string (plist-get info :title) info))
1458 (author (and (plist-get info :with-author)
1459 (let ((auth (plist-get info :author)))
1460 (and auth (org-export-secondary-string auth info)))))
1461 (description (plist-get info :description))
1462 (keywords (plist-get info :keywords)))
1463 (concat
1464 (format "\n<title>%s</title>\n" title)
1465 (format
1466 "\n<meta http-equiv=\"Content-Type\" content=\"text/html;charset=%s\"/>"
1467 (or (and org-export-coding-system
1468 (fboundp 'coding-system-get)
1469 (coding-system-get org-export-coding-system
1470 'mime-charset))
1471 "iso-8859-1"))
1472 (format "\n<meta name=\"title\" content=\"%s\"/>" title)
1473 (format "\n<meta name=\"generator\" content=\"Org-mode\"/>")
1474 (format "\n<meta name=\"generated\" content=\"%s\"/>"
1475 (org-e-html-format-date info))
1476 (format "\n<meta name=\"author\" content=\"%s\"/>" author)
1477 (format "\n<meta name=\"description\" content=\"%s\"/>" description)
1478 (format "\n<meta name=\"keywords\" content=\"%s\"/>" keywords))))
1480 (defun org-e-html-style (info)
1481 (concat
1482 "\n" (when (plist-get info :style-include-default) org-e-html-style-default)
1483 (plist-get info :style)
1484 (plist-get info :style-extra)
1485 "\n"
1486 (when (plist-get info :style-include-scripts)
1487 org-e-html-scripts)))
1489 (defun org-e-html-mathjax-config (info)
1490 "Insert the user setup into the matchjax template."
1491 (when (member (plist-get info :LaTeX-fragments) '(mathjax t))
1492 (let ((template org-e-html-mathjax-template)
1493 (options org-e-html-mathjax-options)
1494 (in-buffer (or (plist-get info :mathjax) ""))
1495 name val (yes " ") (no "// ") x)
1496 (mapc
1497 (lambda (e)
1498 (setq name (car e) val (nth 1 e))
1499 (if (string-match (concat "\\<" (symbol-name name) ":") in-buffer)
1500 (setq val (car (read-from-string
1501 (substring in-buffer (match-end 0))))))
1502 (if (not (stringp val)) (setq val (format "%s" val)))
1503 (if (string-match (concat "%" (upcase (symbol-name name))) template)
1504 (setq template (replace-match val t t template))))
1505 options)
1506 (setq val (nth 1 (assq 'mathml options)))
1507 (if (string-match (concat "\\<mathml:") in-buffer)
1508 (setq val (car (read-from-string
1509 (substring in-buffer (match-end 0))))))
1510 ;; Exchange prefixes depending on mathml setting
1511 (if (not val) (setq x yes yes no no x))
1512 ;; Replace cookies to turn on or off the config/jax lines
1513 (if (string-match ":MMLYES:" template)
1514 (setq template (replace-match yes t t template)))
1515 (if (string-match ":MMLNO:" template)
1516 (setq template (replace-match no t t template)))
1517 ;; Return the modified template
1518 template)))
1520 (defun org-e-html-preamble (info)
1521 (when (plist-get info :html-preamble)
1522 (let* ((title (org-export-secondary-string (plist-get info :title) info))
1523 (date (org-e-html-format-date info))
1524 (author (org-export-secondary-string (plist-get info :author) info))
1525 (lang-words (or (assoc (plist-get info :language)
1526 org-export-language-setup)
1527 (assoc "en" org-export-language-setup)))
1528 (email (plist-get info :email))
1529 (html-pre-real-contents
1530 (cond
1531 ((functionp (plist-get info :html-preamble))
1532 (with-temp-buffer
1533 (funcall (plist-get info :html-preamble))
1534 (buffer-string)))
1535 ((stringp (plist-get info :html-preamble))
1536 (format-spec (plist-get info :html-preamble)
1537 `((?t . ,title) (?a . ,author)
1538 (?d . ,date) (?e . ,email))))
1540 (format-spec
1541 (or (cadr (assoc (nth 0 lang-words)
1542 org-e-html-preamble-format))
1543 (cadr (assoc "en" org-e-html-preamble-format)))
1544 `((?t . ,title) (?a . ,author)
1545 (?d . ,date) (?e . ,email)))))))
1546 (when (not (equal html-pre-real-contents ""))
1547 (concat
1548 (format "
1549 <div id=\"%s\"> " (nth 0 org-e-html-divs))
1552 html-pre-real-contents
1554 </div>")))))
1556 (defun org-e-html-postamble (info)
1557 (concat
1558 (when (and (not body-only)
1559 (plist-get info :html-postamble))
1560 (let* ((html-post (plist-get info :html-postamble))
1561 (date (org-e-html-format-date info))
1562 (author (plist-get info :author))
1563 (email (plist-get info :email))
1564 (lang-words (or (assoc (plist-get info :language)
1565 org-export-language-setup)
1566 (assoc "en" org-export-language-setup)))
1567 (email
1568 (mapconcat (lambda(e)
1569 (format "<a href=\"mailto:%s\">%s</a>" e e))
1570 (split-string email ",+ *")
1571 ", "))
1572 (html-validation-link (or org-e-html-validation-link ""))
1573 (creator-info org-export-creator-string))
1574 (concat
1575 ;; begin postamble
1577 <div id=\"" (nth 2 org-e-html-divs) "\">"
1578 (cond
1579 ;; auto postamble
1580 ((eq (plist-get info :html-postamble) 'auto)
1581 (concat
1582 (when (plist-get info :time-stamp-file)
1583 (format "
1584 <p class=\"date\"> %s: %s </p> " (nth 2 lang-words) date))
1585 (when (and (plist-get info :with-author) author)
1586 (format "
1587 <p class=\"author\"> %s : %s</p>" (nth 1 lang-words) author))
1588 (when (and (plist-get info :with-email) email)
1589 (format "
1590 <p class=\"email\"> %s </p>" email))
1591 (when (plist-get info :with-creator)
1592 (format "
1593 <p class=\"creator\"> %s </p>" creator-info))
1594 html-validation-link "\n"))
1595 ;; postamble from a string
1596 ((stringp (plist-get info :html-postamble))
1597 (format-spec (plist-get info :html-postamble)
1598 `((?a . ,author) (?e . ,email)
1599 (?d . ,date) (?c . ,creator-info)
1600 (?v . ,html-validation-link))))
1602 ;; postamble from a function
1603 ((functionp (plist-get info :html-postamble))
1604 (with-temp-buffer
1605 (funcall (plist-get info :html-postamble))
1606 (buffer-string)))
1607 ;; default postamble
1609 (format-spec
1610 (or (cadr (assoc (nth 0 lang-words)
1611 org-e-html-postamble-format))
1612 (cadr (assoc "en" org-e-html-postamble-format)))
1613 `((?a . ,author) (?e . ,email)
1614 (?d . ,date) (?c . ,creator-info)
1615 (?v . ,html-validation-link)))))
1617 </div>")))
1618 ;; org-e-html-html-helper-timestamp
1621 (defun org-e-html-template (contents info)
1622 "Return complete document string after HTML conversion.
1623 CONTENTS is the transcoded contents string. RAW-DATA is the
1624 original parsed data. INFO is a plist holding export options."
1625 (concat
1626 (format
1627 (or (and (stringp org-e-html-xml-declaration)
1628 org-e-html-xml-declaration)
1629 (cdr (assoc (plist-get info :html-extension)
1630 org-e-html-xml-declaration))
1631 (cdr (assoc "html" org-e-html-xml-declaration))
1634 (or (and coding-system-for-write
1635 (fboundp 'coding-system-get)
1636 (coding-system-get coding-system-for-write
1637 'mime-charset))
1638 "iso-8859-1"))
1640 <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"
1641 \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">"
1642 (format "
1643 <html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"%s\" xml:lang=\"%s\"> "
1644 (plist-get info :language) (plist-get info :language))
1646 <head>"
1647 (org-e-html-meta-info info) ; meta
1648 (org-e-html-style info) ; style
1649 (org-e-html-mathjax-config info) ; mathjax
1651 </head>"
1654 <body>"
1655 (let ((link-up (and (plist-get info :link-up)
1656 (string-match "\\S-" (plist-get info :link-up))
1657 (plist-get info :link-up)))
1658 (link-home (and (plist-get info :link-home)
1659 (string-match "\\S-" (plist-get info :link-home))
1660 (plist-get info :link-home))))
1661 (when (or link-up link-home)
1662 (format org-e-html-home/up-format
1663 (or link-up link-home)
1664 (or link-home link-up))))
1665 ;; preamble
1666 (org-e-html-preamble info)
1667 ;; begin content
1668 (format "
1669 <div id=\"%s\">" (or org-e-html-content-div
1670 (nth 1 org-e-html-divs)))
1671 ;; document title
1672 (format "
1673 <h1 class=\"title\">%s</h1>\n" (org-export-secondary-string
1674 (plist-get info :title) info))
1675 ;; table of contents
1676 (let ((depth (plist-get info :with-toc)))
1677 (when (wholenump depth) (org-e-html-toc depth info)))
1678 ;; document contents
1679 contents
1680 ;; footnotes section
1681 (org-e-html-footnote-section info)
1682 ;; bibliography
1683 (org-e-html-bibliography)
1684 ;; end content
1685 (unless body-only
1687 </div>")
1689 ;; postamble
1690 (org-e-html-postamble info)
1692 (unless body-only
1694 </body>")
1696 </html>"))
1700 ;;; Transcode Helpers
1702 ;;;; Todo
1704 (defun org-e-html--todo (todo)
1705 (when todo
1706 (format "<span class=\"%s %s%s\">%s</span>"
1707 (if (member todo org-done-keywords) "done" "todo")
1708 org-e-html-todo-kwd-class-prefix (org-e-html-fix-class-name todo)
1709 todo)))
1711 ;;;; Tags
1713 (defun org-e-html--tags (tags)
1714 (when tags
1715 (format "<span class=\"tag\">%s</span>"
1716 (mapconcat
1717 (lambda (tag)
1718 (format "<span class=\"%s\">%s</span>"
1719 (concat org-e-html-tag-class-prefix
1720 (org-e-html-fix-class-name tag))
1721 tag))
1722 (org-split-string tags ":") "&nbsp;"))))
1724 ;;;; Headline
1726 (defun* org-e-html-format-headline
1727 (todo todo-type priority text tags
1728 &key level section-number headline-label &allow-other-keys)
1729 (let ((section-number
1730 (when section-number
1731 (format "<span class=\"section-number-%d\">%s</span> "
1732 level section-number)))
1733 (todo (org-e-html--todo todo))
1734 (tags (org-e-html--tags tags)))
1735 (concat section-number todo (and todo " ") text
1736 (and tags "&nbsp;&nbsp;&nbsp;") tags)))
1738 ;;;; Src Code
1740 (defun org-e-html-fontify-code (code lang)
1741 (when code
1742 (cond
1743 ;; Case 1: No lang. Possibly an example block.
1744 ((not lang)
1745 ;; Simple transcoding.
1746 (org-e-html-encode-plain-text code))
1747 ;; Case 2: No htmlize or an inferior version of htmlize
1748 ((not (and (require 'htmlize nil t) (fboundp 'htmlize-region-for-paste)))
1749 ;; Emit a warning.
1750 (message "Cannot fontify src block (htmlize.el >= 1.34 required)")
1751 ;; Simple transcoding.
1752 (org-e-html-encode-plain-text code))
1754 ;; Map language
1755 (setq lang (or (assoc-default lang org-src-lang-modes) lang))
1756 (let* ((lang-mode (and lang (intern (format "%s-mode" lang)))))
1757 (cond
1758 ;; Case 1: Language is not associated with any Emacs mode
1759 ((not (functionp lang-mode))
1760 ;; Simple transcoding.
1761 (org-e-html-encode-plain-text code))
1762 ;; Case 2: Default. Fotify code.
1764 ;; htmlize
1765 (setq code (with-temp-buffer
1766 (insert code)
1767 (funcall lang-mode)
1768 (font-lock-fontify-buffer)
1769 ;; markup each line separately
1770 (org-remove-formatting-on-newlines-in-region
1771 (point-min) (point-max))
1772 (org-src-mode)
1773 (set-buffer-modified-p nil)
1774 (org-export-e-htmlize-region-for-paste
1775 (point-min) (point-max))))
1776 ;; Strip any encolosing <pre></pre> tags
1777 (if (string-match "<pre[^>]*>\n*\\([^\000]*\\)</pre>" code)
1778 (match-string 1 code)
1779 code))))))))
1781 (defun org-e-html-do-format-code
1782 (code &optional lang refs retain-labels num-start textarea-p)
1783 (when textarea-p
1784 (setq num-start nil refs nil lang nil))
1785 (let* ((code-lines (org-split-string code "\n"))
1786 (code-length (length code-lines))
1787 (num-fmt
1788 (and num-start
1789 (format "%%%ds: "
1790 (length (number-to-string (+ code-length num-start))))))
1791 (code (org-e-html-fontify-code code lang)))
1792 (assert (= code-length (length (org-split-string code "\n"))))
1793 (org-export-format-code
1794 code
1795 (lambda (loc line-num ref)
1796 (setq loc
1797 (concat
1798 ;; Add line number, if needed.
1799 (when num-start
1800 (format "<span class=\"linenr\">%s</span>"
1801 (format num-fmt line-num)))
1802 ;; Transcoded src line.
1804 ;; Add label, if needed.
1805 (when (and ref retain-labels) (format " (%s)" ref))))
1806 ;; Mark transcoded line as an anchor, if needed.
1807 (if (not ref) loc
1808 (format "<span id=\"coderef-%s\" class=\"coderef-off\">%s</span>"
1809 ref loc)))
1810 num-start refs)))
1812 (defun org-e-html-format-code (element info)
1813 (let* ((lang (org-element-property :language element))
1814 ;; (switches (org-element-property :switches element))
1815 (switches nil) ; FIXME
1816 (textarea-p (and switches (string-match "-t\\>" switches)))
1817 ;; Extract code and references.
1818 (code-info (org-export-unravel-code element))
1819 (code (car code-info))
1820 (refs (cdr code-info))
1821 ;; Does the src block contain labels?
1822 (retain-labels (org-element-property :retain-labels element))
1823 ;; Does it have line numbers?
1824 (num-start (case (org-element-property :number-lines element)
1825 (continued (org-export-get-loc element info))
1826 (new 0))))
1827 (org-e-html-do-format-code
1828 code lang refs retain-labels num-start textarea-p)))
1832 ;;; Transcode Functions
1834 ;;;; Bold
1836 (defun org-e-html-bold (bold contents info)
1837 "Transcode BOLD from Org to HTML.
1838 CONTENTS is the text with bold markup. INFO is a plist holding
1839 contextual information."
1840 (format (or (cdr (assq 'bold org-e-html-text-markup-alist)) "%s")
1841 contents))
1844 ;;;; Center Block
1846 (defun org-e-html-center-block (center-block contents info)
1847 "Transcode a CENTER-BLOCK element from Org to HTML.
1848 CONTENTS holds the contents of the block. INFO is a plist
1849 holding contextual information."
1850 (org-e-html--wrap-label
1851 center-block
1852 (format "<div style=\"text-align: center\">\n%s</div>" contents)))
1855 ;;;; Clock
1857 (defun org-e-html-clock (clock contents info)
1858 "Transcode a CLOCK element from Org to HTML.
1859 CONTENTS is nil. INFO is a plist used as a communication
1860 channel."
1861 (format "<p>
1862 <span class=\"timestamp-wrapper\">
1863 <span class=\"timestamp-kwd\">%s</span> <span class=\"timestamp\">%s</span>%s
1864 </span>
1865 </p>"
1866 org-clock-string
1867 (org-translate-time (org-element-property :value clock))
1868 (let ((time (org-element-property :time clock)))
1869 (and time (format " <span class=\"timestamp\">(%s)</span>" time)))))
1872 ;;;; Code
1874 (defun org-e-html-code (code contents info)
1875 "Transcode CODE from Org to HTML.
1876 CONTENTS is nil. INFO is a plist holding contextual
1877 information."
1878 (format (or (cdr (assq 'code org-e-html-text-markup-alist)) "%s")
1879 (org-element-property :value code)))
1882 ;;;; Comment
1884 ;; Comments are ignored.
1887 ;;;; Comment Block
1889 ;; Comment Blocks are ignored.
1892 ;;;; Drawer
1894 (defun org-e-html-drawer (drawer contents info)
1895 "Transcode a DRAWER element from Org to HTML.
1896 CONTENTS holds the contents of the block. INFO is a plist
1897 holding contextual information."
1898 (let* ((name (org-element-property :drawer-name drawer))
1899 (output (if (functionp org-e-html-format-drawer-function)
1900 (funcall org-e-html-format-drawer-function
1901 name contents)
1902 ;; If there's no user defined function: simply
1903 ;; display contents of the drawer.
1904 contents)))
1905 (org-e-html--wrap-label drawer output)))
1908 ;;;; Dynamic Block
1910 (defun org-e-html-dynamic-block (dynamic-block contents info)
1911 "Transcode a DYNAMIC-BLOCK element from Org to HTML.
1912 CONTENTS holds the contents of the block. INFO is a plist
1913 holding contextual information. See `org-export-data'."
1914 (org-e-html--wrap-label dynamic-block contents))
1917 ;;;; Entity
1919 (defun org-e-html-entity (entity contents info)
1920 "Transcode an ENTITY object from Org to HTML.
1921 CONTENTS are the definition itself. INFO is a plist holding
1922 contextual information."
1923 (org-element-property :html entity))
1926 ;;;; Example Block
1928 (defun org-e-html-example-block (example-block contents info)
1929 "Transcode a EXAMPLE-BLOCK element from Org to HTML.
1930 CONTENTS is nil. INFO is a plist holding contextual information."
1931 (let* ((options (or (org-element-property :options example-block) ""))
1932 (lang (org-element-property :language example-block))
1933 (caption (org-element-property :caption example-block))
1934 (label (org-element-property :name example-block))
1935 (caption-str (org-e-html--caption/label-string caption label info))
1936 (attr (mapconcat #'identity
1937 (org-element-property :attr_html example-block)
1938 " "))
1939 ;; (switches (org-element-property :switches example-block))
1940 (switches nil) ; FIXME
1941 (textarea-p (and switches (string-match "-t\\>" switches)))
1942 (code (org-e-html-format-code example-block info)))
1943 (cond
1944 (textarea-p
1945 (let ((cols (if (not (string-match "-w[ \t]+\\([0-9]+\\)" switches))
1946 80 (string-to-number (match-string 1 switches))))
1947 (rows (if (string-match "-h[ \t]+\\([0-9]+\\)" switches)
1948 (string-to-number (match-string 1 switches))
1949 (org-count-lines code))))
1950 (format
1951 "\n<p>\n<textarea cols=\"%d\" rows=\"%d\">\n%s\n</textarea>\n</p>"
1952 cols rows code)))
1953 (t (format "\n<pre class=\"example\">\n%s\n</pre>" code)))))
1956 ;;;; Export Snippet
1958 (defun org-e-html-export-snippet (export-snippet contents info)
1959 "Transcode a EXPORT-SNIPPET object from Org to HTML.
1960 CONTENTS is nil. INFO is a plist holding contextual information."
1961 (when (eq (org-export-snippet-backend export-snippet) 'e-html)
1962 (org-element-property :value export-snippet)))
1965 ;;;; Export Block
1967 (defun org-e-html-export-block (export-block contents info)
1968 "Transcode a EXPORT-BLOCK element from Org to HTML.
1969 CONTENTS is nil. INFO is a plist holding contextual information."
1970 (when (string= (org-element-property :type export-block) "latex")
1971 (org-remove-indentation (org-element-property :value export-block))))
1974 ;;;; Fixed Width
1976 (defun org-e-html-fixed-width (fixed-width contents info)
1977 "Transcode a FIXED-WIDTH element from Org to HTML.
1978 CONTENTS is nil. INFO is a plist holding contextual information."
1979 (let* ((value (org-element-normalize-string
1980 (replace-regexp-in-string
1981 "^[ \t]*: ?" ""
1982 (org-element-property :value fixed-width)))))
1983 (org-e-html--wrap-label
1984 fixed-width (format "\n<pre class=\"example\">\n%s\n</pre>"
1985 (org-e-html-do-format-code value)))))
1988 ;;;; Footnote Definition
1990 ;; Footnote Definitions are ignored.
1993 ;;;; Footnote Reference
1995 (defun org-e-html-footnote-reference (footnote-reference contents info)
1996 "Transcode a FOOTNOTE-REFERENCE element from Org to HTML.
1997 CONTENTS is nil. INFO is a plist holding contextual information."
1998 (concat
1999 ;; Insert separator between two footnotes in a row.
2000 (let ((prev (org-export-get-previous-element footnote-reference info)))
2001 (when (eq (org-element-type prev) 'footnote-reference)
2002 org-e-html-footnote-separator))
2003 (cond
2004 ((not (org-export-footnote-first-reference-p footnote-reference info))
2005 (org-e-html-format-footnote-reference
2006 (org-export-get-footnote-number footnote-reference info)
2007 "IGNORED" 100))
2008 ;; Inline definitions are secondary strings.
2009 ((eq (org-element-property :type footnote-reference) 'inline)
2010 (org-e-html-format-footnote-reference
2011 (org-export-get-footnote-number footnote-reference info)
2012 "IGNORED" 1))
2013 ;; Non-inline footnotes definitions are full Org data.
2014 (t (org-e-html-format-footnote-reference
2015 (org-export-get-footnote-number footnote-reference info)
2016 "IGNORED" 1)))))
2019 ;;;; Headline
2021 (defun org-e-html-format-headline--wrap (headline info
2022 &optional format-function
2023 &rest extra-keys)
2024 "Transcode an HEADLINE element from Org to HTML.
2025 CONTENTS holds the contents of the headline. INFO is a plist
2026 holding contextual information."
2027 (let* ((level (+ (org-export-get-relative-level headline info)
2028 (1- org-e-html-toplevel-hlevel)))
2029 (headline-number (org-export-get-headline-number headline info))
2030 (section-number (and (org-export-numbered-headline-p headline info)
2031 (mapconcat 'number-to-string
2032 headline-number ".")))
2033 (todo (and (plist-get info :with-todo-keywords)
2034 (let ((todo (org-element-property
2035 :todo-keyword headline)))
2036 (and todo
2037 (org-export-secondary-string todo info)))))
2038 (todo-type (and todo (org-element-property :todo-type headline)))
2039 (priority (and (plist-get info :with-priority)
2040 (org-element-property :priority headline)))
2041 (text (org-export-secondary-string
2042 (org-element-property :title headline) info))
2043 (tags (and (plist-get info :with-tags)
2044 (org-element-property :tags headline)))
2045 (headline-label (concat "sec-" (mapconcat 'number-to-string
2046 headline-number "-")))
2047 (format-function (cond
2048 ((functionp format-function) format-function)
2049 ((functionp org-e-html-format-headline-function)
2050 (function*
2051 (lambda (todo todo-type priority text tags
2052 &allow-other-keys)
2053 (funcall org-e-html-format-headline-function
2054 todo todo-type priority text tags))))
2055 (t 'org-e-html-format-headline))))
2056 (apply format-function
2057 todo todo-type priority text tags
2058 :headline-label headline-label :level level
2059 :section-number section-number extra-keys)))
2061 (defun org-e-html-headline (headline contents info)
2062 "Transcode an HEADLINE element from Org to HTML.
2063 CONTENTS holds the contents of the headline. INFO is a plist
2064 holding contextual information."
2065 (let* ((numberedp (org-export-numbered-headline-p headline info))
2066 (level (org-export-get-relative-level headline info))
2067 (text (org-export-secondary-string
2068 (org-element-property :title headline) info))
2069 (todo (and (plist-get info :with-todo-keywords)
2070 (let ((todo (org-element-property
2071 :todo-keyword headline)))
2072 (and todo (org-export-secondary-string todo info)))))
2073 (todo-type (and todo (org-element-property :todo-type headline)))
2074 (tags (and (plist-get info :with-tags)
2075 (org-element-property :tags headline)))
2076 (priority (and (plist-get info :with-priority)
2077 (org-element-property :priority headline)))
2078 (section-number (and (org-export-numbered-headline-p headline info)
2079 (mapconcat 'number-to-string
2080 (org-export-get-headline-number
2081 headline info) ".")))
2082 ;; Create the headline text.
2083 (full-text (org-e-html-format-headline--wrap headline info)))
2084 (cond
2085 ;; Case 1: This is a footnote section: ignore it.
2086 ((org-element-property :footnote-section-p headline) nil)
2087 ;; Case 2. This is a deep sub-tree: export it as a list item.
2088 ;; Also export as items headlines for which no section
2089 ;; format has been found.
2090 ((org-export-low-level-p headline info) ; FIXME (or (not section-fmt))
2091 ;; Build the real contents of the sub-tree.
2092 (let* ((type (if numberedp 'unordered 'unordered)) ; FIXME
2093 (itemized-body (org-e-html-format-list-item
2094 contents type nil nil full-text)))
2095 (concat
2096 (and (org-export-first-sibling-p headline info)
2097 (org-e-html-begin-plain-list type))
2098 itemized-body
2099 (and (org-export-last-sibling-p headline info)
2100 (org-e-html-end-plain-list type)))))
2101 ;; Case 3. Standard headline. Export it as a section.
2103 (let* ((extra-class (org-element-property :html-container-class headline))
2104 (extra-ids (list (org-element-property :custom-id headline)
2105 (org-element-property :id headline)))
2106 (extra-ids
2107 (mapconcat
2108 (lambda (x)
2109 (when x
2110 (let ((id (org-solidify-link-text
2111 (if (org-uuidgen-p x) (concat "ID-" x) x))))
2112 (format "<a id=\"%s\" name=\"%s\"/>" id id))))
2113 extra-ids ""))
2114 (level1 (+ level (1- org-e-html-toplevel-hlevel)))
2115 (id (mapconcat 'number-to-string
2116 (org-export-get-headline-number headline info) "-")))
2117 (format "<div id=\"%s\" class=\"%s\">%s%s</div>\n"
2118 (format "outline-container-%s" id)
2119 (concat (format "outline-%d" level1) (and extra-class " ")
2120 extra-class)
2121 (format "\n<h%d id=\"sec-%s\">%s%s</h%d>\n"
2122 level1 id extra-ids full-text level1)
2123 contents))))))
2126 ;;;; Horizontal Rule
2128 (defun org-e-html-horizontal-rule (horizontal-rule contents info)
2129 "Transcode an HORIZONTAL-RULE object from Org to HTML.
2130 CONTENTS is nil. INFO is a plist holding contextual information."
2131 (let ((attr (mapconcat #'identity
2132 (org-element-property :attr_html horizontal-rule)
2133 " ")))
2134 (org-e-html--wrap-label horizontal-rule "<hr/>\n")))
2137 ;;;; Inline Babel Call
2139 ;; Inline Babel Calls are ignored.
2142 ;;;; Inline Src Block
2144 (defun org-e-html-inline-src-block (inline-src-block contents info)
2145 "Transcode an INLINE-SRC-BLOCK element from Org to HTML.
2146 CONTENTS holds the contents of the item. INFO is a plist holding
2147 contextual information."
2148 (let* ((org-lang (org-element-property :language inline-src-block))
2149 (code (org-element-property :value inline-src-block))
2150 (separator (org-e-html--find-verb-separator code)))
2151 (error "FIXME")))
2154 ;;;; Inlinetask
2156 (defun org-e-html-format-section (text class &optional id)
2157 (let ((extra (concat (when id (format " id=\"%s\"" id)))))
2158 (concat (format "<div class=\"%s\"%s>\n" class extra) text "</div>\n")))
2160 (defun org-e-html-inlinetask (inlinetask contents info)
2161 "Transcode an INLINETASK element from Org to HTML.
2162 CONTENTS holds the contents of the block. INFO is a plist
2163 holding contextual information."
2164 (cond
2165 ;; If `org-e-html-format-inlinetask-function' is provided, call it
2166 ;; with appropriate arguments.
2167 ((functionp org-e-html-format-inlinetask-function)
2168 (let ((format-function
2169 (function*
2170 (lambda (todo todo-type priority text tags
2171 &key contents &allow-other-keys)
2172 (funcall org-e-html-format-inlinetask-function
2173 todo todo-type priority text tags contents)))))
2174 (org-e-html-format-headline--wrap
2175 inlinetask info format-function :contents contents)))
2176 ;; Otherwise, use a default template.
2177 (t (org-e-html--wrap-label
2178 inlinetask
2179 (format
2180 "\n<div class=\"inlinetask\">\n<b>%s</b><br/>\n%s\n</div>"
2181 (org-e-html-format-headline--wrap inlinetask info)
2182 contents)))))
2185 ;;;; Italic
2187 (defun org-e-html-italic (italic contents info)
2188 "Transcode ITALIC from Org to HTML.
2189 CONTENTS is the text with italic markup. INFO is a plist holding
2190 contextual information."
2191 (format (or (cdr (assq 'italic org-e-html-text-markup-alist)) "%s") contents))
2194 ;;;; Item
2196 (defun org-e-html-checkbox (checkbox)
2197 (case checkbox (on "<code>[X]</code>")
2198 (off "<code>[&nbsp;]</code>")
2199 (trans "<code>[-]</code>")
2200 (t "")))
2202 (defun org-e-html-format-list-item (contents type checkbox
2203 &optional term-counter-id
2204 headline)
2205 (concat
2206 (case type
2207 (ordered
2208 (let* ((counter term-counter-id)
2209 (extra (if counter (format " value=\"%s\"" counter) "")))
2210 (format "<li%s>" extra)))
2211 (unordered
2212 (let* ((id term-counter-id)
2213 (extra (if id (format " id=\"%s\"" id) "")))
2214 (concat
2215 (format "<li%s>" extra)
2216 (when headline (concat headline "<br/>")))))
2217 (descriptive
2218 (let* ((term term-counter-id))
2219 (setq term (or term "(no term)"))
2220 (concat (format "<dt> %s </dt>" term) "<dd>"))))
2221 (org-e-html-checkbox checkbox) (and checkbox " ")
2222 contents
2223 (case type
2224 (ordered "</li>")
2225 (unordered "</li>")
2226 (descriptive "</dd>"))))
2228 (defun org-e-html-item (item contents info)
2229 "Transcode an ITEM element from Org to HTML.
2230 CONTENTS holds the contents of the item. INFO is a plist holding
2231 contextual information."
2232 ;; Grab `:level' from plain-list properties, which is always the
2233 ;; first element above current item.
2234 (let* ((plain-list (org-export-get-parent item info))
2235 (type (org-element-property :type plain-list))
2236 (level (org-element-property :level plain-list))
2237 (counter (org-element-property :counter item))
2238 (checkbox (org-element-property :checkbox item))
2239 (tag (let ((tag (org-element-property :tag item)))
2240 (and tag (org-export-secondary-string tag info)))))
2241 (org-e-html-format-list-item
2242 contents type checkbox (or tag counter))))
2245 ;;;; Keyword
2247 (defun org-e-html-keyword (keyword contents info)
2248 "Transcode a KEYWORD element from Org to HTML.
2249 CONTENTS is nil. INFO is a plist holding contextual information."
2250 (let ((key (org-element-property :key keyword))
2251 (value (org-element-property :value keyword)))
2252 (cond
2253 ((string= key "LATEX") value)
2254 ((string= key "INDEX") (format "\\index{%s}" value))
2255 ;; Invisible targets.
2256 ((string= key "TARGET") nil) ; FIXME
2257 ((string= key "TOC")
2258 (let ((value (downcase value)))
2259 (cond
2260 ((string-match "\\<headlines\\>" value)
2261 (let ((depth (or (and (string-match "[0-9]+" value)
2262 (string-to-number (match-string 0 value)))
2263 (plist-get info :with-toc))))
2264 (when (wholenump depth) (org-e-html-toc depth info))))
2265 ((string= "tables" value) "\\listoftables")
2266 ((string= "figures" value) "\\listoffigures")
2267 ((string= "listings" value)
2268 (cond
2269 ;; At the moment, src blocks with a caption are wrapped
2270 ;; into a figure environment.
2271 (t "\\listoffigures")))))))))
2274 ;;;; Latex Environment
2276 (defun org-e-html-format-latex (latex-frag processing-type)
2277 (let* ((cache-relpath
2278 (concat "ltxpng/" (file-name-sans-extension
2279 (file-name-nondirectory (buffer-file-name)))))
2280 (cache-dir (file-name-directory (buffer-file-name )))
2281 (display-msg "Creating LaTeX Image..."))
2283 (with-temp-buffer
2284 (insert latex-frag)
2285 (org-format-latex cache-relpath cache-dir nil display-msg
2286 nil nil processing-type)
2287 (buffer-string))))
2289 (defun org-e-html-latex-environment (latex-environment contents info)
2290 "Transcode a LATEX-ENVIRONMENT element from Org to HTML.
2291 CONTENTS is nil. INFO is a plist holding contextual information."
2292 (org-e-html--wrap-label
2293 latex-environment
2294 (let ((processing-type (plist-get info :LaTeX-fragments))
2295 (latex-frag (org-remove-indentation
2296 (org-element-property :value latex-environment)))
2297 (caption (org-e-html--caption/label-string
2298 (org-element-property :caption latex-environment)
2299 (org-element-property :name latex-environment)
2300 info))
2301 (attr nil) ; FIXME
2302 (label (org-element-property :name latex-environment)))
2303 (cond
2304 ((member processing-type '(t mathjax))
2305 (org-e-html-format-latex latex-frag 'mathjax))
2306 ((equal processing-type 'dvipng)
2307 (let* ((formula-link (org-e-html-format-latex
2308 latex-frag processing-type)))
2309 (when (and formula-link
2310 (string-match "file:\\([^]]*\\)" formula-link))
2311 (org-e-html-format-inline-image
2312 (match-string 1 formula-link) caption label attr t))))
2313 (t latex-frag)))))
2316 ;;;; Latex Fragment
2318 (defun org-e-html-latex-fragment (latex-fragment contents info)
2319 "Transcode a LATEX-FRAGMENT object from Org to HTML.
2320 CONTENTS is nil. INFO is a plist holding contextual information."
2321 (let ((latex-frag (org-element-property :value latex-fragment))
2322 (processing-type (plist-get info :LaTeX-fragments)))
2323 (case processing-type
2324 ((t mathjax)
2325 (org-e-html-format-latex latex-frag 'mathjax))
2326 (dvipng
2327 (let* ((formula-link (org-e-html-format-latex
2328 latex-frag processing-type)))
2329 (when (and formula-link
2330 (string-match "file:\\([^]]*\\)" formula-link))
2331 (org-e-html-format-inline-image
2332 (match-string 1 formula-link)))))
2333 (t latex-frag))))
2335 ;;;; Line Break
2337 (defun org-e-html-line-break (line-break contents info)
2338 "Transcode a LINE-BREAK object from Org to HTML.
2339 CONTENTS is nil. INFO is a plist holding contextual information."
2340 "<br/>")
2343 ;;;; Link
2345 (defun org-e-html-link--inline-image (link desc info)
2346 "Return HTML code for an inline image.
2347 LINK is the link pointing to the inline image. INFO is a plist
2348 used as a communication channel."
2349 (let* ((type (org-element-property :type link))
2350 (raw-path (org-element-property :path link))
2351 (path (cond ((member type '("http" "https"))
2352 (concat type ":" raw-path))
2353 ((file-name-absolute-p raw-path)
2354 (expand-file-name raw-path))
2355 (t raw-path)))
2356 (parent (org-export-get-parent-paragraph link info))
2357 (caption (org-e-html--caption/label-string
2358 (org-element-property :caption parent)
2359 (org-element-property :name parent)
2360 info))
2361 (label (org-element-property :name parent))
2362 ;; Retrieve latex attributes from the element around.
2363 (attr (let ((raw-attr
2364 (mapconcat #'identity
2365 (org-element-property :attr_html parent)
2366 " ")))
2367 (unless (string= raw-attr "") raw-attr))))
2368 ;; Now clear ATTR from any special keyword and set a default
2369 ;; value if nothing is left.
2370 (setq attr (if (not attr) "" (org-trim attr)))
2371 ;; Return proper string, depending on DISPOSITION.
2372 (org-e-html-format-inline-image
2373 path caption label attr (org-e-html-standalone-image-p link info))))
2375 (defvar org-e-html-standalone-image-predicate)
2376 (defun org-e-html-standalone-image-p (element info &optional predicate)
2377 "Test if ELEMENT is a standalone image for the purpose HTML export.
2378 INFO is a plist holding contextual information.
2380 Return non-nil, if ELEMENT is of type paragraph and it's sole
2381 content, save for whitespaces, is a link that qualifies as an
2382 inline image.
2384 Return non-nil, if ELEMENT is of type link and it's containing
2385 paragraph has no other content save for leading and trailing
2386 whitespaces.
2388 Return nil, otherwise.
2390 Bind `org-e-html-standalone-image-predicate' to constrain
2391 paragraph further. For example, to check for only captioned
2392 standalone images, do the following.
2394 \(setq org-e-html-standalone-image-predicate
2395 \(lambda \(paragraph\)
2396 \(org-element-property :caption paragraph\)\)\)
2398 (let ((paragraph (case (org-element-type element)
2399 (paragraph element)
2400 (link (and (org-export-inline-image-p
2401 element org-e-html-inline-image-rules)
2402 (org-export-get-parent element info)))
2403 (t nil))))
2404 (when paragraph
2405 (assert (eq (org-element-type paragraph) 'paragraph))
2406 (when (or (not (and (boundp 'org-e-html-standalone-image-predicate)
2407 (functionp org-e-html-standalone-image-predicate)))
2408 (funcall org-e-html-standalone-image-predicate paragraph))
2409 (let ((contents (org-element-contents paragraph)))
2410 (loop for x in contents
2411 with inline-image-count = 0
2412 always (cond
2413 ((eq (org-element-type x) 'plain-text)
2414 (not (org-string-nw-p x)))
2415 ((eq (org-element-type x) 'link)
2416 (when (org-export-inline-image-p
2417 x org-e-html-inline-image-rules)
2418 (= (incf inline-image-count) 1)))
2419 (t nil))))))))
2421 (defun org-e-html-link (link desc info)
2422 "Transcode a LINK object from Org to HTML.
2424 DESC is the description part of the link, or the empty string.
2425 INFO is a plist holding contextual information. See
2426 `org-export-data'."
2427 (let* ((type (org-element-property :type link))
2428 (raw-path (org-element-property :path link))
2429 ;; Ensure DESC really exists, or set it to nil.
2430 (desc (and (not (string= desc "")) desc))
2431 (path (cond
2432 ((member type '("http" "https" "ftp" "mailto"))
2433 (concat type ":" raw-path))
2434 ((string= type "file")
2435 (when (string-match "\\(.+\\)::.+" raw-path)
2436 (setq raw-path (match-string 1 raw-path)))
2437 (if (file-name-absolute-p raw-path)
2438 (concat "file://" (expand-file-name raw-path))
2439 ;; TODO: Not implemented yet. Concat also:
2440 ;; (org-export-directory :HTML info)
2441 (concat "file://" raw-path)))
2442 (t raw-path)))
2443 protocol)
2444 (cond
2445 ;; Image file.
2446 ((and (or (eq t org-e-html-inline-images)
2447 (and org-e-html-inline-images (not desc)))
2448 (org-export-inline-image-p link org-e-html-inline-image-rules))
2449 (org-e-html-link--inline-image link desc info))
2450 ;; Radioed target: Target's name is obtained from original raw
2451 ;; link. Path is parsed and transcoded in order to have a proper
2452 ;; display of the contents.
2453 ((string= type "radio")
2454 (format "<a href=\"#%s\">%s</a>"
2455 (org-export-solidify-link-text path)
2456 (org-export-secondary-string
2457 (org-element-parse-secondary-string
2458 path (org-element-restriction 'radio-target))
2459 info)))
2460 ;; Links pointing to an headline: Find destination and build
2461 ;; appropriate referencing command.
2462 ((member type '("custom-id" "fuzzy" "id"))
2463 (let ((destination (if (string= type "fuzzy")
2464 (org-export-resolve-fuzzy-link link info)
2465 (org-export-resolve-id-link link info))))
2466 (case (org-element-type destination)
2467 ;; Fuzzy link points nowhere.
2468 ('nil
2469 (format "<i>%s</i>"
2470 (or desc
2471 (org-export-secondary-string
2472 (org-element-property :raw-link link) info))))
2473 ;; Fuzzy link points to an invisible target.
2474 (keyword nil)
2475 ;; LINK points to an headline. If headlines are numbered
2476 ;; and the link has no description, display headline's
2477 ;; number. Otherwise, display description or headline's
2478 ;; title.
2479 (headline
2480 (let* ((headline-no (org-export-get-headline-number destination info))
2481 (label (format "sec-%s" (mapconcat 'number-to-string
2482 headline-no "-")))
2483 (section-no (mapconcat 'number-to-string headline-no ".")))
2484 (setq desc
2485 (cond
2486 (desc desc)
2487 ((plist-get info :section-numbers) section-no)
2488 (t (org-export-secondary-string
2489 (org-element-property :title destination) info))))
2490 (format "<a href=\"#%s\">%s</a>" label desc)))
2491 ;; Fuzzy link points to a target. Do as above.
2492 (otherwise
2493 (let ((path (org-export-solidify-link-text path)) number)
2494 (unless desc
2495 (setq number (cond
2496 ((org-e-html-standalone-image-p destination info)
2497 (org-export-get-ordinal
2498 (assoc 'link (org-element-contents destination))
2499 info 'link 'org-e-html-standalone-image-p))
2500 (t (org-export-get-ordinal destination info))))
2501 (setq desc (when number
2502 (if (atom number) (number-to-string number)
2503 (mapconcat 'number-to-string number ".")))))
2504 (format "<a href=\"#%s\">%s</a>" path (or desc "FIXME")))))))
2505 ;; Coderef: replace link with the reference name or the
2506 ;; equivalent line number.
2507 ((string= type "coderef")
2508 (let ((fragment (concat "coderef-" path)))
2509 (format "<a href=\"#%s\" %s>%s</a>" fragment
2510 (format (concat "class=\"coderef\""
2511 " onmouseover=\"CodeHighlightOn(this, '%s');\""
2512 " onmouseout=\"CodeHighlightOff(this, '%s');\"")
2513 fragment fragment)
2514 (format (org-export-get-coderef-format path desc)
2515 (org-export-resolve-coderef path info)))))
2516 ;; Link type is handled by a special function.
2517 ((functionp (setq protocol (nth 2 (assoc type org-link-protocols))))
2518 (funcall protocol (org-link-unescape path) desc 'html))
2519 ;; External link with a description part.
2520 ((and path desc) (format "<a href=\"%s\">%s</a>" path desc))
2521 ;; External link without a description part.
2522 (path (format "<a href=\"%s\">%s</a>" path path))
2523 ;; No path, only description. Try to do something useful.
2524 (t (format "<i>%s</i>" desc)))))
2527 ;;;; Babel Call
2529 ;; Babel Calls are ignored.
2532 ;;;; Macro
2534 (defun org-e-html-macro (macro contents info)
2535 "Transcode a MACRO element from Org to HTML.
2536 CONTENTS is nil. INFO is a plist holding contextual information."
2537 ;; Use available tools.
2538 (org-export-expand-macro macro info))
2541 ;;;; Paragraph
2543 (defun org-e-html-paragraph (paragraph contents info)
2544 "Transcode a PARAGRAPH element from Org to HTML.
2545 CONTENTS is the contents of the paragraph, as a string. INFO is
2546 the plist used as a communication channel."
2547 (let* ((style nil) ; FIXME
2548 (class (cdr (assoc style '((footnote . "footnote")
2549 (verse . nil)))))
2550 (extra (if class (format " class=\"%s\"" class) ""))
2551 (parent (org-export-get-parent paragraph info)))
2552 (cond
2553 ((and (equal (car parent) 'item)
2554 (= (org-element-property :begin paragraph)
2555 (org-element-property :contents-begin parent)))
2556 ;; leading paragraph in a list item have no tags
2557 contents)
2558 ((org-e-html-standalone-image-p paragraph info)
2559 ;; standalone image
2560 contents)
2561 (t (format "\n<p%s>\n%s\n</p>" extra contents)))))
2564 ;;;; Plain List
2566 (defun org-e-html-begin-plain-list (type &optional arg1)
2567 (case type
2568 (ordered
2569 (format "<ol%s>" (if arg1 ; FIXME
2570 (format " start=\"%d\"" arg1)
2571 "")))
2572 (unordered "<ul>")
2573 (descriptive "<dl>")))
2575 (defun org-e-html-end-plain-list (type)
2576 (case type
2577 (ordered "</ol>")
2578 (unordered "</ul>")
2579 (descriptive "</dl>")))
2581 (defun org-e-html-plain-list (plain-list contents info)
2582 "Transcode a PLAIN-LIST element from Org to HTML.
2583 CONTENTS is the contents of the list. INFO is a plist holding
2584 contextual information."
2585 (let* (arg1 ;; FIXME
2586 (type (org-element-property :type plain-list))
2587 (attr (mapconcat #'identity
2588 (org-element-property :attr_html plain-list)
2589 " ")))
2590 (org-e-html--wrap-label
2591 plain-list (format "%s\n%s%s"
2592 (org-e-html-begin-plain-list type)
2593 contents (org-e-html-end-plain-list type)))))
2595 ;;;; Plain Text
2597 (defun org-e-html-convert-special-strings (string)
2598 "Convert special characters in STRING to HTML."
2599 (let ((all org-e-html-special-string-regexps)
2600 e a re rpl start)
2601 (while (setq a (pop all))
2602 (setq re (car a) rpl (cdr a) start 0)
2603 (while (string-match re string start)
2604 (setq string (replace-match rpl t nil string))))
2605 string))
2607 (defun org-e-html-encode-plain-text (s)
2608 "Convert plain text characters to HTML equivalent.
2609 Possible conversions are set in `org-export-html-protect-char-alist'."
2610 (let ((cl org-e-html-protect-char-alist) c)
2611 (while (setq c (pop cl))
2612 (let ((start 0))
2613 (while (string-match (car c) s start)
2614 (setq s (replace-match (cdr c) t t s)
2615 start (1+ (match-beginning 0))))))
2618 (defun org-e-html-plain-text (text info)
2619 "Transcode a TEXT string from Org to HTML.
2620 TEXT is the string to transcode. INFO is a plist holding
2621 contextual information."
2622 (setq text (org-e-html-encode-plain-text text))
2623 ;; Protect %, #, &, $, ~, ^, _, { and }.
2624 ;; (while (string-match "\\([^\\]\\|^\\)\\([%$#&{}~^_]\\)" text)
2625 ;; (setq text
2626 ;; (replace-match (format "\\%s" (match-string 2 text)) nil t text 2)))
2627 ;; Protect \
2628 ;; (setq text (replace-regexp-in-string
2629 ;; "\\(?:[^\\]\\|^\\)\\(\\\\\\)\\(?:[^%$#&{}~^_\\]\\|$\\)"
2630 ;; "$\\backslash$" text nil t 1))
2631 ;; HTML into \HTML{} and TeX into \TeX{}.
2632 ;; (let ((case-fold-search nil)
2633 ;; (start 0))
2634 ;; (while (string-match "\\<\\(\\(?:La\\)?TeX\\)\\>" text start)
2635 ;; (setq text (replace-match
2636 ;; (format "\\%s{}" (match-string 1 text)) nil t text)
2637 ;; start (match-end 0))))
2638 ;; Handle quotation marks
2639 ;; (setq text (org-e-html--quotation-marks text info))
2640 ;; Convert special strings.
2641 ;; (when (plist-get info :with-special-strings)
2642 ;; (while (string-match (regexp-quote "...") text)
2643 ;; (setq text (replace-match "\\ldots{}" nil t text))))
2644 (when (plist-get info :with-special-strings)
2645 (setq text (org-e-html-convert-special-strings text)))
2646 ;; Handle break preservation if required.
2647 (when (plist-get info :preserve-breaks)
2648 (setq text (replace-regexp-in-string "\\(\\\\\\\\\\)?[ \t]*\n" " \\\\\\\\\n"
2649 text)))
2650 ;; Return value.
2651 text)
2654 ;; Planning
2656 (defun org-e-html-planning (planning contents info)
2657 "Transcode a PLANNING element from Org to HTML.
2658 CONTENTS is nil. INFO is a plist used as a communication
2659 channel."
2660 (let ((span-fmt "<span class=\"timestamp-kwd\">%s</span> <span class=\"timestamp\">%s</span>"))
2661 (format
2662 "<p><span class=\"timestamp-wrapper\">%s</span></p>"
2663 (mapconcat
2664 'identity
2665 (delq nil
2666 (list
2667 (let ((closed (org-element-property :closed planning)))
2668 (when closed
2669 (format span-fmt org-closed-string
2670 (org-translate-time closed))))
2671 (let ((deadline (org-element-property :deadline planning)))
2672 (when deadline
2673 (format span-fmt org-deadline-string
2674 (org-translate-time deadline))))
2675 (let ((scheduled (org-element-property :scheduled planning)))
2676 (when scheduled
2677 (format span-fmt org-scheduled-string
2678 (org-translate-time scheduled))))))
2679 " "))))
2682 ;;;; Property Drawer
2684 (defun org-e-html-property-drawer (property-drawer contents info)
2685 "Transcode a PROPERTY-DRAWER element from Org to HTML.
2686 CONTENTS is nil. INFO is a plist holding contextual
2687 information."
2688 ;; The property drawer isn't exported but we want separating blank
2689 ;; lines nonetheless.
2693 ;;;; Quote Block
2695 (defun org-e-html-quote-block (quote-block contents info)
2696 "Transcode a QUOTE-BLOCK element from Org to HTML.
2697 CONTENTS holds the contents of the block. INFO is a plist
2698 holding contextual information."
2699 (org-e-html--wrap-label
2700 quote-block (format "<blockquote>\n%s</blockquote>" contents)))
2703 ;;;; Quote Section
2705 (defun org-e-html-quote-section (quote-section contents info)
2706 "Transcode a QUOTE-SECTION element from Org to HTML.
2707 CONTENTS is nil. INFO is a plist holding contextual information."
2708 (let ((value (org-remove-indentation
2709 (org-element-property :value quote-section))))
2710 (when value (format "<pre>\n%s</pre>" value))))
2713 ;;;; Section
2715 (defun org-e-html-section (section contents info) ; FIXME
2716 "Transcode a SECTION element from Org to HTML.
2717 CONTENTS holds the contents of the section. INFO is a plist
2718 holding contextual information."
2719 (let ((parent (org-export-get-parent-headline section info)))
2720 ;; Before first headline: no container, just return CONTENTS.
2721 (if (not parent) contents
2722 ;; Get div's class and id references.
2723 (let ((class-num (+ (org-export-get-relative-level parent info)
2724 (1- org-e-html-toplevel-hlevel)))
2725 (id-num
2726 (mapconcat
2727 'number-to-string
2728 (org-export-get-headline-number parent info) "-")))
2729 ;; Build return value.
2730 (format "<div class=\"outline-text-%d\" id=\"text-%s\">\n%s</div>"
2731 class-num id-num contents)))))
2733 ;;;; Radio Target
2735 (defun org-e-html-radio-target (radio-target text info)
2736 "Transcode a RADIO-TARGET object from Org to HTML.
2737 TEXT is the text of the target. INFO is a plist holding
2738 contextual information."
2739 (let ((id (org-export-solidify-link-text
2740 (org-element-property :value radio-target))))
2741 (format "<a id=\"%s\" name=\"%s\">%s</a>" id id text)))
2744 ;;;; Special Block
2746 (defun org-e-html-special-block (special-block contents info)
2747 "Transcode a SPECIAL-BLOCK element from Org to HTML.
2748 CONTENTS holds the contents of the block. INFO is a plist
2749 holding contextual information."
2750 (let ((type (downcase (org-element-property :type special-block))))
2751 (org-e-html--wrap-label
2752 special-block
2753 (format "\\begin{%s}\n%s\\end{%s}" type contents type))))
2756 ;;;; Src Block
2758 (defun org-e-html-src-block (src-block contents info)
2759 "Transcode a SRC-BLOCK element from Org to HTML.
2760 CONTENTS holds the contents of the item. INFO is a plist holding
2761 contextual information."
2762 (let* ((lang (org-element-property :language src-block))
2763 (caption (org-element-property :caption src-block))
2764 (label (org-element-property :name src-block))
2765 (caption-str (org-e-html--caption/label-string caption label info))
2766 (attr (mapconcat #'identity
2767 (org-element-property :attr_html src-block)
2768 " "))
2769 ;; (switches (org-element-property :switches src-block))
2770 (switches nil) ; FIXME
2771 (textarea-p (and switches (string-match "-t\\>" switches)))
2772 (code (org-e-html-format-code src-block info)))
2773 (cond
2774 (lang (format
2775 "\n<div class=\"org-src-container\">\n%s%s\n</div>"
2776 (if (not caption) ""
2777 (format "<label class=\"org-src-name\">%s</label>" caption-str))
2778 (format "\n<pre class=\"src src-%s\">%s\n</pre>" lang code)))
2779 (textarea-p
2780 (let ((cols (if (not (string-match "-w[ \t]+\\([0-9]+\\)" switches))
2781 80 (string-to-number (match-string 1 switches))))
2782 (rows (if (string-match "-h[ \t]+\\([0-9]+\\)" switches)
2783 (string-to-number (match-string 1 switches))
2784 (org-count-lines code))))
2785 (format
2786 "\n<p>\n<textarea cols=\"%d\" rows=\"%d\">\n%s\n</textarea>\n</p>"
2787 cols rows code)))
2788 (t (format "\n<pre class=\"example\">\n%s\n</pre>" code)))))
2790 ;;;; Statistics Cookie
2792 (defun org-e-html-statistics-cookie (statistics-cookie contents info)
2793 "Transcode a STATISTICS-COOKIE object from Org to HTML.
2794 CONTENTS is nil. INFO is a plist holding contextual information."
2795 (let ((cookie-value (org-element-property :value statistics-cookie)))
2796 (format "<code>%s</code>" cookie-value)))
2799 ;;;; Strike-Through
2801 (defun org-e-html-strike-through (strike-through contents info)
2802 "Transcode STRIKE-THROUGH from Org to HTML.
2803 CONTENTS is the text with strike-through markup. INFO is a plist
2804 holding contextual information."
2805 (format (or (cdr (assq 'strike-through org-e-html-text-markup-alist)) "%s")
2806 contents))
2809 ;;;; Subscript
2811 (defun org-e-html-subscript (subscript contents info)
2812 "Transcode a SUBSCRIPT object from Org to HTML.
2813 CONTENTS is the contents of the object. INFO is a plist holding
2814 contextual information."
2815 (format "<sub>%s</sub>" contents))
2818 ;;;; Superscript
2820 (defun org-e-html-superscript (superscript contents info)
2821 "Transcode a SUPERSCRIPT object from Org to HTML.
2822 CONTENTS is the contents of the object. INFO is a plist holding
2823 contextual information."
2824 (format "<sup>%s</sup>" contents))
2827 ;;;; Tabel Cell
2829 (defun org-e-html-table-cell (table-cell contents info)
2830 "Transcode a TABLE-CELL element from Org to HTML.
2831 CONTENTS is nil. INFO is a plist used as a communication
2832 channel."
2833 (let* ((table-row (org-export-get-parent table-cell info))
2834 (table (org-export-get-parent-table table-cell info))
2835 (cell-attrs
2836 (if (not org-e-html-table-align-individual-fields) ""
2837 (format (if (and (boundp 'org-e-html-format-table-no-css)
2838 org-e-html-format-table-no-css)
2839 " align=\"%s\"" " class=\"%s\"")
2840 (org-export-table-cell-alignment table-cell info)))))
2841 (when (or (not contents) (string= "" (org-trim contents)))
2842 (setq contents "&nbsp;"))
2843 (cond
2844 ((and (org-export-table-has-header-p table info)
2845 (= 1 (org-export-table-row-group table-row info)))
2846 (concat "\n" (format (car org-e-html-table-header-tags) "col" cell-attrs)
2847 contents (cdr org-e-html-table-header-tags)))
2848 ((and org-e-html-table-use-header-tags-for-first-column
2849 (zerop (cdr (org-export-table-cell-address table-cell info))))
2850 (concat "\n" (format (car org-e-html-table-header-tags) "row" cell-attrs)
2851 contents (cdr org-e-html-table-header-tags)))
2852 (t (concat "\n" (format (car org-e-html-table-data-tags) cell-attrs)
2853 contents (cdr org-e-html-table-data-tags))))))
2856 ;;;; Table Row
2858 (defun org-e-html-table-row (table-row contents info)
2859 "Transcode a TABLE-ROW element from Org to HTML.
2860 CONTENTS is the contents of the row. INFO is a plist used as a
2861 communication channel."
2862 ;; Rules are ignored since table separators are deduced from
2863 ;; borders of the current row.
2864 (when (eq (org-element-property :type table-row) 'standard)
2865 (let* ((first-rowgroup-p (= 1 (org-export-table-row-group table-row info)))
2866 (rowgroup-tags
2867 (cond
2868 ;; Case 1: Row belongs to second or subsequent rowgroups.
2869 ((not (= 1 (org-export-table-row-group table-row info)))
2870 '("\n<tbody>" . "\n</tbody>"))
2871 ;; Case 2: Row is from first rowgroup. Table has >=1 rowgroups.
2872 ((org-export-table-has-header-p
2873 (org-export-get-parent-table table-row info) info)
2874 '("\n<thead>" . "\n</thead>"))
2875 ;; Case 2: Row is from first and only row group.
2876 (t '("\n<tbody>" . "\n</tbody>")))))
2877 (concat
2878 ;; Begin a rowgroup?
2879 (when (org-export-table-row-starts-rowgroup-p table-row info)
2880 (car rowgroup-tags))
2881 ;; Actual table row
2882 (concat "\n" (eval (car org-e-html-table-row-tags))
2883 contents (eval (cdr org-e-html-table-row-tags)))
2884 ;; End a rowgroup?
2885 (when (org-export-table-row-ends-rowgroup-p table-row info)
2886 (cdr rowgroup-tags))))))
2889 ;;;; Table
2891 (defun org-e-html-table-first-row-data-cells (table info)
2892 (let ((table-row
2893 (org-element-map
2894 table 'table-row
2895 (lambda (row)
2896 (unless (eq (org-element-property :type row) 'rule) row))
2897 info 'first-match))
2898 (special-column-p (org-export-table-has-special-column-p table)))
2899 (if (not special-column-p) (org-element-contents table-row)
2900 (cdr (org-element-contents table-row)))))
2902 (defun org-e-html-table--table.el-table (table info)
2903 (when (eq (org-element-property :type table) 'table.el)
2904 (require 'table)
2905 (let ((outbuf (with-current-buffer
2906 (get-buffer-create "*org-export-table*")
2907 (erase-buffer) (current-buffer))))
2908 (with-temp-buffer
2909 (insert (org-element-property :value table))
2910 (goto-char 1)
2911 (re-search-forward "^[ \t]*|[^|]" nil t)
2912 (table-generate-source 'html outbuf))
2913 (with-current-buffer outbuf
2914 (prog1 (org-trim (buffer-string))
2915 (kill-buffer) )))))
2917 (defun org-e-html-table (table contents info)
2918 "Transcode a TABLE element from Org to HTML.
2919 CONTENTS is nil. INFO is a plist holding contextual information."
2920 (case (org-element-property :type table)
2921 ;; Case 1: table.el table. Convert it using appropriate tools.
2922 (table.el (org-e-html-table--table.el-table table info))
2923 ;; Case 2: Standard table.
2925 (let* ((label (org-element-property :name table))
2926 (caption (org-e-html--caption/label-string
2927 (org-element-property :caption table) label info))
2928 (attributes (mapconcat #'identity
2929 (org-element-property :attr_html table)
2930 " "))
2931 (alignspec
2932 (if (and (boundp 'org-e-html-format-table-no-css)
2933 org-e-html-format-table-no-css)
2934 "align=\"%s\"" "class=\"%s\""))
2935 (table-column-specs
2936 (function
2937 (lambda (table info)
2938 (mapconcat
2939 (lambda (table-cell)
2940 (let ((alignment (org-export-table-cell-alignment
2941 table-cell info)))
2942 (concat
2943 ;; Begin a colgroup?
2944 (when (org-export-table-cell-starts-colgroup-p
2945 table-cell info)
2946 "\n<colgroup>")
2947 ;; Add a column. Also specify it's alignment.
2948 (format "\n<col %s/>" (format alignspec alignment))
2949 ;; End a colgroup?
2950 (when (org-export-table-cell-ends-colgroup-p
2951 table-cell info)
2952 "\n</colgroup>"))))
2953 (org-e-html-table-first-row-data-cells table info) "\n"))))
2954 (table-attributes
2955 (let ((table-tag (plist-get info :html-table-tag)))
2956 (concat
2957 (and (string-match "<table\\(.*\\)>" table-tag)
2958 (match-string 1 table-tag))
2959 (and label (format " id=\"%s\""
2960 (org-solidify-link-text label)))))))
2961 ;; Remove last blank line.
2962 (setq contents (substring contents 0 -1))
2963 ;; FIXME: splice
2964 (format "\n<table%s>\n<caption>%s</caption>\n%s\n%s\n</table>"
2965 table-attributes
2966 (or caption "")
2967 (funcall table-column-specs table info)
2968 contents)))))
2970 ;;;; Target
2972 (defun org-e-html-target (target contents info)
2973 "Transcode a TARGET object from Org to HTML.
2974 CONTENTS is nil. INFO is a plist holding contextual
2975 information."
2976 (let ((id (org-export-solidify-link-text
2977 (org-element-property :value target))))
2978 (format "<a id=\"%s\" name=\"%s\"/>" id id)))
2981 ;;;; Timestamp
2983 (defun org-e-html-timestamp (timestamp contents info)
2984 "Transcode a TIMESTAMP object from Org to HTML.
2985 CONTENTS is nil. INFO is a plist holding contextual
2986 information."
2987 (let ((value (org-translate-time (org-element-property :value timestamp))))
2988 (format "<span class=\"timestamp-wrapper\"><span class=\"timestamp\">%s</span></span>"
2989 value)))
2992 ;;;; Underline
2994 (defun org-e-html-underline (underline contents info)
2995 "Transcode UNDERLINE from Org to HTML.
2996 CONTENTS is the text with underline markup. INFO is a plist
2997 holding contextual information."
2998 (format (or (cdr (assq 'underline org-e-html-text-markup-alist)) "%s")
2999 contents))
3002 ;;;; Verbatim
3004 (defun org-e-html-verbatim (verbatim contents info)
3005 "Transcode VERBATIM from Org to HTML.
3006 CONTENTS is nil. INFO is a plist holding contextual
3007 information."
3008 (format (or (cdr (assq 'verbatim org-e-html-text-markup-alist)) "%s")
3009 (org-element-property :value verbatim)))
3012 ;;;; Verse Block
3014 (defun org-e-html-verse-block (verse-block contents info)
3015 "Transcode a VERSE-BLOCK element from Org to HTML.
3016 CONTENTS is verse block contents. INFO is a plist holding
3017 contextual information."
3018 ;; Replace each newline character with line break. Also replace
3019 ;; each blank line with a line break.
3020 (setq contents (replace-regexp-in-string
3021 "^ *\\\\\\\\$" "<br/>\n"
3022 (replace-regexp-in-string
3023 "\\(\\\\\\\\\\)?[ \t]*\n" " <br/>\n" contents)))
3024 ;; Replace each white space at beginning of a line with a
3025 ;; non-breaking space.
3026 (while (string-match "^[ \t]+" contents)
3027 (let* ((num-ws (length (match-string 0 contents)))
3028 (ws (let (out) (dotimes (i num-ws out)
3029 (setq out (concat out "&nbsp;"))))))
3030 (setq contents (replace-match ws nil t contents))))
3031 (org-e-html--wrap-label
3032 verse-block (format "<p class=\"verse\">\n%s</p>" contents)))
3037 ;;; Filter Functions
3039 ;;;; Filter Settings
3041 (defconst org-e-html-filters-alist
3042 '((:filter-final-output . org-e-html-final-function))
3043 "Alist between filters keywords and back-end specific filters.
3044 See `org-export-filters-alist' for more information.")
3047 ;;;; Filters
3049 (defun org-e-html-final-function (contents backend info)
3050 (if (not org-e-html-pretty-output) contents
3051 (with-temp-buffer
3052 (nxml-mode)
3053 (insert contents)
3054 (indent-region (point-min) (point-max))
3055 (buffer-substring-no-properties (point-min) (point-max)))))
3058 ;;; Interactive functions
3060 (defun org-e-html-export-to-html
3061 (&optional subtreep visible-only body-only ext-plist pub-dir)
3062 "Export current buffer to a HTML file.
3064 If narrowing is active in the current buffer, only export its
3065 narrowed part.
3067 If a region is active, export that region.
3069 When optional argument SUBTREEP is non-nil, export the sub-tree
3070 at point, extracting information from the headline properties
3071 first.
3073 When optional argument VISIBLE-ONLY is non-nil, don't export
3074 contents of hidden elements.
3076 When optional argument BODY-ONLY is non-nil, only write code
3077 between \"\\begin{document}\" and \"\\end{document}\".
3079 EXT-PLIST, when provided, is a property list with external
3080 parameters overriding Org default settings, but still inferior to
3081 file-local settings.
3083 When optional argument PUB-DIR is set, use it as the publishing
3084 directory.
3086 Return output file's name."
3087 (interactive)
3088 (setq debug-on-error t) ; FIXME
3089 (let* ((extension (concat "." org-e-html-extension))
3090 (file (org-export-output-file-name extension subtreep pub-dir)))
3091 (org-export-to-file
3092 'e-html file subtreep visible-only body-only ext-plist)))
3096 ;;; FIXMES, TODOS, FOR REVIEW etc
3098 ;;;; org-format-table-html
3099 ;;;; org-format-org-table-html
3100 ;;;; org-format-table-table-html
3101 ;;;; org-table-number-fraction
3102 ;;;; org-table-number-regexp
3103 ;;;; org-e-html-table-caption-above
3105 ;;;; org-whitespace
3106 ;;;; "<span style=\"visibility:hidden;\">%s</span>"
3107 ;;;; Remove display properties
3109 ;;;; org-e-html-with-timestamp
3110 ;;;; org-e-html-html-helper-timestamp
3112 ;;;; org-export-as-html-and-open
3113 ;;;; org-export-as-html-batch
3114 ;;;; org-export-as-html-to-buffer
3115 ;;;; org-replace-region-by-html
3116 ;;;; org-export-region-as-html
3117 ;;;; org-export-as-html
3119 ;;;; (org-export-directory :html opt-plist)
3120 ;;;; (plist-get opt-plist :html-extension)
3121 ;;;; org-e-html-toplevel-hlevel
3122 ;;;; org-e-html-special-string-regexps
3123 ;;;; org-e-html-coding-system
3124 ;;;; org-e-html-coding-system
3125 ;;;; org-e-html-inline-images
3126 ;;;; org-e-html-inline-image-extensions
3127 ;;;; org-e-html-protect-char-alist
3128 ;;;; org-e-html-table-use-header-tags-for-first-column
3129 ;;;; org-e-html-todo-kwd-class-prefix
3130 ;;;; org-e-html-tag-class-prefix
3131 ;;;; org-e-html-footnote-separator
3133 ;;;; org-export-preferred-target-alist
3134 ;;;; org-solidify-link-text
3135 ;;;; class for anchors
3136 ;;;; org-export-with-section-numbers, body-only
3137 ;;;; org-export-mark-todo-in-toc
3139 (provide 'org-e-html)
3140 ;;; org-e-html.el ends here