org-e-html: Use new source code handling API
[org-mode.git] / EXPERIMENTAL / org-e-html.el
blobe7a19c91526b29c0d48de064a0b8139f17356378
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-clean-table "org-export" (table specialp))
53 (declare-function org-export-data "org-export" (data backend info))
54 (declare-function org-export-directory "org-export" (type plist))
55 (declare-function org-export-expand-macro "org-export" (macro info))
56 (declare-function org-export-first-sibling-p "org-export" (headline info))
57 (declare-function org-export-footnote-first-reference-p "org-export"
58 (footnote-reference info))
59 (declare-function org-export-get-coderef-format "org-export" (path desc))
60 (declare-function org-export-get-footnote-definition "org-export"
61 (footnote-reference info))
62 (declare-function org-export-get-footnote-number "org-export" (footnote info))
63 (declare-function org-export-get-previous-element "org-export" (blob info))
64 (declare-function org-export-get-relative-level "org-export" (headline info))
65 (declare-function org-export-handle-code
66 "org-export" (element info &optional num-fmt ref-fmt delayed))
67 (declare-function org-export-included-file "org-export" (keyword backend info))
68 (declare-function org-export-inline-image-p "org-export"
69 (link &optional extensions))
70 (declare-function org-export-last-sibling-p "org-export" (headline info))
71 (declare-function org-export-low-level-p "org-export" (headline info))
72 (declare-function org-export-output-file-name
73 "org-export" (extension &optional subtreep pub-dir))
74 (declare-function org-export-resolve-coderef "org-export" (ref info))
75 (declare-function org-export-resolve-fuzzy-link "org-export" (link info))
76 (declare-function org-export-secondary-string "org-export"
77 (secondary backend info))
78 (declare-function org-export-solidify-link-text "org-export" (s))
79 (declare-function org-export-table-format-info "org-export" (table))
80 (declare-function
81 org-export-to-buffer "org-export"
82 (backend buffer &optional subtreep visible-only body-only ext-plist))
83 (declare-function
84 org-export-to-file "org-export"
85 (backend file &optional subtreep visible-only body-only ext-plist))
87 (declare-function org-id-find-id-file "org-id" (id))
88 (declare-function htmlize-region "ext:htmlize" (beg end))
89 (declare-function org-pop-to-buffer-same-window
90 "org-compat" (&optional buffer-or-name norecord label))
95 ;;; Internal Variables
97 (defconst org-e-html-option-alist
98 '((:agenda-style nil nil org-agenda-export-html-style)
99 (:convert-org-links nil nil org-e-html-link-org-files-as-html)
100 ;; FIXME Use (org-xml-encode-org-text-skip-links s) ??
101 ;; (:expand-quoted-html nil "@" org-e-html-expand)
102 (:inline-images nil nil org-e-html-inline-images)
103 ;; (:link-home nil nil org-e-html-link-home) FIXME
104 ;; (:link-up nil nil org-e-html-link-up) FIXME
105 (:style nil nil org-e-html-style)
106 (:style-extra nil nil org-e-html-style-extra)
107 (:style-include-default nil nil org-e-html-style-include-default)
108 (:style-include-scripts nil nil org-e-html-style-include-scripts)
109 ;; (:timestamp nil nil org-e-html-with-timestamp)
110 (:html-extension nil nil org-e-html-extension)
111 (:html-postamble nil nil org-e-html-postamble)
112 (:html-preamble nil nil org-e-html-preamble)
113 (:html-table-tag nil nil org-e-html-table-tag)
114 (:xml-declaration nil nil org-e-html-xml-declaration)
115 (:LaTeX-fragments nil "LaTeX" org-export-with-LaTeX-fragments)
116 (:mathjax "MATHJAX" nil "" space))
117 "Alist between export properties and ways to set them.
119 The car of the alist is the property name, and the cdr is a list
120 like \(KEYWORD OPTION DEFAULT BEHAVIOUR\) where:
122 KEYWORD is a string representing a buffer keyword, or nil.
123 OPTION is a string that could be found in an #+OPTIONS: line.
124 DEFAULT is the default value for the property.
125 BEHAVIOUR determine how Org should handle multiple keywords for
126 the same property. It is a symbol among:
127 nil Keep old value and discard the new one.
128 t Replace old value with the new one.
129 `space' Concatenate the values, separating them with a space.
130 `newline' Concatenate the values, separating them with
131 a newline.
132 `split' Split values at white spaces, and cons them to the
133 previous list.
135 KEYWORD and OPTION have precedence over DEFAULT.
137 All these properties should be back-end agnostic. For back-end
138 specific properties, define a similar variable named
139 `org-BACKEND-option-alist', replacing BACKEND with the name of
140 the appropriate back-end. You can also redefine properties
141 there, as they have precedence over these.")
143 (defvar html-table-tag nil) ; dynamically scoped into this.
145 ;; FIXME: it already exists in org-e-html.el
146 (defconst org-e-html-cvt-link-fn
148 "Function to convert link URLs to exportable URLs.
149 Takes two arguments, TYPE and PATH.
150 Returns exportable url as (TYPE PATH), or nil to signal that it
151 didn't handle this case.
152 Intended to be locally bound around a call to `org-export-as-html'." )
157 (defvar org-e-html-format-table-no-css)
158 (defvar htmlize-buffer-places) ; from htmlize.el
159 (defvar body-only) ; dynamically scoped into this.
161 (defvar org-e-html-table-rowgrp-open)
162 (defvar org-e-html-table-rownum)
163 (defvar org-e-html-table-cur-rowgrp-is-hdr)
164 (defvar org-lparse-table-is-styled)
168 ;;; User Configuration Variables
170 (defgroup org-export-e-html nil
171 "Options for exporting Org mode files to HTML."
172 :tag "Org Export HTML"
173 :group 'org-export)
175 ;;;; Debugging
177 (defcustom org-e-html-pretty-output t
178 "Enable this to generate pretty HTML."
179 :group 'org-export-e-html
180 :type 'boolean)
183 ;;;; Document
185 (defcustom org-e-html-extension "html"
186 "The extension for exported HTML files."
187 :group 'org-export-e-html
188 :type 'string)
190 (defcustom org-e-html-xml-declaration
191 '(("html" . "<?xml version=\"1.0\" encoding=\"%s\"?>")
192 ("php" . "<?php echo \"<?xml version=\\\"1.0\\\" encoding=\\\"%s\\\" ?>\"; ?>"))
193 "The extension for exported HTML files.
194 %s will be replaced with the charset of the exported file.
195 This may be a string, or an alist with export extensions
196 and corresponding declarations."
197 :group 'org-export-e-html
198 :type '(choice
199 (string :tag "Single declaration")
200 (repeat :tag "Dependent on extension"
201 (cons (string :tag "Extension")
202 (string :tag "Declaration")))))
204 (defcustom org-e-html-coding-system nil
205 "Coding system for HTML export, defaults to `buffer-file-coding-system'."
206 :group 'org-export-e-html
207 :type 'coding-system)
209 (defvar org-e-html-content-div "content"
210 "The name of the container DIV that holds all the page contents.
212 This variable is obsolete since Org version 7.7.
213 Please set `org-e-html-divs' instead.")
215 (defcustom org-e-html-divs '("preamble" "content" "postamble")
216 "The name of the main divs for HTML export.
217 This is a list of three strings, the first one for the preamble
218 DIV, the second one for the content DIV and the third one for the
219 postamble DIV."
220 :group 'org-export-e-html
221 :type '(list
222 (string :tag " Div for the preamble:")
223 (string :tag " Div for the content:")
224 (string :tag "Div for the postamble:")))
227 ;;;; Document Header (Styles)
229 (defconst org-e-html-style-default
230 "<style type=\"text/css\">
231 <!--/*--><![CDATA[/*><!--*/
232 html { font-family: Times, serif; font-size: 12pt; }
233 .title { text-align: center; }
234 .todo { color: red; }
235 .done { color: green; }
236 .tag { background-color: #add8e6; font-weight:normal }
237 .target { }
238 .timestamp { color: #bebebe; }
239 .timestamp-kwd { color: #5f9ea0; }
240 .right {margin-left:auto; margin-right:0px; text-align:right;}
241 .left {margin-left:0px; margin-right:auto; text-align:left;}
242 .center {margin-left:auto; margin-right:auto; text-align:center;}
243 p.verse { margin-left: 3% }
244 pre {
245 border: 1pt solid #AEBDCC;
246 background-color: #F3F5F7;
247 padding: 5pt;
248 font-family: courier, monospace;
249 font-size: 90%;
250 overflow:auto;
252 table { border-collapse: collapse; }
253 td, th { vertical-align: top; }
254 th.right { text-align:center; }
255 th.left { text-align:center; }
256 th.center { text-align:center; }
257 td.right { text-align:right; }
258 td.left { text-align:left; }
259 td.center { text-align:center; }
260 dt { font-weight: bold; }
261 div.figure { padding: 0.5em; }
262 div.figure p { text-align: center; }
263 div.inlinetask {
264 padding:10px;
265 border:2px solid gray;
266 margin:10px;
267 background: #ffffcc;
269 textarea { overflow-x: auto; }
270 .linenr { font-size:smaller }
271 .code-highlighted {background-color:#ffff00;}
272 .org-info-js_info-navigation { border-style:none; }
273 #org-info-js_console-label { font-size:10px; font-weight:bold;
274 white-space:nowrap; }
275 .org-info-js_search-highlight {background-color:#ffff00; color:#000000;
276 font-weight:bold; }
277 /*]]>*/-->
278 </style>"
279 "The default style specification for exported HTML files.
280 Please use the variables `org-e-html-style' and
281 `org-e-html-style-extra' to add to this style. If you wish to not
282 have the default style included, customize the variable
283 `org-e-html-style-include-default'.")
285 (defcustom org-e-html-style-include-default t
286 "Non-nil means include the default style in exported HTML files.
287 The actual style is defined in `org-e-html-style-default' and should
288 not be modified. Use the variables `org-e-html-style' to add
289 your own style information."
290 :group 'org-export-e-html
291 :type 'boolean)
292 ;;;###autoload
293 (put 'org-e-html-style-include-default 'safe-local-variable 'booleanp)
295 (defcustom org-e-html-style ""
296 "Org-wide style definitions for exported HTML files.
298 This variable needs to contain the full HTML structure to provide a style,
299 including the surrounding HTML tags. If you set the value of this variable,
300 you should consider to include definitions for the following classes:
301 title, todo, done, timestamp, timestamp-kwd, tag, target.
303 For example, a valid value would be:
305 <style type=\"text/css\">
306 <![CDATA[
307 p { font-weight: normal; color: gray; }
308 h1 { color: black; }
309 .title { text-align: center; }
310 .todo, .timestamp-kwd { color: red; }
311 .done { color: green; }
313 </style>
315 If you'd like to refer to an external style file, use something like
317 <link rel=\"stylesheet\" type=\"text/css\" href=\"mystyles.css\">
319 As the value of this option simply gets inserted into the HTML <head> header,
320 you can \"misuse\" it to add arbitrary text to the header.
321 See also the variable `org-e-html-style-extra'."
322 :group 'org-export-e-html
323 :type 'string)
324 ;;;###autoload
325 (put 'org-e-html-style 'safe-local-variable 'stringp)
327 (defcustom org-e-html-style-extra ""
328 "Additional style information for HTML export.
329 The value of this variable is inserted into the HTML buffer right after
330 the value of `org-e-html-style'. Use this variable for per-file
331 settings of style information, and do not forget to surround the style
332 settings with <style>...</style> tags."
333 :group 'org-export-e-html
334 :type 'string)
335 ;;;###autoload
336 (put 'org-e-html-style-extra 'safe-local-variable 'stringp)
338 (defcustom org-e-html-mathjax-options
339 '((path "http://orgmode.org/mathjax/MathJax.js")
340 (scale "100")
341 (align "center")
342 (indent "2em")
343 (mathml nil))
344 "Options for MathJax setup.
346 path The path where to find MathJax
347 scale Scaling for the HTML-CSS backend, usually between 100 and 133
348 align How to align display math: left, center, or right
349 indent If align is not center, how far from the left/right side?
350 mathml Should a MathML player be used if available?
351 This is faster and reduces bandwidth use, but currently
352 sometimes has lower spacing quality. Therefore, the default is
353 nil. When browsers get better, this switch can be flipped.
355 You can also customize this for each buffer, using something like
357 #+MATHJAX: scale:\"133\" align:\"right\" mathml:t path:\"/MathJax/\""
358 :group 'org-export-e-html
359 :type '(list :greedy t
360 (list :tag "path (the path from where to load MathJax.js)"
361 (const :format " " path) (string))
362 (list :tag "scale (scaling for the displayed math)"
363 (const :format " " scale) (string))
364 (list :tag "align (alignment of displayed equations)"
365 (const :format " " align) (string))
366 (list :tag "indent (indentation with left or right alignment)"
367 (const :format " " indent) (string))
368 (list :tag "mathml (should MathML display be used is possible)"
369 (const :format " " mathml) (boolean))))
372 ;;;; Document Header (Scripts)
374 (defcustom org-e-html-style-include-scripts t
375 "Non-nil means include the JavaScript snippets in exported HTML files.
376 The actual script is defined in `org-e-html-scripts' and should
377 not be modified."
378 :group 'org-export-e-html
379 :type 'boolean)
381 (defconst org-e-html-scripts
382 "<script type=\"text/javascript\">
383 <!--/*--><![CDATA[/*><!--*/
384 function CodeHighlightOn(elem, id)
386 var target = document.getElementById(id);
387 if(null != target) {
388 elem.cacheClassElem = elem.className;
389 elem.cacheClassTarget = target.className;
390 target.className = \"code-highlighted\";
391 elem.className = \"code-highlighted\";
394 function CodeHighlightOff(elem, id)
396 var target = document.getElementById(id);
397 if(elem.cacheClassElem)
398 elem.className = elem.cacheClassElem;
399 if(elem.cacheClassTarget)
400 target.className = elem.cacheClassTarget;
402 /*]]>*///-->
403 </script>"
404 "Basic JavaScript that is needed by HTML files produced by Org-mode.")
407 ;;;; Document Header (Mathjax)
409 (defcustom org-e-html-mathjax-template
410 "<script type=\"text/javascript\" src=\"%PATH\">
411 <!--/*--><![CDATA[/*><!--*/
412 MathJax.Hub.Config({
413 // Only one of the two following lines, depending on user settings
414 // First allows browser-native MathML display, second forces HTML/CSS
415 :MMLYES: config: [\"MMLorHTML.js\"], jax: [\"input/TeX\"],
416 :MMLNO: jax: [\"input/TeX\", \"output/HTML-CSS\"],
417 extensions: [\"tex2jax.js\",\"TeX/AMSmath.js\",\"TeX/AMSsymbols.js\",
418 \"TeX/noUndefined.js\"],
419 tex2jax: {
420 inlineMath: [ [\"\\\\(\",\"\\\\)\"] ],
421 displayMath: [ ['$$','$$'], [\"\\\\[\",\"\\\\]\"], [\"\\\\begin{displaymath}\",\"\\\\end{displaymath}\"] ],
422 skipTags: [\"script\",\"noscript\",\"style\",\"textarea\",\"pre\",\"code\"],
423 ignoreClass: \"tex2jax_ignore\",
424 processEscapes: false,
425 processEnvironments: true,
426 preview: \"TeX\"
428 showProcessingMessages: true,
429 displayAlign: \"%ALIGN\",
430 displayIndent: \"%INDENT\",
432 \"HTML-CSS\": {
433 scale: %SCALE,
434 availableFonts: [\"STIX\",\"TeX\"],
435 preferredFont: \"TeX\",
436 webFont: \"TeX\",
437 imageFont: \"TeX\",
438 showMathMenu: true,
440 MMLorHTML: {
441 prefer: {
442 MSIE: \"MML\",
443 Firefox: \"MML\",
444 Opera: \"HTML\",
445 other: \"HTML\"
449 /*]]>*///-->
450 </script>"
451 "The MathJax setup for XHTML files."
452 :group 'org-export-e-html
453 :type 'string)
456 ;;;; Preamble
458 (defcustom org-e-html-preamble t
459 "Non-nil means insert a preamble in HTML export.
461 When `t', insert a string as defined by one of the formatting
462 strings in `org-e-html-preamble-format'. When set to a
463 string, this string overrides `org-e-html-preamble-format'.
464 When set to a function, apply this function and insert the
465 returned string. The function takes the property list of export
466 options as its only argument.
468 Setting :html-preamble in publishing projects will take
469 precedence over this variable."
470 :group 'org-export-e-html
471 :type '(choice (const :tag "No preamble" nil)
472 (const :tag "Default preamble" t)
473 (string :tag "Custom formatting string")
474 (function :tag "Function (must return a string)")))
476 (defcustom org-e-html-preamble-format '(("en" ""))
477 "The format for the HTML preamble.
479 %t stands for the title.
480 %a stands for the author's name.
481 %e stands for the author's email.
482 %d stands for the date.
484 If you need to use a \"%\" character, you need to escape it
485 like that: \"%%\"."
486 :group 'org-export-e-html
487 :type 'string)
489 (defcustom org-e-html-home/up-format
490 "<div id=\"org-div-home-and-up\" style=\"text-align:right;font-size:70%%;white-space:nowrap;\">
491 <a accesskey=\"h\" href=\"%s\"> UP </a>
493 <a accesskey=\"H\" href=\"%s\"> HOME </a>
494 </div>"
495 "Snippet used to insert the HOME and UP links.
496 This is a format string, the first %s will receive the UP link,
497 the second the HOME link. If both `org-e-html-link-up' and
498 `org-e-html-link-home' are empty, the entire snippet will be
499 ignored."
500 :group 'org-export-e-html
501 :type 'string)
503 ;;;; Postamble
505 (defcustom org-e-html-postamble 'auto
506 "Non-nil means insert a postamble in HTML export.
508 When `t', insert a string as defined by the formatting string in
509 `org-e-html-postamble-format'. When set to a string, this
510 string overrides `org-e-html-postamble-format'. When set to
511 'auto, discard `org-e-html-postamble-format' and honor
512 `org-export-author/email/creator-info' variables. When set to a
513 function, apply this function and insert the returned string.
514 The function takes the property list of export options as its
515 only argument.
517 Setting :html-postamble in publishing projects will take
518 precedence over this variable."
519 :group 'org-export-e-html
520 :type '(choice (const :tag "No postamble" nil)
521 (const :tag "Auto preamble" 'auto)
522 (const :tag "Default formatting string" t)
523 (string :tag "Custom formatting string")
524 (function :tag "Function (must return a string)")))
526 (defcustom org-e-html-postamble-format
527 '(("en" "<p class=\"author\">Author: %a (%e)</p>
528 <p class=\"date\">Date: %d</p>
529 <p class=\"creator\">Generated by %c</p>
530 <p class=\"xhtml-validation\">%v</p>
532 "The format for the HTML postamble.
534 %a stands for the author's name.
535 %e stands for the author's email.
536 %d stands for the date.
537 %c will be replaced by information about Org/Emacs versions.
538 %v will be replaced by `org-e-html-validation-link'.
540 If you need to use a \"%\" character, you need to escape it
541 like that: \"%%\"."
542 :group 'org-export-e-html
543 :type 'string)
545 (defcustom org-e-html-validation-link
546 "<a href=\"http://validator.w3.org/check?uri=referer\">Validate XHTML 1.0</a>"
547 "Link to HTML validation service."
548 :group 'org-export-e-html
549 :type 'string)
551 ;; FIXME Obsolete since Org 7.7
552 ;; Use the :timestamp option or `org-export-time-stamp-file' instead
553 ;;;; Emphasis
555 (defcustom org-e-html-protect-char-alist
556 '(("&" . "&amp;")
557 ("<" . "&lt;")
558 (">" . "&gt;"))
559 "Alist of characters to be converted by `org-e-html-protect'."
560 :group 'org-export-e-html
561 :type '(repeat (cons (string :tag "Character")
562 (string :tag "HTML equivalent"))))
564 (defconst org-e-html-special-string-regexps
565 '(("\\\\-" . "&shy;")
566 ("---\\([^-]\\)" . "&mdash;\\1")
567 ("--\\([^-]\\)" . "&ndash;\\1")
568 ("\\.\\.\\." . "&hellip;"))
569 "Regular expressions for special string conversion.")
572 ;;;; Todos
574 (defcustom org-e-html-todo-kwd-class-prefix ""
575 "Prefix to class names for TODO keywords.
576 Each TODO keyword gets a class given by the keyword itself, with this prefix.
577 The default prefix is empty because it is nice to just use the keyword
578 as a class name. But if you get into conflicts with other, existing
579 CSS classes, then this prefix can be very useful."
580 :group 'org-export-e-html
581 :type 'string)
584 ;;;; Tags
586 (defcustom org-e-html-tag-class-prefix ""
587 "Prefix to class names for TODO keywords.
588 Each tag gets a class given by the tag itself, with this prefix.
589 The default prefix is empty because it is nice to just use the keyword
590 as a class name. But if you get into conflicts with other, existing
591 CSS classes, then this prefix can be very useful."
592 :group 'org-export-e-html
593 :type 'string)
595 ;;;; Time-stamps
596 ;;;; Statistics Cookie
597 ;;;; Subscript
598 ;;;; Superscript
600 ;;;; Inline images
602 (defcustom org-e-html-inline-images 'maybe
603 "Non-nil means inline images into exported HTML pages.
604 This is done using an <img> tag. When nil, an anchor with href is used to
605 link to the image. If this option is `maybe', then images in links with
606 an empty description will be inlined, while images with a description will
607 be linked only."
608 :group 'org-export-e-html
609 :type '(choice (const :tag "Never" nil)
610 (const :tag "Always" t)
611 (const :tag "When there is no description" maybe)))
613 (defcustom org-e-html-inline-image-extensions
614 '("png" "jpeg" "jpg" "gif" "svg")
615 "Extensions of image files that can be inlined into HTML."
616 :group 'org-export-e-html
617 :type '(repeat (string :tag "Extension")))
620 ;;;; Block
621 ;;;; Comment
622 ;;;; Comment Block
623 ;;;; Drawer
624 ;;;; Dynamic Block
625 ;;;; Emphasis
626 ;;;; Entity
627 ;;;; Example Block
628 ;;;; Export Snippet
629 ;;;; Export Block
630 ;;;; Fixed Width
631 ;;;; Footnotes
633 (defcustom org-e-html-footnotes-section "<div id=\"footnotes\">
634 <h2 class=\"footnotes\">%s: </h2>
635 <div id=\"text-footnotes\">
637 </div>
638 </div>"
639 "Format for the footnotes section.
640 Should contain a two instances of %s. The first will be replaced with the
641 language-specific word for \"Footnotes\", the second one will be replaced
642 by the footnotes themselves."
643 :group 'org-export-e-html
644 :type 'string)
646 (defcustom org-e-html-footnote-format "<sup>%s</sup>"
647 "The format for the footnote reference.
648 %s will be replaced by the footnote reference itself."
649 :group 'org-export-e-html
650 :type 'string)
652 (defcustom org-e-html-footnote-separator "<sup>, </sup>"
653 "Text used to separate footnotes."
654 :group 'org-export-e-html
655 :type 'string)
658 ;;;; Headline
659 ;;;; Horizontal Rule
660 ;;;; Inline Babel Call
661 ;;;; Inline Src Block
662 ;;;; Inlinetask
663 ;;;; Item
664 ;;;; Keyword
665 ;;;; Latex Environment
666 ;;;; Latex Fragment
667 ;;;; Line Break
668 ;;;; Link
669 ;;;; Babel Call
670 ;;;; Macro
671 ;;;; Paragraph
672 ;;;; Plain List
673 ;;;; Plain Text
674 ;;;; Property Drawer
675 ;;;; Quote Block
676 ;;;; Quote Section
677 ;;;; Section
678 ;;;; Radio Target
679 ;;;; Special Block
680 ;;;; Src Block
682 (defgroup org-export-e-htmlize nil
683 "Options for processing examples with htmlize.el."
684 :tag "Org Export Htmlize"
685 :group 'org-export-e-html)
687 (defcustom org-export-e-htmlize-output-type 'inline-css
688 "Output type to be used by htmlize when formatting code snippets.
689 Choices are `css', to export the CSS selectors only, or `inline-css', to
690 export the CSS attribute values inline in the HTML. We use as default
691 `inline-css', in order to make the resulting HTML self-containing.
693 However, this will fail when using Emacs in batch mode for export, because
694 then no rich font definitions are in place. It will also not be good if
695 people with different Emacs setup contribute HTML files to a website,
696 because the fonts will represent the individual setups. In these cases,
697 it is much better to let Org/Htmlize assign classes only, and to use
698 a style file to define the look of these classes.
699 To get a start for your css file, start Emacs session and make sure that
700 all the faces you are interested in are defined, for example by loading files
701 in all modes you want. Then, use the command
702 \\[org-export-e-htmlize-generate-css] to extract class definitions."
703 :group 'org-export-e-htmlize
704 :type '(choice (const css) (const inline-css)))
706 (defcustom org-export-e-htmlize-css-font-prefix "org-"
707 "The prefix for CSS class names for htmlize font specifications."
708 :group 'org-export-e-htmlize
709 :type 'string)
711 (defcustom org-export-e-htmlized-org-css-url nil
712 "URL pointing to a CSS file defining text colors for htmlized Emacs buffers.
713 Normally when creating an htmlized version of an Org buffer, htmlize will
714 create CSS to define the font colors. However, this does not work when
715 converting in batch mode, and it also can look bad if different people
716 with different fontification setup work on the same website.
717 When this variable is non-nil, creating an htmlized version of an Org buffer
718 using `org-export-as-org' will remove the internal CSS section and replace it
719 with a link to this URL."
720 :group 'org-export-e-htmlize
721 :type '(choice
722 (const :tag "Keep internal css" nil)
723 (string :tag "URL or local href")))
726 ;;;; Table
728 (defcustom org-e-html-table-tag
729 "<table border=\"2\" cellspacing=\"0\" cellpadding=\"6\" rules=\"groups\" frame=\"hsides\">"
730 "The HTML tag that is used to start a table.
731 This must be a <table> tag, but you may change the options like
732 borders and spacing."
733 :group 'org-export-e-html
734 :type 'string)
736 (defcustom org-e-html-table-header-tags '("<th scope=\"%s\"%s>" . "</th>")
737 "The opening tag for table header 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-use-header-tags-for-first-column'.
742 See also the variable `org-e-html-table-align-individual-fields'."
743 :group 'org-export-tables ; FIXME: change group?
744 :type '(cons (string :tag "Opening tag") (string :tag "Closing tag")))
746 (defcustom org-e-html-table-data-tags '("<td%s>" . "</td>")
747 "The opening tag for table data fields.
748 This is customizable so that alignment options can be specified.
749 The first %s will be filled with the scope of the field, either row or col.
750 The second %s will be replaced by a style entry to align the field.
751 See also the variable `org-e-html-table-align-individual-fields'."
752 :group 'org-export-tables
753 :type '(cons (string :tag "Opening tag") (string :tag "Closing tag")))
755 (defcustom org-e-html-table-row-tags '("<tr>" . "</tr>")
756 "The opening tag for table data fields.
757 This is customizable so that alignment options can be specified.
758 Instead of strings, these can be Lisp forms that will be evaluated
759 for each row in order to construct the table row tags. During evaluation,
760 the variable `head' will be true when this is a header line, nil when this
761 is a body line. And the variable `nline' will contain the line number,
762 starting from 1 in the first header line. For example
764 (setq org-e-html-table-row-tags
765 (cons '(if head
766 \"<tr>\"
767 (if (= (mod nline 2) 1)
768 \"<tr class=\\\"tr-odd\\\">\"
769 \"<tr class=\\\"tr-even\\\">\"))
770 \"</tr>\"))
772 will give even lines the class \"tr-even\" and odd lines the class \"tr-odd\"."
773 :group 'org-export-tables
774 :type '(cons
775 (choice :tag "Opening tag"
776 (string :tag "Specify")
777 (sexp))
778 (choice :tag "Closing tag"
779 (string :tag "Specify")
780 (sexp))))
782 (defcustom org-e-html-table-align-individual-fields t
783 "Non-nil means attach style attributes for alignment to each table field.
784 When nil, alignment will only be specified in the column tags, but this
785 is ignored by some browsers (like Firefox, Safari). Opera does it right
786 though."
787 :group 'org-export-tables
788 :type 'boolean)
790 (defcustom org-e-html-table-use-header-tags-for-first-column nil
791 "Non-nil means format column one in tables with header tags.
792 When nil, also column one will use data tags."
793 :group 'org-export-tables
794 :type 'boolean)
797 ;;;; Target
798 ;;;; Time-stamp
800 ;;;; Verbatim
801 ;;;; Verse Block
802 ;;;; Headline
804 (defcustom org-e-html-toplevel-hlevel 2
805 "The <H> level for level 1 headings in HTML export.
806 This is also important for the classes that will be wrapped around headlines
807 and outline structure. If this variable is 1, the top-level headlines will
808 be <h1>, and the corresponding classes will be outline-1, section-number-1,
809 and outline-text-1. If this is 2, all of these will get a 2 instead.
810 The default for this variable is 2, because we use <h1> for formatting the
811 document title."
812 :group 'org-export-e-html
813 :type 'string)
816 ;;;; Links
817 ;;;; Drawers
818 ;;;; Inlinetasks
819 ;;;; Publishing
821 (defcustom org-e-html-link-org-files-as-html t
822 "Non-nil means make file links to `file.org' point to `file.html'.
823 When org-mode is exporting an org-mode file to HTML, links to
824 non-html files are directly put into a href tag in HTML.
825 However, links to other Org-mode files (recognized by the
826 extension `.org.) should become links to the corresponding html
827 file, assuming that the linked org-mode file will also be
828 converted to HTML.
829 When nil, the links still point to the plain `.org' file."
830 :group 'org-export-e-html
831 :type 'boolean)
834 ;;;; Compilation
838 ;;; User Configurable Variables (MAYBE)
840 ;;;; Preamble
842 (defcustom org-e-html-date-format
843 "\\today"
844 "Format string for \\date{...}."
845 :group 'org-export-e-html
846 :type 'boolean)
848 ;;;; Headline
850 (defcustom org-e-html-format-headline-function nil
851 "Function to format headline text.
853 This function will be called with 5 arguments:
854 TODO the todo keyword \(string or nil\).
855 TODO-TYPE the type of todo \(symbol: `todo', `done', nil\)
856 PRIORITY the priority of the headline \(integer or nil\)
857 TEXT the main headline text \(string\).
858 TAGS the tags string, separated with colons \(string or nil\).
860 The function result will be used in the section format string.
862 As an example, one could set the variable to the following, in
863 order to reproduce the default set-up:
865 \(defun org-e-html-format-headline \(todo todo-type priority text tags\)
866 \"Default format function for an headline.\"
867 \(concat \(when todo
868 \(format \"\\\\textbf{\\\\textsc{\\\\textsf{%s}}} \" todo\)\)
869 \(when priority
870 \(format \"\\\\framebox{\\\\#%c} \" priority\)\)
871 text
872 \(when tags \(format \"\\\\hfill{}\\\\textsc{%s}\" tags\)\)\)\)"
873 :group 'org-export-e-html
874 :type 'function)
876 ;;;; Emphasis
878 (defcustom org-e-html-emphasis-alist
879 '(("*" . "<b>%s</b>")
880 ("/" . "<i>%s</i>")
881 ("_" . "<span style=\"text-decoration:underline;\">%s</span>")
882 ("+" . "<del>%s</del>")
883 ("=" . "<code>%s</code>")
884 ("~" . "<code>%s</code>"))
885 "Alist of HTML expressions to convert emphasis fontifiers.
887 The key is the character used as a marker for fontification. The
888 value is a formatting string to wrap fontified text with.
890 Value can also be set to the following symbols: `verb' and
891 `protectedtexttt'. For the former, Org will use \"\\verb\" to
892 create a format string and select a delimiter character that
893 isn't in the string. For the latter, Org will use \"\\texttt\"
894 to typeset and try to protect special characters."
895 :group 'org-export-e-html
896 :type 'alist)
899 ;;;; Footnotes
901 (defcustom org-e-html-footnote-separator "<sup>, </sup>"
902 "Text used to separate footnotes."
903 :group 'org-export-e-html
904 :type 'string)
907 ;;;; Time-stamps
909 (defcustom org-e-html-active-timestamp-format "\\textit{%s}"
910 "A printf format string to be applied to active time-stamps."
911 :group 'org-export-e-html
912 :type 'string)
914 (defcustom org-e-html-inactive-timestamp-format "\\textit{%s}"
915 "A printf format string to be applied to inactive time-stamps."
916 :group 'org-export-e-html
917 :type 'string)
919 (defcustom org-e-html-diary-timestamp-format "\\textit{%s}"
920 "A printf format string to be applied to diary time-stamps."
921 :group 'org-export-e-html
922 :type 'string)
925 ;;;; Links
927 (defcustom org-e-html-inline-image-rules
928 '(("file" . "\\.\\(jpeg\\|jpg\\|png\\|gif\\|svg\\)\\'")
929 ("http" . "\\.\\(jpeg\\|jpg\\|png\\|gif\\|svg\\)\\'")
930 ("https" . "\\.\\(jpeg\\|jpg\\|png\\|gif\\|svg\\)\\'"))
931 "Rules characterizing image files that can be inlined into HTML.
933 A rule consists in an association whose key is the type of link
934 to consider, and value is a regexp that will be matched against
935 link's path.
937 Note that, by default, the image extension *actually* allowed
938 depend on the way the HTML file is processed. When used with
939 pdflatex, pdf, jpg and png images are OK. When processing
940 through dvi to Postscript, only ps and eps are allowed. The
941 default we use here encompasses both."
942 :group 'org-export-e-html
943 :type '(alist :key-type (string :tag "Type")
944 :value-type (regexp :tag "Path")))
946 ;;;; Tables
948 (defcustom org-e-html-table-caption-above t
949 "When non-nil, place caption string at the beginning of the table.
950 Otherwise, place it near the end."
951 :group 'org-export-e-html
952 :type 'boolean)
954 ;;;; Drawers
956 (defcustom org-e-html-format-drawer-function nil
957 "Function called to format a drawer in HTML code.
959 The function must accept two parameters:
960 NAME the drawer name, like \"LOGBOOK\"
961 CONTENTS the contents of the drawer.
963 The function should return the string to be exported.
965 For example, the variable could be set to the following function
966 in order to mimic default behaviour:
968 \(defun org-e-html-format-drawer-default \(name contents\)
969 \"Format a drawer element for HTML export.\"
970 contents\)"
971 :group 'org-export-e-html
972 :type 'function)
975 ;;;; Inlinetasks
977 (defcustom org-e-html-format-inlinetask-function nil
978 "Function called to format an inlinetask in HTML code.
980 The function must accept six parameters:
981 TODO the todo keyword, as a string
982 TODO-TYPE the todo type, a symbol among `todo', `done' and nil.
983 PRIORITY the inlinetask priority, as a string
984 NAME the inlinetask name, as a string.
985 TAGS the inlinetask tags, as a string.
986 CONTENTS the contents of the inlinetask, as a string.
988 The function should return the string to be exported.
990 For example, the variable could be set to the following function
991 in order to mimic default behaviour:
993 \(defun org-e-html-format-inlinetask \(todo type priority name tags contents\)
994 \"Format an inline task element for HTML export.\"
995 \(let \(\(full-title
996 \(concat
997 \(when todo
998 \(format \"\\\\textbf{\\\\textsf{\\\\textsc{%s}}} \" todo\)\)
999 \(when priority \(format \"\\\\framebox{\\\\#%c} \" priority\)\)
1000 title
1001 \(when tags \(format \"\\\\hfill{}\\\\textsc{%s}\" tags\)\)\)\)\)
1002 \(format \(concat \"\\\\begin{center}\\n\"
1003 \"\\\\fbox{\\n\"
1004 \"\\\\begin{minipage}[c]{.6\\\\textwidth}\\n\"
1005 \"%s\\n\\n\"
1006 \"\\\\rule[.8em]{\\\\textwidth}{2pt}\\n\\n\"
1007 \"%s\"
1008 \"\\\\end{minipage}}\"
1009 \"\\\\end{center}\"\)
1010 full-title contents\)\)"
1011 :group 'org-export-e-html
1012 :type 'function)
1015 ;; Src blocks
1017 ;;;; Plain text
1019 (defcustom org-e-html-quotes
1020 '(("fr"
1021 ("\\(\\s-\\|[[(]\\)\"" . "«~")
1022 ("\\(\\S-\\)\"" . "~»")
1023 ("\\(\\s-\\|(\\)'" . "'"))
1024 ("en"
1025 ("\\(\\s-\\|[[(]\\)\"" . "``")
1026 ("\\(\\S-\\)\"" . "''")
1027 ("\\(\\s-\\|(\\)'" . "`")))
1028 "Alist for quotes to use when converting english double-quotes.
1030 The CAR of each item in this alist is the language code.
1031 The CDR of each item in this alist is a list of three CONS.
1032 - the first CONS defines the opening quote
1033 - the second CONS defines the closing quote
1034 - the last CONS defines single quotes
1036 For each item in a CONS, the first string is a regexp for allowed
1037 characters before/after the quote, the second string defines the
1038 replacement string for this quote."
1039 :group 'org-export-e-html
1040 :type '(list
1041 (cons :tag "Opening quote"
1042 (string :tag "Regexp for char before")
1043 (string :tag "Replacement quote "))
1044 (cons :tag "Closing quote"
1045 (string :tag "Regexp for char after ")
1046 (string :tag "Replacement quote "))
1047 (cons :tag "Single quote"
1048 (string :tag "Regexp for char before")
1049 (string :tag "Replacement quote "))))
1052 ;;;; Compilation
1056 ;;; Internal Functions (HTML)
1058 (defun org-e-html-cvt-org-as-html (opt-plist type path)
1059 "Convert an org filename to an equivalent html filename.
1060 If TYPE is not file, just return `nil'.
1061 See variable `org-e-html-link-org-files-as-html'."
1062 (save-match-data
1063 (and
1064 org-e-html-link-org-files-as-html
1065 (string= type "file")
1066 (string-match "\\.org$" path)
1067 (progn
1068 (list
1069 "file"
1070 (concat
1071 (substring path 0 (match-beginning 0))
1072 "." (plist-get opt-plist :html-extension)))))))
1074 (defun org-e-html-format-org-link (opt-plist type-1 path fragment desc attr
1075 descp)
1076 "Make an HTML link.
1077 OPT-PLIST is an options list.
1078 TYPE is the device-type of the link (THIS://foo.html).
1079 PATH is the path of the link (http://THIS#location).
1080 FRAGMENT is the fragment part of the link, if any (foo.html#THIS).
1081 DESC is the link description, if any.
1082 ATTR is a string of other attributes of the \"a\" element."
1083 (declare (special org-lparse-par-open))
1084 (save-match-data
1085 (when (string= type-1 "coderef")
1086 (let ((ref fragment))
1087 (setq desc (format (org-export-get-coderef-format ref (and descp desc))
1088 (cdr (assoc ref org-export-code-refs)))
1089 fragment (concat "coderef-" ref)
1090 attr (format "class=\"coderef\" onmouseover=\"CodeHighlightOn(this, '%s');\" onmouseout=\"CodeHighlightOff(this, '%s');\""
1091 fragment fragment))))
1092 (let* ((may-inline-p
1093 (and (member type-1 '("http" "https" "file"))
1094 (org-lparse-should-inline-p path descp)
1095 (not fragment)))
1096 (type (if (equal type-1 "id") "file" type-1))
1097 (filename path)
1098 ;;First pass. Just sanity stuff.
1099 (components-1
1100 (cond
1101 ((string= type "file")
1102 (list
1103 type
1104 ;;Substitute just if original path was absolute.
1105 ;;(Otherwise path must remain relative)
1106 (if (file-name-absolute-p path)
1107 (concat "file://" (expand-file-name path))
1108 path)))
1109 ((string= type "")
1110 (list nil path))
1111 (t (list type path))))
1113 ;;Second pass. Components converted so they can refer
1114 ;;to a remote site.
1115 (components-2
1117 (and org-e-html-cvt-link-fn
1118 (apply org-e-html-cvt-link-fn
1119 opt-plist components-1))
1120 (apply #'org-e-html-cvt-org-as-html
1121 opt-plist components-1)
1122 components-1))
1123 (type (first components-2))
1124 (thefile (second components-2)))
1127 ;;Third pass. Build final link except for leading type
1128 ;;spec.
1129 (cond
1130 ((or
1131 (not type)
1132 (string= type "http")
1133 (string= type "https")
1134 (string= type "file")
1135 (string= type "coderef"))
1136 (if fragment
1137 (setq thefile (concat thefile "#" fragment))))
1139 (t))
1141 ;;Final URL-build, for all types.
1142 (setq thefile
1143 (let
1144 ((str (org-xml-format-href thefile)))
1145 (if (and type (not (or (string= "file" type)
1146 (string= "coderef" type))))
1147 (concat type ":" str)
1148 str)))
1150 (if may-inline-p
1151 (ignore) ;; (org-e-html-format-image thefile)
1152 (org-lparse-format
1153 'LINK (org-xml-format-desc desc) thefile attr)))))
1155 ;; (caption (and caption (org-xml-encode-org-text caption)))
1156 ;; alt = (file-name-nondirectory path)
1158 (defun org-e-html-format-inline-image (src &optional
1159 caption label attr standalone-p)
1160 (let* ((id (if (not label) ""
1161 (format " id=\"%s\"" (org-export-solidify-link-text label))))
1162 (attr (concat attr
1163 (cond
1164 ((string-match "\\<alt=" (or attr "")) "")
1165 ((string-match "^ltxpng/" src)
1166 (format " alt=\"%s\""
1167 (org-e-html-encode-plain-text
1168 (org-find-text-property-in-string
1169 'org-latex-src src))))
1170 (t (format " alt=\"%s\""
1171 (file-name-nondirectory src)))))))
1172 (cond
1173 (standalone-p
1174 (let ((img (format "<img src=\"%s\" %s/>" src attr)))
1175 (format "\n<div%s class=\"figure\">%s%s\n</div>"
1176 id (format "\n<p>%s</p>" img)
1177 (when caption (format "\n<p>%s</p>" caption)))))
1178 (t (format "<img src=\"%s\" %s/>" src (concat attr id))))))
1180 ;;;; Bibliography
1182 (defun org-e-html-bibliography ()
1183 "Find bibliography, cut it out and return it."
1184 (catch 'exit
1185 (let (beg end (cnt 1) bib)
1186 (save-excursion
1187 (goto-char (point-min))
1188 (when (re-search-forward
1189 "^[ \t]*<div \\(id\\|class\\)=\"bibliography\"" nil t)
1190 (setq beg (match-beginning 0))
1191 (while (re-search-forward "</?div\\>" nil t)
1192 (setq cnt (+ cnt (if (string= (match-string 0) "<div") +1 -1)))
1193 (when (= cnt 0)
1194 (and (looking-at ">") (forward-char 1))
1195 (setq bib (buffer-substring beg (point)))
1196 (delete-region beg (point))
1197 (throw 'exit bib))))
1198 nil))))
1200 ;;;; Table
1202 (defun org-e-html-format-table (lines olines)
1203 (let ((org-e-html-format-table-no-css nil))
1204 (org-lparse-format-table lines olines)))
1206 (defun org-e-html-splice-attributes (tag attributes)
1207 "Read attributes in string ATTRIBUTES, add and replace in HTML tag TAG."
1208 (if (not attributes)
1210 (let (oldatt newatt)
1211 (setq oldatt (org-extract-attributes-from-string tag)
1212 tag (pop oldatt)
1213 newatt (cdr (org-extract-attributes-from-string attributes)))
1214 (while newatt
1215 (setq oldatt (plist-put oldatt (pop newatt) (pop newatt))))
1216 (if (string-match ">" tag)
1217 (setq tag
1218 (replace-match (concat (org-attributes-to-string oldatt) ">")
1219 t t tag)))
1220 tag)))
1222 (defun org-export-splice-style (style extra)
1223 "Splice EXTRA into STYLE, just before \"</style>\"."
1224 (if (and (stringp extra)
1225 (string-match "\\S-" extra)
1226 (string-match "</style>" style))
1227 (concat (substring style 0 (match-beginning 0))
1228 "\n" extra "\n"
1229 (substring style (match-beginning 0)))
1230 style))
1232 (defun org-export-e-htmlize-region-for-paste (beg end)
1233 "Convert the region to HTML, using htmlize.el.
1234 This is much like `htmlize-region-for-paste', only that it uses
1235 the settings define in the org-... variables."
1236 (let* ((htmlize-output-type org-export-e-htmlize-output-type)
1237 (htmlize-css-name-prefix org-export-e-htmlize-css-font-prefix)
1238 (htmlbuf (htmlize-region beg end)))
1239 (unwind-protect
1240 (with-current-buffer htmlbuf
1241 (buffer-substring (plist-get htmlize-buffer-places 'content-start)
1242 (plist-get htmlize-buffer-places 'content-end)))
1243 (kill-buffer htmlbuf))))
1245 ;;;###autoload
1246 (defun org-export-e-htmlize-generate-css ()
1247 "Create the CSS for all font definitions in the current Emacs session.
1248 Use this to create face definitions in your CSS style file that can then
1249 be used by code snippets transformed by htmlize.
1250 This command just produces a buffer that contains class definitions for all
1251 faces used in the current Emacs session. You can copy and paste the ones you
1252 need into your CSS file.
1254 If you then set `org-export-e-htmlize-output-type' to `css', calls to
1255 the function `org-export-e-htmlize-region-for-paste' will produce code
1256 that uses these same face definitions."
1257 (interactive)
1258 (require 'htmlize)
1259 (and (get-buffer "*html*") (kill-buffer "*html*"))
1260 (with-temp-buffer
1261 (let ((fl (face-list))
1262 (htmlize-css-name-prefix "org-")
1263 (htmlize-output-type 'css)
1264 f i)
1265 (while (setq f (pop fl)
1266 i (and f (face-attribute f :inherit)))
1267 (when (and (symbolp f) (or (not i) (not (listp i))))
1268 (insert (org-add-props (copy-sequence "1") nil 'face f))))
1269 (htmlize-region (point-min) (point-max))))
1270 (org-pop-to-buffer-same-window "*html*")
1271 (goto-char (point-min))
1272 (if (re-search-forward "<style" nil t)
1273 (delete-region (point-min) (match-beginning 0)))
1274 (if (re-search-forward "</style>" nil t)
1275 (delete-region (1+ (match-end 0)) (point-max)))
1276 (beginning-of-line 1)
1277 (if (looking-at " +") (replace-match ""))
1278 (goto-char (point-min)))
1280 (defun org-e-html-make-string (n string)
1281 (let (out) (dotimes (i n out) (setq out (concat string out)))))
1283 (defun org-e-html-toc-text (toc-entries)
1284 (let* ((prev-level (1- (nth 1 (car toc-entries))))
1285 (start-level prev-level))
1286 (concat
1287 (mapconcat
1288 (lambda (entry)
1289 (let ((headline (nth 0 entry))
1290 (level (nth 1 entry)))
1291 (concat
1292 (let* ((cnt (- level prev-level))
1293 (times (if (> cnt 0) (1- cnt) (- cnt)))
1294 rtn)
1295 (setq prev-level level)
1296 (concat
1297 (org-e-html-make-string
1298 times (cond ((> cnt 0) "\n<ul>\n<li>")
1299 ((< cnt 0) "</li>\n</ul>\n")))
1300 (if (> cnt 0) "\n<ul>\n<li>" "</li>\n<li>")))
1301 headline)))
1302 toc-entries "")
1303 (org-e-html-make-string
1304 (- prev-level start-level) "</li>\n</ul>\n"))))
1306 (defun* org-e-html-format-toc-headline
1307 (todo todo-type priority text tags
1308 &key level section-number headline-label &allow-other-keys)
1309 (let ((headline (concat
1310 section-number (and section-number ". ")
1311 text
1312 (and tags "&nbsp;&nbsp;&nbsp;") (org-e-html--tags tags))))
1313 (format "<a href=\"#%s\">%s</a>"
1314 headline-label
1315 (if (not nil) headline
1316 (format "<span class=\"%s\">%s</span>" todo-type headline)))))
1318 (defun org-e-html-toc (depth info)
1319 (assert (wholenump depth))
1320 (let* ((headlines (org-export-collect-headlines info depth))
1321 (toc-entries
1322 (loop for headline in headlines collect
1323 (list (org-e-html-format-headline--wrap
1324 headline info 'org-e-html-format-toc-headline)
1325 (org-export-get-relative-level headline info)))))
1326 (when toc-entries
1327 (let* ((lang-specific-heading
1328 (nth 3 (or (assoc (plist-get info :language)
1329 org-export-language-setup)
1330 (assoc "en" org-export-language-setup)))))
1331 (concat
1332 "<div id=\"table-of-contents\">\n"
1333 (format "<h%d>%s</h%d>\n"
1334 org-e-html-toplevel-hlevel
1335 lang-specific-heading
1336 org-e-html-toplevel-hlevel)
1337 "<div id=\"text-table-of-contents\">"
1338 (org-e-html-toc-text toc-entries)
1339 "</div>\n"
1340 "</div>\n")))))
1342 ;; (defun org-e-html-format-line (line)
1343 ;; (case org-lparse-dyn-current-environment
1344 ;; ((quote fixedwidth) (concat (org-e-html-encode-plain-text line) "\n"))
1345 ;; (t (concat line "\n"))))
1347 (defun org-e-html-fix-class-name (kwd) ; audit callers of this function
1348 "Turn todo keyword into a valid class name.
1349 Replaces invalid characters with \"_\"."
1350 (save-match-data
1351 (while (string-match "[^a-zA-Z0-9_]" kwd)
1352 (setq kwd (replace-match "_" t t kwd))))
1353 kwd)
1355 (defun org-e-html-format-footnote-reference (n def refcnt)
1356 (let ((extra (if (= refcnt 1) "" (format ".%d" refcnt))))
1357 (format org-e-html-footnote-format
1358 (format
1359 "<a class=\"footref\" name=\"fnr.%s%s\" href=\"#fn.%s\">%s</a>"
1360 n extra n n))))
1362 (defun org-e-html-format-footnotes-section (section-name definitions)
1363 (if (not definitions) ""
1364 (format org-e-html-footnotes-section section-name definitions)))
1366 (defun org-e-html-format-footnote-definition (fn)
1367 (let ((n (car fn)) (def (cdr fn)))
1368 (format
1369 "<tr>\n<td>%s</td>\n<td>%s</td>\n</tr>\n"
1370 (format
1371 (format org-e-html-footnote-format
1372 "<a class=\"footnum\" name=\"fn.%s\" href=\"#fnr.%s\">%s</a>")
1373 n n n) def)))
1375 (defun org-e-html-footnote-section (info)
1376 (let* ((fn-alist (org-export-collect-footnote-definitions
1377 (plist-get info :parse-tree) info))
1379 (fn-alist
1380 (loop for (n type raw) in fn-alist collect
1381 (cons n (if (equal (org-element-type raw) 'org-data)
1382 (org-trim (org-export-data raw 'e-html info))
1383 (format "<p>%s</p>"
1384 (org-trim (org-export-secondary-string
1385 raw 'e-html info))))))))
1386 (when fn-alist
1387 (org-e-html-format-footnotes-section
1388 (nth 4 (or (assoc (plist-get info :language)
1389 org-export-language-setup)
1390 (assoc "en" org-export-language-setup)))
1391 (format
1392 "<table>\n%s\n</table>\n"
1393 (mapconcat 'org-e-html-format-footnote-definition fn-alist "\n"))))))
1395 (defun org-e-html-get-coding-system-for-write ()
1396 (or org-e-html-coding-system
1397 (and (boundp 'buffer-file-coding-system) buffer-file-coding-system)))
1399 (defun org-e-html-get-coding-system-for-save ()
1400 (or org-e-html-coding-system
1401 (and (boundp 'buffer-file-coding-system) buffer-file-coding-system)))
1403 (defun org-e-html-format-date (info)
1404 (let ((date (plist-get info :date)))
1405 (cond
1406 ((and date (string-match "%" date))
1407 (format-time-string date))
1408 (date date)
1409 (t (format-time-string "%Y-%m-%d %T %Z")))))
1413 ;;; Internal Functions (Ngz)
1415 (defun org-e-html--caption/label-string (caption label info)
1416 "Return caption and label HTML string for floats.
1418 CAPTION is a cons cell of secondary strings, the car being the
1419 standard caption and the cdr its short form. LABEL is a string
1420 representing the label. INFO is a plist holding contextual
1421 information.
1423 If there's no caption nor label, return the empty string.
1425 For non-floats, see `org-e-html--wrap-label'."
1426 (setq label nil) ;; FIXME
1428 (let ((label-str (if label (format "\\label{%s}" label) "")))
1429 (cond
1430 ((and (not caption) (not label)) "")
1431 ((not caption) (format "\\label{%s}\n" label))
1432 ;; Option caption format with short name.
1433 ((cdr caption)
1434 (format "\\caption[%s]{%s%s}\n"
1435 (org-export-secondary-string (cdr caption) 'e-html info)
1436 label-str
1437 (org-export-secondary-string (car caption) 'e-html info)))
1438 ;; Standard caption format.
1439 ;; (t (format "\\caption{%s%s}\n"
1440 ;; label-str
1441 ;; (org-export-secondary-string (car caption) 'e-html info)))
1443 (t (org-export-secondary-string (car caption) 'e-html info)))))
1445 (defun org-e-html--find-verb-separator (s)
1446 "Return a character not used in string S.
1447 This is used to choose a separator for constructs like \\verb."
1448 (let ((ll "~,./?;':\"|!@#%^&-_=+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ<>()[]{}"))
1449 (loop for c across ll
1450 when (not (string-match (regexp-quote (char-to-string c)) s))
1451 return (char-to-string c))))
1453 (defun org-e-html--quotation-marks (text info)
1454 "Export quotation marks depending on language conventions.
1455 TEXT is a string containing quotation marks to be replaced. INFO
1456 is a plist used as a communication channel."
1457 (mapc (lambda(l)
1458 (let ((start 0))
1459 (while (setq start (string-match (car l) text start))
1460 (let ((new-quote (concat (match-string 1 text) (cdr l))))
1461 (setq text (replace-match new-quote t t text))))))
1462 (cdr (or (assoc (plist-get info :language) org-e-html-quotes)
1463 ;; Falls back on English.
1464 (assoc "en" org-e-html-quotes))))
1465 text)
1467 (defun org-e-html--wrap-label (element output)
1468 "Wrap label associated to ELEMENT around OUTPUT, if appropriate.
1469 This function shouldn't be used for floats. See
1470 `org-e-html--caption/label-string'."
1471 ;; (let ((label (org-element-property :name element)))
1472 ;; (if (or (not output) (not label) (string= output "") (string= label ""))
1473 ;; output
1474 ;; (concat (format "\\label{%s}\n" label) output)))
1475 output)
1479 ;;; Template
1481 (defun org-e-html-meta-info (info)
1482 (let* ((title (org-export-secondary-string
1483 (plist-get info :title) 'e-html info))
1484 (author (and (plist-get info :with-author)
1485 (let ((auth (plist-get info :author)))
1486 (and auth (org-export-secondary-string
1487 auth 'e-html info)))))
1488 (description (plist-get info :description))
1489 (keywords (plist-get info :keywords)))
1490 (concat
1491 (format "\n<title>%s</title>\n" title)
1492 (format
1493 "\n<meta http-equiv=\"Content-Type\" content=\"text/html;charset=%s\"/>"
1494 (and coding-system-for-write
1495 (fboundp 'coding-system-get)
1496 (coding-system-get coding-system-for-write
1497 'mime-charset)))
1498 (format "\n<meta name=\"title\" content=\"%s\"/>" title)
1499 (format "\n<meta name=\"generator\" content=\"Org-mode\"/>")
1500 (format "\n<meta name=\"generated\" content=\"%s\"/>"
1501 (org-e-html-format-date info))
1502 (format "\n<meta name=\"author\" content=\"%s\"/>" author)
1503 (format "\n<meta name=\"description\" content=\"%s\"/>" description)
1504 (format "\n<meta name=\"keywords\" content=\"%s\"/>" keywords))))
1506 (defun org-e-html-style (info)
1507 (concat
1508 "\n" (when (plist-get info :style-include-default) org-e-html-style-default)
1509 (plist-get info :style)
1510 (plist-get info :style-extra)
1511 "\n"
1512 (when (plist-get info :style-include-scripts)
1513 org-e-html-scripts)))
1515 (defun org-e-html-mathjax-config (info)
1516 "Insert the user setup into the matchjax template."
1517 (when (member (plist-get info :LaTeX-fragments) '(mathjax t))
1518 (let ((template org-e-html-mathjax-template)
1519 (options org-e-html-mathjax-options)
1520 (in-buffer (or (plist-get info :mathjax) ""))
1521 name val (yes " ") (no "// ") x)
1522 (mapc
1523 (lambda (e)
1524 (setq name (car e) val (nth 1 e))
1525 (if (string-match (concat "\\<" (symbol-name name) ":") in-buffer)
1526 (setq val (car (read-from-string
1527 (substring in-buffer (match-end 0))))))
1528 (if (not (stringp val)) (setq val (format "%s" val)))
1529 (if (string-match (concat "%" (upcase (symbol-name name))) template)
1530 (setq template (replace-match val t t template))))
1531 options)
1532 (setq val (nth 1 (assq 'mathml options)))
1533 (if (string-match (concat "\\<mathml:") in-buffer)
1534 (setq val (car (read-from-string
1535 (substring in-buffer (match-end 0))))))
1536 ;; Exchange prefixes depending on mathml setting
1537 (if (not val) (setq x yes yes no no x))
1538 ;; Replace cookies to turn on or off the config/jax lines
1539 (if (string-match ":MMLYES:" template)
1540 (setq template (replace-match yes t t template)))
1541 (if (string-match ":MMLNO:" template)
1542 (setq template (replace-match no t t template)))
1543 ;; Return the modified template
1544 template)))
1546 (defun org-e-html-preamble (info)
1547 (when (plist-get info :html-preamble)
1548 (let* ((title (plist-get info :title))
1549 (date (org-e-html-format-date info))
1550 (author (plist-get info :author))
1551 (lang-words (or (assoc (plist-get info :language)
1552 org-export-language-setup)
1553 (assoc "en" org-export-language-setup)))
1554 (email (plist-get info :email))
1555 (html-pre-real-contents
1556 (cond
1557 ((functionp (plist-get info :html-preamble))
1558 (with-temp-buffer
1559 (funcall (plist-get info :html-preamble))
1560 (buffer-string)))
1561 ((stringp (plist-get info :html-preamble))
1562 (format-spec (plist-get info :html-preamble)
1563 `((?t . ,title) (?a . ,author)
1564 (?d . ,date) (?e . ,email))))
1566 (format-spec
1567 (or (cadr (assoc (nth 0 lang-words)
1568 org-e-html-preamble-format))
1569 (cadr (assoc "en" org-e-html-preamble-format)))
1570 `((?t . ,title) (?a . ,author)
1571 (?d . ,date) (?e . ,email)))))))
1572 (when (not (equal html-pre-real-contents ""))
1573 (concat
1574 (format "
1575 <div id=\"%s\"> " (nth 0 org-e-html-divs))
1578 html-pre-real-contents
1580 </div>")))))
1582 (defun org-e-html-postamble (info)
1583 (concat
1584 (when (and (not body-only)
1585 (plist-get info :html-postamble))
1586 (let* ((html-post (plist-get info :html-postamble))
1587 (date (org-e-html-format-date info))
1588 (author (plist-get info :author))
1589 (email (plist-get info :email))
1590 (lang-words (or (assoc (plist-get info :language)
1591 org-export-language-setup)
1592 (assoc "en" org-export-language-setup)))
1593 (email
1594 (mapconcat (lambda(e)
1595 (format "<a href=\"mailto:%s\">%s</a>" e e))
1596 (split-string email ",+ *")
1597 ", "))
1598 (html-validation-link (or org-e-html-validation-link ""))
1599 (creator-info
1600 (concat "Org version " org-version " with Emacs version "
1601 (number-to-string emacs-major-version))))
1602 (concat
1603 ;; begin postamble
1605 <div id=\"" (nth 2 org-e-html-divs) "\">"
1606 (cond
1607 ;; auto postamble
1608 ((eq (plist-get info :html-postamble) 'auto)
1609 (concat
1610 (when (plist-get info :time-stamp-file)
1611 (format "
1612 <p class=\"date\"> %s: %s </p> " (nth 2 lang-words) date))
1613 (when (and (plist-get info :with-author) author)
1614 (format "
1615 <p class=\"author\"> %s : %s</p>" (nth 1 lang-words) author))
1616 (when (and (plist-get info :with-email) email)
1617 (format "
1618 <p class=\"email\"> %s </p>" email))
1619 (when (plist-get info :with-creator)
1620 (format "
1621 <p class=\"creator\"> %s </p>" creator-info))
1622 html-validation-link "\n"))
1623 ;; postamble from a string
1624 ((stringp (plist-get info :html-postamble))
1625 (format-spec (plist-get info :html-postamble)
1626 `((?a . ,author) (?e . ,email)
1627 (?d . ,date) (?c . ,creator-info)
1628 (?v . ,html-validation-link))))
1630 ;; postamble from a function
1631 ((functionp (plist-get info :html-postamble))
1632 (with-temp-buffer
1633 (funcall (plist-get info :html-postamble))
1634 (buffer-string)))
1635 ;; default postamble
1637 (format-spec
1638 (or (cadr (assoc (nth 0 lang-words)
1639 org-e-html-postamble-format))
1640 (cadr (assoc "en" org-e-html-postamble-format)))
1641 `((?a . ,author) (?e . ,email)
1642 (?d . ,date) (?c . ,creator-info)
1643 (?v . ,html-validation-link)))))
1645 </div>")))
1646 ;; org-e-html-html-helper-timestamp
1649 (defun org-e-html-template (contents info)
1650 "Return complete document string after HTML conversion.
1651 CONTENTS is the transcoded contents string. RAW-DATA is the
1652 original parsed data. INFO is a plist holding export options."
1653 (concat
1654 (format
1655 (or (and (stringp org-e-html-xml-declaration)
1656 org-e-html-xml-declaration)
1657 (cdr (assoc (plist-get info :html-extension)
1658 org-e-html-xml-declaration))
1659 (cdr (assoc "html" org-e-html-xml-declaration))
1662 (or (and coding-system-for-write
1663 (fboundp 'coding-system-get)
1664 (coding-system-get coding-system-for-write
1665 'mime-charset))
1666 "iso-8859-1"))
1668 <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"
1669 \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">"
1670 (format "
1671 <html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"%s\" xml:lang=\"%s\"> "
1672 (plist-get info :language) (plist-get info :language))
1674 <head>"
1675 (org-e-html-meta-info info) ; meta
1676 (org-e-html-style info) ; style
1677 (org-e-html-mathjax-config info) ; mathjax
1679 </head>"
1682 <body>"
1683 (let ((link-up (and (plist-get info :link-up)
1684 (string-match "\\S-" (plist-get info :link-up))
1685 (plist-get info :link-up)))
1686 (link-home (and (plist-get info :link-home)
1687 (string-match "\\S-" (plist-get info :link-home))
1688 (plist-get info :link-home))))
1689 (when (or link-up link-home)
1690 (format org-e-html-home/up-format
1691 (or link-up link-home)
1692 (or link-home link-up))))
1693 ;; preamble
1694 (org-e-html-preamble info)
1695 ;; begin content
1696 (format "
1697 <div id=\"%s\">" (or org-e-html-content-div
1698 (nth 1 org-e-html-divs)))
1699 ;; document title
1700 (format "
1701 <h1 class=\"title\"> %s </h1>\n" (plist-get info :title))
1702 ;; table of contents
1703 (let ((depth (plist-get info :with-toc)))
1704 (when (wholenump depth) (org-e-html-toc depth info)))
1705 ;; document contents
1706 contents
1707 ;; footnotes section
1708 (org-e-html-footnote-section info)
1709 ;; bibliography
1710 (org-e-html-bibliography)
1711 ;; end content
1712 (unless body-only
1714 </div>")
1716 ;; postamble
1717 (org-e-html-postamble info)
1719 (unless body-only
1721 </body>")
1723 </html>"))
1727 ;;; Transcode Helpers
1729 ;;;; Todo
1731 (defun org-e-html--todo (todo)
1732 (when todo
1733 (format "<span class=\"%s %s%s\">%s</span>"
1734 (if (member todo org-done-keywords) "done" "todo")
1735 org-e-html-todo-kwd-class-prefix (org-e-html-fix-class-name todo)
1736 todo)))
1738 ;;;; Tags
1740 (defun org-e-html--tags (tags)
1741 (when tags
1742 (format "<span class=\"tag\">%s</span>"
1743 (mapconcat
1744 (lambda (tag)
1745 (format "<span class=\"%s\">%s</span>"
1746 (concat org-e-html-tag-class-prefix
1747 (org-e-html-fix-class-name tag))
1748 tag))
1749 (org-split-string tags ":") "&nbsp;"))))
1751 ;;;; Headline
1753 (defun* org-e-html-format-headline
1754 (todo todo-type priority text tags
1755 &key level section-number headline-label &allow-other-keys)
1756 (let ((section-number
1757 (when section-number
1758 (format "<span class=\"section-number-%d\">%s</span> "
1759 level section-number)))
1760 (todo (org-e-html--todo todo))
1761 (tags (org-e-html--tags tags)))
1762 (concat section-number todo (and todo " ") text
1763 (and tags "&nbsp;&nbsp;&nbsp;") tags)))
1765 ;;;; Src Code
1767 (defun org-e-html-fontify-code (code lang)
1768 (when code
1769 (cond
1770 ;; Case 1: No lang. Possibly an example block.
1771 ((not lang)
1772 ;; Simple transcoding.
1773 (org-e-html-encode-plain-text code))
1774 ;; Case 2: No htmlize or an inferior version of htmlize
1775 ((not (and (require 'htmlize nil t) (fboundp 'htmlize-region-for-paste)))
1776 ;; Emit a warning.
1777 (message "Cannot fontify src block (htmlize.el >= 1.34 required)")
1778 ;; Simple transcoding.
1779 (org-e-html-encode-plain-text code))
1781 ;; Map language
1782 (setq lang (or (assoc-default lang org-src-lang-modes) lang))
1783 (let* ((lang-mode (and lang (intern (format "%s-mode" lang)))))
1784 (cond
1785 ;; Case 1: Language is not associated with any Emacs mode
1786 ((not (functionp lang-mode))
1787 ;; Simple transcoding.
1788 (org-e-html-encode-plain-text code))
1789 ;; Case 2: Default. Fotify code.
1791 ;; htmlize
1792 (setq code (with-temp-buffer
1793 (insert code)
1794 (funcall lang-mode)
1795 (font-lock-fontify-buffer)
1796 ;; markup each line separately
1797 (org-remove-formatting-on-newlines-in-region
1798 (point-min) (point-max))
1799 (org-src-mode)
1800 (set-buffer-modified-p nil)
1801 (org-export-e-htmlize-region-for-paste
1802 (point-min) (point-max))))
1803 ;; Strip any encolosing <pre></pre> tags
1804 (if (string-match "<pre[^>]*>\n*\\([^\000]*\\)</pre>" code)
1805 (match-string 1 code)
1806 code))))))))
1808 (defun org-e-html-do-format-code
1809 (code &optional lang refs retain-labels num-start textarea-p)
1810 "Transcode a SRC-BLOCK element from Org to HTML.
1811 CONTENTS holds the contents of the item. INFO is a plist holding
1812 contextual information."
1813 (when textarea-p
1814 (setq num-start nil refs nil lang nil))
1815 (let* ((code-lines (org-split-string code "\n"))
1816 (code-length (length code-lines))
1817 (num-fmt
1818 (and num-start
1819 (format "%%%ds: "
1820 (length (number-to-string (+ code-length num-start))))))
1821 (code (org-e-html-fontify-code code lang)))
1822 (assert (= code-length (length (org-split-string code "\n"))))
1823 (org-export-format-code
1824 code
1825 (lambda (loc line-num ref)
1826 (setq loc
1827 (concat
1828 ;; Add line number, if needed.
1829 (when num-start
1830 (format "<span class=\"linenr\">%s</span>"
1831 (format num-fmt line-num)))
1832 ;; Transcoded src line.
1834 ;; Add label, if needed.
1835 (when (and ref retain-labels) (format " (%s)" ref))))
1836 ;; Mark transcoded line as an anchor, if needed.
1837 (if (not ref) loc
1838 (format "<span id=\"coderef-%s\" class=\"coderef-off\">%s</span>"
1839 ref loc)))
1840 num-start refs)))
1842 (defun org-e-html-format-code (element info)
1843 (let* ((lang (org-element-property :language element))
1844 (switches (org-element-property :switches element))
1845 (textarea-p (and switches (string-match "-t\\>" switches)))
1846 ;; Extract code and references.
1847 (code-info (org-export-unravel-code element))
1848 (code (car code-info))
1849 (refs (cdr code-info))
1850 ;; Does the src block contain labels?
1851 (retain-labels (org-element-property :retain-labels element))
1852 ;; Does it have line numbers?
1853 (num-start (case (org-element-property :number-lines element)
1854 (continued (org-export-get-loc element info))
1855 (new 0))))
1856 (org-e-html-do-format-code
1857 code lang refs retain-labels num-start textarea-p)))
1861 ;;; Transcode Functions
1863 ;;;; Block
1865 (defun org-e-html-center-block (center-block contents info)
1866 "Transcode a CENTER-BLOCK element from Org to HTML.
1867 CONTENTS holds the contents of the block. INFO is a plist
1868 holding contextual information."
1869 (org-e-html--wrap-label
1870 center-block
1871 (format "<div style=\"text-align: center\">\n%s</div>" contents)))
1874 ;;;; Comment
1876 ;; Comments are ignored.
1879 ;;;; Comment Block
1881 ;; Comment Blocks are ignored.
1884 ;;;; Drawer
1886 (defun org-e-html-drawer (drawer contents info)
1887 "Transcode a DRAWER element from Org to HTML.
1888 CONTENTS holds the contents of the block. INFO is a plist
1889 holding contextual information."
1890 (let* ((name (org-element-property :drawer-name drawer))
1891 (output (if (functionp org-e-html-format-drawer-function)
1892 (funcall org-e-html-format-drawer-function
1893 name contents)
1894 ;; If there's no user defined function: simply
1895 ;; display contents of the drawer.
1896 contents)))
1897 (org-e-html--wrap-label drawer output)))
1900 ;;;; Dynamic Block
1902 (defun org-e-html-dynamic-block (dynamic-block contents info)
1903 "Transcode a DYNAMIC-BLOCK element from Org to HTML.
1904 CONTENTS holds the contents of the block. INFO is a plist
1905 holding contextual information. See
1906 `org-export-data'."
1907 (org-e-html--wrap-label dynamic-block contents))
1910 ;;;; Emphasis
1912 (defun org-e-html-emphasis (emphasis contents info)
1913 "Transcode EMPHASIS from Org to HTML.
1914 CONTENTS is the contents of the emphasized text. INFO is a plist
1915 holding contextual information.."
1916 (let* ((marker (org-element-property :marker emphasis)))
1917 (format (cdr (assoc marker org-e-html-emphasis-alist)) contents)))
1920 ;;;; Entity
1922 (defun org-e-html-entity (entity contents info)
1923 "Transcode an ENTITY object from Org to HTML.
1924 CONTENTS are the definition itself. INFO is a plist holding
1925 contextual information."
1926 (org-element-property :html entity))
1929 ;;;; Example Block
1931 (defun org-e-html-example-block (example-block contents info)
1932 "Transcode a EXAMPLE-BLOCK element from Org to HTML.
1933 CONTENTS is nil. INFO is a plist holding contextual information."
1934 (let* ((options (or (org-element-property :options example-block) ""))
1935 (lang (org-element-property :language example-block))
1936 (caption (org-element-property :caption example-block))
1937 (label (org-element-property :name example-block))
1938 (caption-str (org-e-html--caption/label-string caption label info))
1939 (attr (mapconcat #'identity
1940 (org-element-property :attr_html example-block)
1941 " "))
1942 (switches (org-element-property :switches example-block))
1943 (textarea-p (and switches (string-match "-t\\>" switches)))
1944 (code (org-e-html-format-code example-block info)))
1945 (cond
1946 (textarea-p
1947 (let ((cols (if (not (string-match "-w[ \t]+\\([0-9]+\\)" switches))
1948 80 (string-to-number (match-string 1 switches))))
1949 (rows (if (string-match "-h[ \t]+\\([0-9]+\\)" switches)
1950 (string-to-number (match-string 1 switches))
1951 (org-count-lines code))))
1952 (format
1953 "\n<p>\n<textarea cols=\"%d\" rows=\"%d\">\n%s\n</textarea>\n</p>"
1954 cols rows code)))
1955 (t (format "\n<pre class=\"example\">\n%s\n</pre>" code)))))
1958 ;;;; Export Snippet
1960 (defun org-e-html-export-snippet (export-snippet contents info)
1961 "Transcode a EXPORT-SNIPPET object from Org to HTML.
1962 CONTENTS is nil. INFO is a plist holding contextual information."
1963 (when (eq (org-export-snippet-backend export-snippet) 'e-html)
1964 (org-element-property :value export-snippet)))
1967 ;;;; Export Block
1969 (defun org-e-html-export-block (export-block contents info)
1970 "Transcode a EXPORT-BLOCK element from Org to HTML.
1971 CONTENTS is nil. INFO is a plist holding contextual information."
1972 (when (string= (org-element-property :type export-block) "latex")
1973 (org-remove-indentation (org-element-property :value export-block))))
1976 ;;;; Fixed Width
1978 (defun org-e-html-fixed-width (fixed-width contents info)
1979 "Transcode a FIXED-WIDTH element from Org to HTML.
1980 CONTENTS is nil. INFO is a plist holding contextual information."
1981 (let* ((value (org-element-normalize-string
1982 (replace-regexp-in-string
1983 "^[ \t]*: ?" ""
1984 (org-element-property :value fixed-width)))))
1985 (org-e-html--wrap-label
1986 fixed-width (format "\n<pre class=\"example\">\n%s\n</pre>"
1987 (org-e-html-do-format-code value)))))
1990 ;;;; Footnote Definition
1992 ;; Footnote Definitions are ignored.
1995 ;;;; Footnote Reference
1997 (defun org-e-html-footnote-reference (footnote-reference contents info)
1998 "Transcode a FOOTNOTE-REFERENCE element from Org to HTML.
1999 CONTENTS is nil. INFO is a plist holding contextual information."
2000 (concat
2001 ;; Insert separator between two footnotes in a row.
2002 (let ((prev (org-export-get-previous-element footnote-reference info)))
2003 (when (eq (org-element-type prev) 'footnote-reference)
2004 org-e-html-footnote-separator))
2005 (cond
2006 ((not (org-export-footnote-first-reference-p footnote-reference info))
2007 (org-e-html-format-footnote-reference
2008 (org-export-get-footnote-number footnote-reference info)
2009 "IGNORED" 100))
2010 ;; Inline definitions are secondary strings.
2011 ((eq (org-element-property :type footnote-reference) 'inline)
2012 (org-e-html-format-footnote-reference
2013 (org-export-get-footnote-number footnote-reference info)
2014 "IGNORED" 1))
2015 ;; Non-inline footnotes definitions are full Org data.
2016 (t (org-e-html-format-footnote-reference
2017 (org-export-get-footnote-number footnote-reference info)
2018 "IGNORED" 1)))))
2021 ;;;; Headline
2023 (defun org-e-html-format-headline--wrap (headline info
2024 &optional format-function
2025 &rest extra-keys)
2026 "Transcode an HEADLINE element from Org to HTML.
2027 CONTENTS holds the contents of the headline. INFO is a plist
2028 holding contextual information."
2029 (let* ((level (+ (org-export-get-relative-level headline info)
2030 (1- org-e-html-toplevel-hlevel)))
2031 (headline-number (org-export-get-headline-number headline info))
2032 (section-number (and (org-export-numbered-headline-p headline info)
2033 (mapconcat 'number-to-string
2034 headline-number ".")))
2035 (todo (and (plist-get info :with-todo-keywords)
2036 (let ((todo (org-element-property
2037 :todo-keyword headline)))
2038 (and todo
2039 (org-export-secondary-string todo 'e-html info)))))
2040 (todo-type (and todo (org-element-property :todo-type headline)))
2041 (priority (and (plist-get info :with-priority)
2042 (org-element-property :priority headline)))
2043 (text (org-export-secondary-string
2044 (org-element-property :title headline) 'e-html info))
2045 (tags (and (plist-get info :with-tags)
2046 (org-element-property :tags headline)))
2047 (headline-label (concat "sec-" (mapconcat 'number-to-string
2048 headline-number "-")))
2049 (format-function (cond
2050 ((functionp format-function) format-function)
2051 ((functionp org-e-html-format-headline-function)
2052 (function*
2053 (lambda (todo todo-type priority text tags
2054 &allow-other-keys)
2055 (funcall org-e-html-format-headline-function
2056 todo todo-type priority text tags))))
2057 (t 'org-e-html-format-headline))))
2058 (apply format-function
2059 todo todo-type priority text tags
2060 :headline-label headline-label :level level
2061 :section-number section-number extra-keys)))
2063 (defun org-e-html-headline (headline contents info)
2064 "Transcode an HEADLINE element from Org to HTML.
2065 CONTENTS holds the contents of the headline. INFO is a plist
2066 holding contextual information."
2067 (let* ((numberedp (org-export-numbered-headline-p headline info))
2068 (level (org-export-get-relative-level headline info))
2069 (text (org-export-secondary-string
2070 (org-element-property :title headline) 'e-html info))
2071 (todo (and (plist-get info :with-todo-keywords)
2072 (let ((todo (org-element-property
2073 :todo-keyword headline)))
2074 (and todo
2075 (org-export-secondary-string todo 'e-html info)))))
2076 (todo-type (and todo (org-element-property :todo-type headline)))
2077 (tags (and (plist-get info :with-tags)
2078 (org-element-property :tags headline)))
2079 (priority (and (plist-get info :with-priority)
2080 (org-element-property :priority headline)))
2081 (section-number (and (org-export-numbered-headline-p headline info)
2082 (mapconcat 'number-to-string
2083 (org-export-get-headline-number
2084 headline info) ".")))
2085 ;; Create the headline text.
2086 (full-text (org-e-html-format-headline--wrap headline info)))
2087 (cond
2088 ;; Case 1: This is a footnote section: ignore it.
2089 ((org-element-property :footnote-section-p headline) nil)
2090 ;; Case 2. This is a deep sub-tree: export it as a list item.
2091 ;; Also export as items headlines for which no section
2092 ;; format has been found.
2093 ((org-export-low-level-p headline info) ; FIXME (or (not section-fmt))
2094 ;; Build the real contents of the sub-tree.
2095 (let* ((type (if numberedp 'unordered 'unordered)) ; FIXME
2096 (itemized-body (org-e-html-format-list-item
2097 contents type nil nil full-text)))
2098 (concat
2099 (and (org-export-first-sibling-p headline info)
2100 (org-e-html-begin-plain-list type))
2101 itemized-body
2102 (and (org-export-last-sibling-p headline info)
2103 (org-e-html-end-plain-list type)))))
2104 ;; Case 3. Standard headline. Export it as a section.
2106 (let* ((extra-class (org-element-property :html-container-class headline))
2107 (extra-ids (list (org-element-property :custom-id headline)
2108 (org-element-property :id headline)))
2109 (extra-ids
2110 (mapconcat
2111 (lambda (x)
2112 (when x
2113 (let ((id (org-solidify-link-text
2114 (if (org-uuidgen-p x) (concat "ID-" x) x))))
2115 (format "<a id=\"%s\" name=\"%s\"/>" id id))))
2116 extra-ids ""))
2117 (level1 (+ level (1- org-e-html-toplevel-hlevel)))
2118 (id (mapconcat 'number-to-string
2119 (org-export-get-headline-number headline info) "-")))
2120 (format "<div id=\"%s\" class=\"%s\">%s%s</div>\n"
2121 (format "outline-container-%s" id)
2122 (concat (format "outline-%d" level1) (and extra-class " ")
2123 extra-class)
2124 (format "\n<h%d id=\"sec-%s\">%s%s</h%d>\n"
2125 level1 id extra-ids full-text level1)
2126 contents))))))
2129 ;;;; Horizontal Rule
2131 (defun org-e-html-horizontal-rule (horizontal-rule contents info)
2132 "Transcode an HORIZONTAL-RULE object from Org to HTML.
2133 CONTENTS is nil. INFO is a plist holding contextual information."
2134 (let ((attr (mapconcat #'identity
2135 (org-element-property :attr_html horizontal-rule)
2136 " ")))
2137 (org-e-html--wrap-label horizontal-rule "<hr/>\n")))
2140 ;;;; Inline Babel Call
2142 ;; Inline Babel Calls are ignored.
2145 ;;;; Inline Src Block
2147 (defun org-e-html-inline-src-block (inline-src-block contents info)
2148 "Transcode an INLINE-SRC-BLOCK element from Org to HTML.
2149 CONTENTS holds the contents of the item. INFO is a plist holding
2150 contextual information."
2151 (let* ((org-lang (org-element-property :language inline-src-block))
2152 (code (org-element-property :value inline-src-block))
2153 (separator (org-e-html--find-verb-separator code)))
2154 (error "FIXME")))
2157 ;;;; Inlinetask
2159 (defun org-e-html-format-section (text class &optional id)
2160 (let ((extra (concat (when id (format " id=\"%s\"" id)))))
2161 (concat (format "<div class=\"%s\"%s>\n" class extra) text "</div>\n")))
2163 (defun org-e-html-inlinetask (inlinetask contents info)
2164 "Transcode an INLINETASK element from Org to HTML.
2165 CONTENTS holds the contents of the block. INFO is a plist
2166 holding contextual information."
2167 (cond
2168 ;; If `org-e-html-format-inlinetask-function' is provided, call it
2169 ;; with appropriate arguments.
2170 ((functionp org-e-html-format-inlinetask-function)
2171 (let ((format-function
2172 (function*
2173 (lambda (todo todo-type priority text tags
2174 &key contents &allow-other-keys)
2175 (funcall org-e-html-format-inlinetask-function
2176 todo todo-type priority text tags contents)))))
2177 (org-e-html-format-headline--wrap
2178 inlinetask info format-function :contents contents)))
2179 ;; Otherwise, use a default template.
2180 (t (org-e-html--wrap-label
2181 inlinetask
2182 (format
2183 "\n<div class=\"inlinetask\">\n<b>%s</b><br/>\n%s\n</div>"
2184 (org-e-html-format-headline--wrap inlinetask info)
2185 contents)))))
2188 ;;;; Item
2190 (defun org-e-html-checkbox (checkbox)
2191 (case checkbox (on "<code>[X]</code>")
2192 (off "<code>[&nbsp;]</code>")
2193 (trans "<code>[-]</code>")
2194 (t "")))
2196 (defun org-e-html-format-list-item (contents type checkbox
2197 &optional term-counter-id
2198 headline)
2199 (concat
2200 (case type
2201 (ordered
2202 (let* ((counter term-counter-id)
2203 (extra (if counter (format " value=\"%s\"" counter) "")))
2204 (format "<li%s>" extra)))
2205 (unordered
2206 (let* ((id term-counter-id)
2207 (extra (if id (format " id=\"%s\"" id) "")))
2208 (concat
2209 (format "<li%s>" extra)
2210 (when headline (concat headline "<br/>")))))
2211 (descriptive
2212 (let* ((term term-counter-id))
2213 (setq term (or term "(no term)"))
2214 (concat (format "<dt> %s </dt>" term) "<dd>"))))
2215 (org-e-html-checkbox checkbox) (and checkbox " ")
2216 contents
2217 (case type
2218 (ordered "</li>")
2219 (unordered "</li>")
2220 (descriptive "</dd>"))))
2222 (defun org-e-html-item (item contents info)
2223 "Transcode an ITEM element from Org to HTML.
2224 CONTENTS holds the contents of the item. INFO is a plist holding
2225 contextual information."
2226 ;; Grab `:level' from plain-list properties, which is always the
2227 ;; first element above current item.
2228 (let* ((plain-list (org-export-get-parent item info))
2229 (type (org-element-property :type plain-list))
2230 (level (org-element-property :level plain-list))
2231 (counter (org-element-property :counter item))
2232 (checkbox (org-element-property :checkbox item))
2233 (tag (let ((tag (org-element-property :tag item)))
2234 (and tag (org-export-secondary-string tag 'e-html info)))))
2235 (org-e-html-format-list-item
2236 contents type checkbox (or tag counter))))
2239 ;;;; Keyword
2241 (defun org-e-html-keyword (keyword contents info)
2242 "Transcode a KEYWORD element from Org to HTML.
2243 CONTENTS is nil. INFO is a plist holding contextual information."
2244 (let ((key (downcase (org-element-property :key keyword)))
2245 (value (org-element-property :value keyword)))
2246 (cond
2247 ((string= key "latex") value)
2248 ((string= key "index") (format "\\index{%s}" value))
2249 ;; Invisible targets.
2250 ((string= key "target") nil) ; FIXME
2251 ((string= key "toc")
2252 (let ((value (downcase value)))
2253 (cond
2254 ((string-match "\\<headlines\\>" value)
2255 (let ((depth (or (and (string-match "[0-9]+" value)
2256 (string-to-number (match-string 0 value)))
2257 (plist-get info :with-toc))))
2258 (when (wholenump depth) (org-e-html-toc depth info))))
2259 ((string= "tables" value) "\\listoftables")
2260 ((string= "figures" value) "\\listoffigures")
2261 ((string= "listings" value)
2262 (cond
2263 ;; At the moment, src blocks with a caption are wrapped
2264 ;; into a figure environment.
2265 (t "\\listoffigures")))))))))
2268 ;;;; Latex Environment
2270 (defun org-e-html-format-latex (latex-frag processing-type)
2271 (let* ((cache-relpath
2272 (concat "ltxpng/" (file-name-sans-extension
2273 (file-name-nondirectory (buffer-file-name)))))
2274 (cache-dir (file-name-directory (buffer-file-name )))
2275 (display-msg "Creating LaTeX Image..."))
2277 (with-temp-buffer
2278 (insert latex-frag)
2279 (org-format-latex cache-relpath cache-dir nil display-msg
2280 nil nil processing-type)
2281 (buffer-string))))
2283 (defun org-e-html-latex-environment (latex-environment contents info)
2284 "Transcode a LATEX-ENVIRONMENT element from Org to HTML.
2285 CONTENTS is nil. INFO is a plist holding contextual information."
2286 (org-e-html--wrap-label
2287 latex-environment
2288 (let ((processing-type (plist-get info :LaTeX-fragments))
2289 (latex-frag (org-remove-indentation
2290 (org-element-property :value latex-environment)))
2291 (caption (org-e-html--caption/label-string
2292 (org-element-property :caption latex-environment)
2293 (org-element-property :name latex-environment)
2294 info))
2295 (attr nil) ; FIXME
2296 (label (org-element-property :name latex-environment)))
2297 (cond
2298 ((member processing-type '(t mathjax))
2299 (org-e-html-format-latex latex-frag 'mathjax))
2300 ((equal processing-type 'dvipng)
2301 (let* ((formula-link (org-e-html-format-latex
2302 latex-frag processing-type)))
2303 (when (and formula-link
2304 (string-match "file:\\([^]]*\\)" formula-link))
2305 (org-e-html-format-inline-image
2306 (match-string 1 formula-link) caption label attr t))))
2307 (t latex-frag)))))
2310 ;;;; Latex Fragment
2312 (defun org-e-html-latex-fragment (latex-fragment contents info)
2313 "Transcode a LATEX-FRAGMENT object from Org to HTML.
2314 CONTENTS is nil. INFO is a plist holding contextual information."
2315 (let ((latex-frag (org-element-property :value latex-fragment))
2316 (processing-type (plist-get info :LaTeX-fragments)))
2317 (case processing-type
2318 ((t mathjax)
2319 (org-e-html-format-latex latex-frag 'mathjax))
2320 (dvipng
2321 (let* ((formula-link (org-e-html-format-latex
2322 latex-frag processing-type)))
2323 (when (and formula-link
2324 (string-match "file:\\([^]]*\\)" formula-link))
2325 (org-e-html-format-inline-image
2326 (match-string 1 formula-link)))))
2327 (t latex-frag))))
2329 ;;;; Line Break
2331 (defun org-e-html-line-break (line-break contents info)
2332 "Transcode a LINE-BREAK object from Org to HTML.
2333 CONTENTS is nil. INFO is a plist holding contextual information."
2334 "<br/>")
2337 ;;;; Link
2339 (defun org-e-html-link--inline-image (link desc info)
2340 "Return HTML code for an inline image.
2341 LINK is the link pointing to the inline image. INFO is a plist
2342 used as a communication channel."
2343 (let* ((type (org-element-property :type link))
2344 (raw-path (org-element-property :path link))
2345 (path (cond ((member type '("http" "https"))
2346 (concat type ":" raw-path))
2347 ((file-name-absolute-p raw-path)
2348 (expand-file-name raw-path))
2349 (t raw-path)))
2350 (parent (org-export-get-parent-paragraph link info))
2351 (caption (org-e-html--caption/label-string
2352 (org-element-property :caption parent)
2353 (org-element-property :name parent)
2354 info))
2355 (label (org-element-property :name parent))
2356 ;; Retrieve latex attributes from the element around.
2357 (attr (let ((raw-attr
2358 (mapconcat #'identity
2359 (org-element-property :attr_html parent)
2360 " ")))
2361 (unless (string= raw-attr "") raw-attr))))
2362 ;; Now clear ATTR from any special keyword and set a default
2363 ;; value if nothing is left.
2364 (setq attr (if (not attr) "" (org-trim attr)))
2365 ;; Return proper string, depending on DISPOSITION.
2366 (org-e-html-format-inline-image
2367 path caption label attr (org-e-html-standalone-image-p link info))))
2369 (defvar org-e-html-standalone-image-predicate)
2370 (defun org-e-html-standalone-image-p (element info &optional predicate)
2371 "Test if ELEMENT is a standalone image for the purpose HTML export.
2372 INFO is a plist holding contextual information.
2374 Return non-nil, if ELEMENT is of type paragraph and it's sole
2375 content, save for whitespaces, is a link that qualifies as an
2376 inline image.
2378 Return non-nil, if ELEMENT is of type link and it's containing
2379 paragraph has no other content save for leading and trailing
2380 whitespaces.
2382 Return nil, otherwise.
2384 Bind `org-e-html-standalone-image-predicate' to constrain
2385 paragraph further. For example, to check for only captioned
2386 standalone images, do the following.
2388 \(setq org-e-html-standalone-image-predicate
2389 \(lambda \(paragraph\)
2390 \(org-element-property :caption paragraph\)\)\)
2392 (let ((paragraph (case (org-element-type element)
2393 (paragraph element)
2394 (link (and (org-export-inline-image-p
2395 element org-e-html-inline-image-rules)
2396 (org-export-get-parent element info)))
2397 (t nil))))
2398 (when paragraph
2399 (assert (eq (org-element-type paragraph) 'paragraph))
2400 (when (or (not (and (boundp 'org-e-html-standalone-image-predicate)
2401 (functionp org-e-html-standalone-image-predicate)))
2402 (funcall org-e-html-standalone-image-predicate paragraph))
2403 (let ((contents (org-element-contents paragraph)))
2404 (loop for x in contents
2405 with inline-image-count = 0
2406 always (cond
2407 ((eq (org-element-type x) 'plain-text)
2408 (not (org-string-nw-p x)))
2409 ((eq (org-element-type x) 'link)
2410 (when (org-export-inline-image-p
2411 x org-e-html-inline-image-rules)
2412 (= (incf inline-image-count) 1)))
2413 (t nil))))))))
2415 (defun org-e-html-link (link desc info)
2416 "Transcode a LINK object from Org to HTML.
2418 DESC is the description part of the link, or the empty string.
2419 INFO is a plist holding contextual information. See
2420 `org-export-data'."
2421 (let* ((type (org-element-property :type link))
2422 (raw-path (org-element-property :path link))
2423 ;; Ensure DESC really exists, or set it to nil.
2424 (desc (and (not (string= desc "")) desc))
2425 (path (cond
2426 ((member type '("http" "https" "ftp" "mailto"))
2427 (concat type ":" raw-path))
2428 ((string= type "file")
2429 (when (string-match "\\(.+\\)::.+" raw-path)
2430 (setq raw-path (match-string 1 raw-path)))
2431 (if (file-name-absolute-p raw-path)
2432 (concat "file://" (expand-file-name raw-path))
2433 ;; TODO: Not implemented yet. Concat also:
2434 ;; (org-export-directory :HTML info)
2435 (concat "file://" raw-path)))
2436 (t raw-path)))
2437 protocol)
2438 (cond
2439 ;; Image file.
2440 ((and (or (eq t org-e-html-inline-images)
2441 (and org-e-html-inline-images (not desc)))
2442 (org-export-inline-image-p link org-e-html-inline-image-rules))
2443 (org-e-html-link--inline-image link desc info))
2444 ;; Radioed target: Target's name is obtained from original raw
2445 ;; link. Path is parsed and transcoded in order to have a proper
2446 ;; display of the contents.
2447 ((string= type "radio")
2448 (format "<a href=\"#%s\">%s</a>"
2449 (org-export-solidify-link-text path)
2450 (org-export-secondary-string
2451 (org-element-parse-secondary-string
2452 path (cdr (assq 'radio-target org-element-object-restrictions)))
2453 'e-html info)))
2454 ;; Links pointing to an headline: Find destination and build
2455 ;; appropriate referencing command.
2456 ((member type '("custom-id" "fuzzy" "id"))
2457 (let ((destination (if (string= type "fuzzy")
2458 (org-export-resolve-fuzzy-link link info)
2459 (org-export-resolve-id-link link info))))
2460 (case (org-element-type destination)
2461 ;; Fuzzy link points nowhere.
2462 ('nil
2463 (format "<i>%s</i>"
2464 (or desc (org-export-secondary-string
2465 (org-element-property :raw-link link)
2466 'e-html info))))
2467 ;; Fuzzy link points to an invisible target.
2468 (keyword nil)
2469 ;; LINK points to an headline. If headlines are numbered
2470 ;; and the link has no description, display headline's
2471 ;; number. Otherwise, display description or headline's
2472 ;; title.
2473 (headline
2474 (let* ((headline-no (org-export-get-headline-number destination info))
2475 (label (format "sec-%s" (mapconcat 'number-to-string
2476 headline-no "-")))
2477 (section-no (mapconcat 'number-to-string headline-no ".")))
2478 (setq desc
2479 (cond
2480 (desc desc)
2481 ((plist-get info :section-numbers) section-no)
2482 (t (org-export-secondary-string
2483 (org-element-property :title destination)
2484 'e-html info))))
2485 (format "<a href=\"#%s\">%s</a>" label desc)))
2486 ;; Fuzzy link points to a target. Do as above.
2487 (otherwise
2488 (let ((path (org-export-solidify-link-text path)) number)
2489 (unless desc
2490 (setq number (cond
2491 ((org-e-html-standalone-image-p destination info)
2492 (org-export-get-ordinal
2493 (assoc 'link (org-element-contents destination))
2494 info 'link 'org-e-html-standalone-image-p))
2495 (t (org-export-get-ordinal destination info))))
2496 (setq desc (when number
2497 (if (atom number) (number-to-string number)
2498 (mapconcat 'number-to-string number ".")))))
2499 (format "<a href=\"#%s\">%s</a>" path (or desc "FIXME")))))))
2500 ;; Coderef: replace link with the reference name or the
2501 ;; equivalent line number.
2502 ((string= type "coderef")
2503 (let ((fragment (concat "coderef-" path)))
2504 (format "<a href=\"#%s\" %s>%s</a>" fragment
2505 (format (concat "class=\"coderef\""
2506 " onmouseover=\"CodeHighlightOn(this, '%s');\""
2507 " onmouseout=\"CodeHighlightOff(this, '%s');\"")
2508 fragment fragment)
2509 (format (org-export-get-coderef-format path (or desc "%s"))
2510 (org-export-resolve-coderef path info)))))
2511 ;; Link type is handled by a special function.
2512 ((functionp (setq protocol (nth 2 (assoc type org-link-protocols))))
2513 (funcall protocol (org-link-unescape path) desc 'html))
2514 ;; External link with a description part.
2515 ((and path desc) (format "<a href=\"%s\">%s</a>" path desc))
2516 ;; External link without a description part.
2517 (path (format "<a href=\"%s\">%s</a>" path path))
2518 ;; No path, only description. Try to do something useful.
2519 (t (format "<i>%s</i>" desc)))))
2522 ;;;; Babel Call
2524 ;; Babel Calls are ignored.
2527 ;;;; Macro
2529 (defun org-e-html-macro (macro contents info)
2530 "Transcode a MACRO element from Org to HTML.
2531 CONTENTS is nil. INFO is a plist holding contextual information."
2532 ;; Use available tools.
2533 (org-export-expand-macro macro info))
2536 ;;;; Paragraph
2538 (defun org-e-html-paragraph (paragraph contents info)
2539 "Transcode a PARAGRAPH element from Org to HTML.
2540 CONTENTS is the contents of the paragraph, as a string. INFO is
2541 the plist used as a communication channel."
2542 (let* ((style nil) ; FIXME
2543 (class (cdr (assoc style '((footnote . "footnote")
2544 (verse . nil)))))
2545 (extra (if class (format " class=\"%s\"" class) ""))
2546 (parent (org-export-get-parent paragraph info)))
2547 (cond
2548 ((and (equal (car parent) 'item)
2549 (= (org-element-property :begin paragraph)
2550 (org-element-property :contents-begin parent)))
2551 ;; leading paragraph in a list item have no tags
2552 contents)
2553 ((org-e-html-standalone-image-p paragraph info)
2554 ;; standalone image
2555 contents)
2556 (t (format "\n<p%s>\n%s\n</p>" extra contents)))))
2559 ;;;; Plain List
2561 (defun org-e-html-begin-plain-list (type &optional arg1)
2562 (case type
2563 (ordered
2564 (format "<ol%s>" (if arg1 ; FIXME
2565 (format " start=\"%d\"" arg1)
2566 "")))
2567 (unordered "<ul>")
2568 (descriptive "<dl>")))
2570 (defun org-e-html-end-plain-list (type)
2571 (case type
2572 (ordered "</ol>")
2573 (unordered "</ul>")
2574 (descriptive "</dl>")))
2576 (defun org-e-html-plain-list (plain-list contents info)
2577 "Transcode a PLAIN-LIST element from Org to HTML.
2578 CONTENTS is the contents of the list. INFO is a plist holding
2579 contextual information."
2580 (let* (arg1 ;; FIXME
2581 (type (org-element-property :type plain-list))
2582 (attr (mapconcat #'identity
2583 (org-element-property :attr_html plain-list)
2584 " ")))
2585 (org-e-html--wrap-label
2586 plain-list (format "%s\n%s%s"
2587 (org-e-html-begin-plain-list type)
2588 contents (org-e-html-end-plain-list type)))))
2590 ;;;; Plain Text
2592 (defun org-e-html-convert-special-strings (string)
2593 "Convert special characters in STRING to HTML."
2594 (let ((all org-e-html-special-string-regexps)
2595 e a re rpl start)
2596 (while (setq a (pop all))
2597 (setq re (car a) rpl (cdr a) start 0)
2598 (while (string-match re string start)
2599 (setq string (replace-match rpl t nil string))))
2600 string))
2602 (defun org-e-html-encode-plain-text (s)
2603 "Convert plain text characters to HTML equivalent.
2604 Possible conversions are set in `org-export-html-protect-char-alist'."
2605 (let ((cl org-e-html-protect-char-alist) c)
2606 (while (setq c (pop cl))
2607 (let ((start 0))
2608 (while (string-match (car c) s start)
2609 (setq s (replace-match (cdr c) t t s)
2610 start (1+ (match-beginning 0))))))
2613 (defun org-e-html-plain-text (text info)
2614 "Transcode a TEXT string from Org to HTML.
2615 TEXT is the string to transcode. INFO is a plist holding
2616 contextual information."
2617 (setq text (org-e-html-encode-plain-text text))
2618 ;; Protect %, #, &, $, ~, ^, _, { and }.
2619 ;; (while (string-match "\\([^\\]\\|^\\)\\([%$#&{}~^_]\\)" text)
2620 ;; (setq text
2621 ;; (replace-match (format "\\%s" (match-string 2 text)) nil t text 2)))
2622 ;; Protect \
2623 ;; (setq text (replace-regexp-in-string
2624 ;; "\\(?:[^\\]\\|^\\)\\(\\\\\\)\\(?:[^%$#&{}~^_\\]\\|$\\)"
2625 ;; "$\\backslash$" text nil t 1))
2626 ;; HTML into \HTML{} and TeX into \TeX{}.
2627 ;; (let ((case-fold-search nil)
2628 ;; (start 0))
2629 ;; (while (string-match "\\<\\(\\(?:La\\)?TeX\\)\\>" text start)
2630 ;; (setq text (replace-match
2631 ;; (format "\\%s{}" (match-string 1 text)) nil t text)
2632 ;; start (match-end 0))))
2633 ;; Handle quotation marks
2634 ;; (setq text (org-e-html--quotation-marks text info))
2635 ;; Convert special strings.
2636 ;; (when (plist-get info :with-special-strings)
2637 ;; (while (string-match (regexp-quote "...") text)
2638 ;; (setq text (replace-match "\\ldots{}" nil t text))))
2639 (when (plist-get info :with-special-strings)
2640 (setq text (org-e-html-convert-special-strings text)))
2641 ;; Handle break preservation if required.
2642 (when (plist-get info :preserve-breaks)
2643 (setq text (replace-regexp-in-string "\\(\\\\\\\\\\)?[ \t]*\n" " \\\\\\\\\n"
2644 text)))
2645 ;; Return value.
2646 text)
2649 ;;;; Property Drawer
2651 (defun org-e-html-property-drawer (property-drawer contents info)
2652 "Transcode a PROPERTY-DRAWER element from Org to HTML.
2653 CONTENTS is nil. INFO is a plist holding contextual
2654 information."
2655 ;; The property drawer isn't exported but we want separating blank
2656 ;; lines nonetheless.
2660 ;;;; Quote Block
2662 (defun org-e-html-quote-block (quote-block contents info)
2663 "Transcode a QUOTE-BLOCK element from Org to HTML.
2664 CONTENTS holds the contents of the block. INFO is a plist
2665 holding contextual information."
2666 (org-e-html--wrap-label
2667 quote-block (format "<blockquote>\n%s</blockquote>" contents)))
2670 ;;;; Quote Section
2672 (defun org-e-html-quote-section (quote-section contents info)
2673 "Transcode a QUOTE-SECTION element from Org to HTML.
2674 CONTENTS is nil. INFO is a plist holding contextual information."
2675 (let ((value (org-remove-indentation
2676 (org-element-property :value quote-section))))
2677 (when value (format "<pre>\n%s</pre>" value))))
2680 ;;;; Section
2682 (defun org-e-html-section (section contents info) ; FIXME
2683 "Transcode a SECTION element from Org to HTML.
2684 CONTENTS holds the contents of the section. INFO is a plist
2685 holding contextual information."
2686 (let ((parent (org-export-get-parent-headline section info)))
2687 ;; Before first headline: no container, just return CONTENTS.
2688 (if (not parent) contents
2689 ;; Get div's class and id references.
2690 (let ((class-num (+ (org-export-get-relative-level parent info)
2691 (1- org-e-html-toplevel-hlevel)))
2692 (id-num
2693 (mapconcat
2694 'number-to-string
2695 (org-export-get-headline-number parent info) "-")))
2696 ;; Build return value.
2697 (format "<div class=\"outline-text-%d\" id=\"text-%s\">\n%s</div>"
2698 class-num id-num contents)))))
2700 ;;;; Radio Target
2702 (defun org-e-html-radio-target (radio-target text info)
2703 "Transcode a RADIO-TARGET object from Org to HTML.
2704 TEXT is the text of the target. INFO is a plist holding
2705 contextual information."
2706 (let ((id (org-export-solidify-link-text
2707 (org-element-property :raw-value radio-target))))
2708 (format "<a id=\"%s\" name=\"%s\">%s</a>" id id text)))
2711 ;;;; Special Block
2713 (defun org-e-html-special-block (special-block contents info)
2714 "Transcode a SPECIAL-BLOCK element from Org to HTML.
2715 CONTENTS holds the contents of the block. INFO is a plist
2716 holding contextual information."
2717 (let ((type (downcase (org-element-property :type special-block))))
2718 (org-e-html--wrap-label
2719 special-block
2720 (format "\\begin{%s}\n%s\\end{%s}" type contents type))))
2723 ;;;; Src Block
2725 (defun org-e-html-src-block (src-block contents info)
2726 "Transcode a SRC-BLOCK element from Org to HTML.
2727 CONTENTS holds the contents of the item. INFO is a plist holding
2728 contextual information."
2729 (let* ((lang (org-element-property :language src-block))
2730 (caption (org-element-property :caption src-block))
2731 (label (org-element-property :name src-block))
2732 (caption-str (org-e-html--caption/label-string caption label info))
2733 (attr (mapconcat #'identity
2734 (org-element-property :attr_html src-block)
2735 " "))
2736 (switches (org-element-property :switches src-block))
2737 (textarea-p (and switches (string-match "-t\\>" switches)))
2738 (code (org-e-html-format-code src-block info)))
2739 (cond
2740 (lang (format
2741 "\n<div class=\"org-src-container\">\n%s%s\n</div>"
2742 (if (not caption) ""
2743 (format "<label class=\"org-src-name\">%s</label>" caption-str))
2744 (format "\n<pre class=\"src src-%s\">%s\n</pre>" lang code)))
2745 (textarea-p
2746 (let ((cols (if (not (string-match "-w[ \t]+\\([0-9]+\\)" switches))
2747 80 (string-to-number (match-string 1 switches))))
2748 (rows (if (string-match "-h[ \t]+\\([0-9]+\\)" switches)
2749 (string-to-number (match-string 1 switches))
2750 (org-count-lines code))))
2751 (format
2752 "\n<p>\n<textarea cols=\"%d\" rows=\"%d\">\n%s\n</textarea>\n</p>"
2753 cols rows code)))
2754 (t (format "\n<pre class=\"example\">\n%s\n</pre>" code)))))
2756 ;;;; Statistics Cookie
2758 (defun org-e-html-statistics-cookie (statistics-cookie contents info)
2759 "Transcode a STATISTICS-COOKIE object from Org to HTML.
2760 CONTENTS is nil. INFO is a plist holding contextual information."
2761 (let ((cookie-value (org-element-property :value statistics-cookie)))
2762 (format "<code>%s</code>" cookie-value)))
2765 ;;;; Subscript
2767 (defun org-e-html-subscript (subscript contents info)
2768 "Transcode a SUBSCRIPT object from Org to HTML.
2769 CONTENTS is the contents of the object. INFO is a plist holding
2770 contextual information."
2771 (format "<sub>%s</sub>" contents))
2774 ;;;; Superscript
2776 (defun org-e-html-superscript (superscript contents info)
2777 "Transcode a SUPERSCRIPT object from Org to HTML.
2778 CONTENTS is the contents of the object. INFO is a plist holding
2779 contextual information."
2780 (format "<sup>%s</sup>" contents))
2783 ;;;; Table
2785 (defun org-e-html-begin-table (caption label attributes)
2786 (let* ((html-table-tag (or (plist-get info :html-table-tag) ; FIXME
2787 org-e-html-table-tag))
2788 (html-table-tag
2789 (org-e-html-splice-attributes html-table-tag attributes)))
2790 (when label
2791 (setq html-table-tag
2792 (org-e-html-splice-attributes
2793 html-table-tag
2794 (format "id=\"%s\"" (org-solidify-link-text label)))))
2795 (concat "\n" html-table-tag
2796 (format "\n<caption>%s</caption>" (or caption "")))))
2798 (defun org-e-html-end-table ()
2799 "</table>\n")
2801 (defun org-e-html-format-table-cell (text r c horiz-span)
2802 (let ((cell-style-cookie
2803 (if org-e-html-table-align-individual-fields
2804 (format (if (and (boundp 'org-e-html-format-table-no-css)
2805 org-e-html-format-table-no-css)
2806 " align=\"%s\"" " class=\"%s\"")
2807 (or (aref (plist-get table-info :alignment) c) "left")) ""))) ;; FIXME
2808 (cond
2809 (org-e-html-table-cur-rowgrp-is-hdr
2810 (concat
2811 (format (car org-e-html-table-header-tags) "col" cell-style-cookie)
2812 text (cdr org-e-html-table-header-tags)))
2813 ((and (= c 0) org-e-html-table-use-header-tags-for-first-column)
2814 (concat
2815 (format (car org-e-html-table-header-tags) "row" cell-style-cookie)
2816 text (cdr org-e-html-table-header-tags)))
2818 (concat
2819 (format (car org-e-html-table-data-tags) cell-style-cookie)
2820 text (cdr org-e-html-table-data-tags))))))
2822 (defun org-e-html-format-table-row (row)
2823 (concat (eval (car org-e-html-table-row-tags)) row
2824 (eval (cdr org-e-html-table-row-tags))))
2826 (defun org-e-html-table-row (fields &optional text-for-empty-fields)
2827 (incf org-e-html-table-rownum)
2828 (let ((i -1))
2829 (org-e-html-format-table-row
2830 (mapconcat
2831 (lambda (x)
2832 (when (and (string= x "") text-for-empty-fields)
2833 (setq x text-for-empty-fields))
2834 (incf i)
2835 (let (horiz-span)
2836 (org-e-html-format-table-cell
2837 x org-e-html-table-rownum i (or horiz-span 0))))
2838 fields "\n"))))
2840 (defun org-e-html-end-table-rowgroup ()
2841 (when org-e-html-table-rowgrp-open
2842 (setq org-e-html-table-rowgrp-open nil)
2843 (if org-e-html-table-cur-rowgrp-is-hdr "</thead>" "</tbody>")))
2845 (defun org-e-html-begin-table-rowgroup (&optional is-header-row)
2846 (concat
2847 (when org-e-html-table-rowgrp-open
2848 (org-e-html-end-table-rowgroup))
2849 (progn
2850 (setq org-e-html-table-rowgrp-open t)
2851 (setq org-e-html-table-cur-rowgrp-is-hdr is-header-row)
2852 (if is-header-row "<thead>" "<tbody>"))))
2854 (defun org-e-html-table-preamble ()
2855 (let ((colgroup-vector (plist-get table-info :column-groups)) ;; FIXME
2856 c gr colgropen preamble)
2857 (unless (aref colgroup-vector 0)
2858 (setf (aref colgroup-vector 0) 'start))
2859 (dotimes (c columns-number preamble)
2860 (setq gr (aref colgroup-vector c))
2861 (setq preamble
2862 (concat
2863 preamble
2864 (when (memq gr '(start start-end))
2865 (prog1 (if colgropen "</colgroup>\n<colgroup>" "\n<colgroup>")
2866 (setq colgropen t)))
2867 (let* ((colalign-vector (plist-get table-info :alignment)) ;; FIXME
2868 (align (cdr (assoc (aref colalign-vector c)
2869 '(("l" . "left")
2870 ("r" . "right")
2871 ("c" . "center")))))
2872 (alignspec (if (and (boundp 'org-e-html-format-table-no-css)
2873 org-e-html-format-table-no-css)
2874 " align=\"%s\"" " class=\"%s\""))
2875 (extra (format alignspec align)))
2876 (format "<col%s />" extra))
2877 (when (memq gr '(end start-end))
2878 (setq colgropen nil)
2879 "</colgroup>"))))
2880 (concat preamble (if colgropen "</colgroup>"))))
2882 (defun org-e-html-list-table (lines caption label attributes)
2883 (setq lines (org-e-html-org-table-to-list-table lines))
2884 (let* ((splice nil) head
2885 (org-e-html-table-rownum -1)
2886 i (cnt 0)
2887 fields line
2888 org-e-html-table-cur-rowgrp-is-hdr
2889 org-e-html-table-rowgrp-open
2891 (org-lparse-table-style 'org-table)
2892 org-lparse-table-is-styled)
2893 (cond
2894 (splice
2895 (setq org-lparse-table-is-styled nil)
2896 (mapconcat 'org-e-html-table-row lines "\n"))
2898 (setq org-lparse-table-is-styled t)
2900 (concat
2901 (org-e-html-begin-table caption label attributes)
2902 (org-e-html-table-preamble)
2903 (org-e-html-begin-table-rowgroup head)
2905 (mapconcat
2906 (lambda (line)
2907 (cond
2908 ((equal line 'hline) (org-e-html-begin-table-rowgroup))
2909 (t (org-e-html-table-row line))))
2910 lines "\n")
2912 (org-e-html-end-table-rowgroup)
2913 (org-e-html-end-table))))))
2915 (defun org-e-html-transcode-table-row (row)
2916 (if (string-match org-table-hline-regexp row) 'hline
2917 (mapcar
2918 (lambda (cell)
2919 (org-export-secondary-string
2920 (let ((cell (org-element-parse-secondary-string
2921 cell
2922 (cdr (assq 'table org-element-string-restrictions)))))
2923 cell)
2924 'e-html info))
2925 (org-split-string row "[ \t]*|[ \t]*"))))
2927 (defun org-e-html-org-table-to-list-table (lines &optional splice)
2928 "Convert org-table to list-table.
2929 LINES is a list of the form (ROW1 ROW2 ROW3 ...) where each
2930 element is a `string' representing a single row of org-table.
2931 Thus each ROW has vertical separators \"|\" separating the table
2932 fields. A ROW could also be a row-group separator of the form
2933 \"|---...|\". Return a list of the form (ROW1 ROW2 ROW3
2934 ...). ROW could either be symbol `'hline' or a list of the
2935 form (FIELD1 FIELD2 FIELD3 ...) as appropriate."
2936 (let (line lines-1)
2937 (cond
2938 (splice
2939 (while (setq line (pop lines))
2940 (unless (string-match "^[ \t]*|-" line)
2941 (push (org-e-html-transcode-table-row line) lines-1))))
2942 (t (while (setq line (pop lines))
2943 (cond
2944 ((string-match "^[ \t]*|-" line)
2945 (when lines (push 'hline lines-1)))
2946 (t (push (org-e-html-transcode-table-row line) lines-1))))))
2947 (nreverse lines-1)))
2949 (defun org-e-html-table-table (raw-table)
2950 (require 'table)
2951 (with-current-buffer (get-buffer-create "*org-export-table*")
2952 (erase-buffer))
2953 (let ((output (with-temp-buffer
2954 (insert raw-table)
2955 (goto-char 1)
2956 (re-search-forward "^[ \t]*|[^|]" nil t)
2957 (table-generate-source 'html "*org-export-table*")
2958 (with-current-buffer "*org-export-table*"
2959 (org-trim (buffer-string))))))
2960 (kill-buffer (get-buffer "*org-export-table*"))
2961 output))
2963 (defun org-e-html-table (table contents info)
2964 "Transcode a TABLE element from Org to HTML.
2965 CONTENTS is nil. INFO is a plist holding contextual information."
2966 (let* ((label (org-element-property :name table))
2967 (caption (org-e-html--caption/label-string
2968 (org-element-property :caption table) label info))
2969 (attr (mapconcat #'identity
2970 (org-element-property :attr_html table)
2971 " "))
2972 (raw-table (org-element-property :raw-table table))
2973 (table-type (org-element-property :type table)))
2974 (case table-type
2975 (table.el
2976 (org-e-html-table-table raw-table))
2978 (let* ((table-info (org-export-table-format-info raw-table))
2979 (columns-number (length (plist-get table-info :alignment)))
2980 (lines (org-split-string
2981 (org-export-clean-table
2982 raw-table (plist-get table-info :special-column-p)) "\n")))
2983 (org-e-html-list-table lines caption label attr))))))
2986 ;;;; Target
2988 (defun org-e-html-target (target contents info)
2989 "Transcode a TARGET object from Org to HTML.
2990 CONTENTS is nil. INFO is a plist holding contextual
2991 information."
2992 (let ((id (org-export-solidify-link-text
2993 (org-element-property :value target))))
2994 (format "<a id=\"%s\" name=\"%s\"/>" id id)))
2997 ;;;; Time-stamp
2999 (defun org-e-html-time-stamp (time-stamp contents info)
3000 "Transcode a TIME-STAMP object from Org to HTML.
3001 CONTENTS is nil. INFO is a plist holding contextual
3002 information."
3003 (let ((value (org-element-property :value time-stamp))
3004 (type (org-element-property :type time-stamp))
3005 (appt-type (org-element-property :appt-type time-stamp)))
3006 (setq value (org-translate-time
3007 (org-export-secondary-string value 'e-html info)))
3008 (setq appt-type (case appt-type
3009 (scheduled org-scheduled-string)
3010 (deadline org-deadline-string)
3011 (closed org-closed-string)))
3012 (format "<span class=\"timestamp-wrapper\">%s%s</span>"
3013 (if (not appt-type) ""
3014 (format "<span class=\"timestamp-kwd\">%s</span> " appt-type))
3015 (format "<span class=\"timestamp\">%s</span>" value))))
3018 ;;;; Verbatim
3020 (defun org-e-html-verbatim (verbatim contents info)
3021 "Transcode a VERBATIM object from Org to HTML.
3022 CONTENTS is nil. INFO is a plist used as a communication
3023 channel."
3024 (org-e-html-emphasis
3025 verbatim (org-element-property :value verbatim) info))
3028 ;;;; Verse Block
3030 (defun org-e-html-verse-block (verse-block contents info)
3031 "Transcode a VERSE-BLOCK element from Org to HTML.
3032 CONTENTS is nil. INFO is a plist holding contextual information."
3033 ;; Replace each newline character with line break. Also replace
3034 ;; each blank line with a line break.
3035 (setq contents (replace-regexp-in-string
3036 "^ *\\\\\\\\$" "<br/>\n"
3037 (replace-regexp-in-string
3038 "\\(\\\\\\\\\\)?[ \t]*\n" " <br/>\n"
3039 (org-remove-indentation
3040 (org-export-secondary-string
3041 (org-element-property :value verse-block)
3042 'e-html info)))))
3043 ;; Replace each white space at beginning of a line with a
3044 ;; non-breaking space.
3045 (while (string-match "^[ \t]+" contents)
3046 (let* ((num-ws (length (match-string 0 contents)))
3047 (ws (let (out) (dotimes (i num-ws out)
3048 (setq out (concat out "&nbsp;"))))))
3049 (setq contents (replace-match ws nil t contents))))
3050 (org-e-html--wrap-label
3051 verse-block (format "<p class=\"verse\">\n%s</p>" contents)))
3056 ;;; Filter Functions
3058 ;;;; Filter Settings
3060 (defconst org-e-html-filters-alist
3061 '((:filter-final-output . org-e-html-final-function))
3062 "Alist between filters keywords and back-end specific filters.
3063 See `org-export-filters-alist' for more information.")
3066 ;;;; Filters
3068 (defun org-e-html-final-function (contents backend info)
3069 (if (not org-e-html-pretty-output) contents
3070 (with-temp-buffer
3071 (nxml-mode)
3072 (insert contents)
3073 (indent-region (point-min) (point-max))
3074 (buffer-substring-no-properties (point-min) (point-max)))))
3077 ;;; Interactive functions
3079 (defun org-e-html-export-to-html
3080 (&optional subtreep visible-only body-only ext-plist pub-dir)
3081 "Export current buffer to a HTML file.
3083 If narrowing is active in the current buffer, only export its
3084 narrowed part.
3086 If a region is active, export that region.
3088 When optional argument SUBTREEP is non-nil, export the sub-tree
3089 at point, extracting information from the headline properties
3090 first.
3092 When optional argument VISIBLE-ONLY is non-nil, don't export
3093 contents of hidden elements.
3095 When optional argument BODY-ONLY is non-nil, only write code
3096 between \"\\begin{document}\" and \"\\end{document}\".
3098 EXT-PLIST, when provided, is a property list with external
3099 parameters overriding Org default settings, but still inferior to
3100 file-local settings.
3102 When optional argument PUB-DIR is set, use it as the publishing
3103 directory.
3105 Return output file's name."
3106 (interactive)
3108 ;; FIXME
3109 (with-current-buffer (get-buffer-create "*debug*")
3110 (erase-buffer))
3111 (let* ((extension (concat "." org-e-html-extension))
3112 (file (org-export-output-file-name extension subtreep pub-dir)))
3113 (org-export-to-file
3114 'e-html file subtreep visible-only body-only ext-plist)))
3118 ;;; FIXMES, TODOS, FOR REVIEW etc
3120 ;;;; org-format-table-html
3121 ;;;; org-format-org-table-html
3122 ;;;; org-format-table-table-html
3123 ;;;; org-table-number-fraction
3124 ;;;; org-table-number-regexp
3125 ;;;; org-e-html-table-caption-above
3127 ;;;; org-whitespace
3128 ;;;; "<span style=\"visibility:hidden;\">%s</span>"
3129 ;;;; Remove display properties
3131 ;;;; org-e-html-with-timestamp
3132 ;;;; org-e-html-html-helper-timestamp
3134 ;;;; org-export-as-html-and-open
3135 ;;;; org-export-as-html-batch
3136 ;;;; org-export-as-html-to-buffer
3137 ;;;; org-replace-region-by-html
3138 ;;;; org-export-region-as-html
3139 ;;;; org-export-as-html
3141 ;;;; (org-export-directory :html opt-plist)
3142 ;;;; (plist-get opt-plist :html-extension)
3143 ;;;; org-e-html-toplevel-hlevel
3144 ;;;; org-e-html-special-string-regexps
3145 ;;;; org-e-html-coding-system
3146 ;;;; org-e-html-coding-system
3147 ;;;; org-e-html-inline-images
3148 ;;;; org-e-html-inline-image-extensions
3149 ;;;; org-e-html-protect-char-alist
3150 ;;;; org-e-html-table-use-header-tags-for-first-column
3151 ;;;; org-e-html-todo-kwd-class-prefix
3152 ;;;; org-e-html-tag-class-prefix
3153 ;;;; org-e-html-footnote-separator
3155 ;;;; org-export-preferred-target-alist
3156 ;;;; org-solidify-link-text
3157 ;;;; class for anchors
3158 ;;;; org-export-with-section-numbers, body-only
3159 ;;;; org-export-mark-todo-in-toc
3161 (provide 'org-e-html)
3162 ;;; org-e-html.el ends here