ox-html.el 117 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266
  1. ;;; ox-html.el --- HTML Back-End for Org Export Engine
  2. ;; Copyright (C) 2011-2013 Free Software Foundation, Inc.
  3. ;; Author: Jambunathan K <kjambunathan at gmail dot com>
  4. ;; Keywords: outlines, hypermedia, calendar, wp
  5. ;; GNU Emacs is free software: you can redistribute it and/or modify
  6. ;; it under the terms of the GNU General Public License as published by
  7. ;; the Free Software Foundation, either version 3 of the License, or
  8. ;; (at your option) any later version.
  9. ;; GNU Emacs is distributed in the hope that it will be useful,
  10. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. ;; GNU General Public License for more details.
  13. ;; You should have received a copy of the GNU General Public License
  14. ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
  15. ;;; Commentary:
  16. ;; This library implements a HTML back-end for Org generic exporter.
  17. ;; To test it, run:
  18. ;;
  19. ;; M-x org-export-as-html
  20. ;;
  21. ;; in an Org mode buffer. See ox.el for more details on how this
  22. ;; exporter works.
  23. ;;; Code:
  24. ;;; Dependencies
  25. (require 'ox)
  26. (require 'ox-publish)
  27. (require 'format-spec)
  28. (eval-when-compile (require 'cl) (require 'table))
  29. ;;; Function Declarations
  30. (declare-function org-id-find-id-file "org-id" (id))
  31. (declare-function htmlize-region "ext:htmlize" (beg end))
  32. (declare-function org-pop-to-buffer-same-window
  33. "org-compat" (&optional buffer-or-name norecord label))
  34. (declare-function mm-url-decode-entities "mm-url" ())
  35. ;;; Define Back-End
  36. (org-export-define-backend html
  37. ((bold . org-html-bold)
  38. (center-block . org-html-center-block)
  39. (clock . org-html-clock)
  40. (code . org-html-code)
  41. (drawer . org-html-drawer)
  42. (dynamic-block . org-html-dynamic-block)
  43. (entity . org-html-entity)
  44. (example-block . org-html-example-block)
  45. (export-block . org-html-export-block)
  46. (export-snippet . org-html-export-snippet)
  47. (fixed-width . org-html-fixed-width)
  48. (footnote-definition . org-html-footnote-definition)
  49. (footnote-reference . org-html-footnote-reference)
  50. (headline . org-html-headline)
  51. (horizontal-rule . org-html-horizontal-rule)
  52. (inline-src-block . org-html-inline-src-block)
  53. (inlinetask . org-html-inlinetask)
  54. (inner-template . org-html-inner-template)
  55. (italic . org-html-italic)
  56. (item . org-html-item)
  57. (keyword . org-html-keyword)
  58. (latex-environment . org-html-latex-environment)
  59. (latex-fragment . org-html-latex-fragment)
  60. (line-break . org-html-line-break)
  61. (link . org-html-link)
  62. (paragraph . org-html-paragraph)
  63. (plain-list . org-html-plain-list)
  64. (plain-text . org-html-plain-text)
  65. (planning . org-html-planning)
  66. (property-drawer . org-html-property-drawer)
  67. (quote-block . org-html-quote-block)
  68. (quote-section . org-html-quote-section)
  69. (radio-target . org-html-radio-target)
  70. (section . org-html-section)
  71. (special-block . org-html-special-block)
  72. (src-block . org-html-src-block)
  73. (statistics-cookie . org-html-statistics-cookie)
  74. (strike-through . org-html-strike-through)
  75. (subscript . org-html-subscript)
  76. (superscript . org-html-superscript)
  77. (table . org-html-table)
  78. (table-cell . org-html-table-cell)
  79. (table-row . org-html-table-row)
  80. (target . org-html-target)
  81. (template . org-html-template)
  82. (timestamp . org-html-timestamp)
  83. (underline . org-html-underline)
  84. (verbatim . org-html-verbatim)
  85. (verse-block . org-html-verse-block))
  86. :export-block "HTML"
  87. :filters-alist ((:filter-options . org-html-infojs-install-script)
  88. (:filter-final-output . org-html-final-function))
  89. :menu-entry
  90. (?h "Export to HTML"
  91. ((?H "As HTML buffer" org-html-export-as-html)
  92. (?h "As HTML file" org-html-export-to-html)
  93. (?o "As HTML file and open"
  94. (lambda (a s v b)
  95. (if a (org-html-export-to-html t s v b)
  96. (org-open-file (org-html-export-to-html nil s v b)))))))
  97. :options-alist
  98. ((:html-extension nil nil org-html-extension)
  99. (:html-doctype "HTML_DOCTYPE" nil org-html-doctype)
  100. (:html-container "HTML_CONTAINER" nil org-html-container-element)
  101. (:html-link-home "HTML_LINK_HOME" nil org-html-link-home)
  102. (:html-link-up "HTML_LINK_UP" nil org-html-link-up)
  103. (:html-mathjax "HTML_MATHJAX" nil "" space)
  104. (:html-postamble nil "html-postamble" org-html-postamble)
  105. (:html-preamble nil "html-preamble" org-html-preamble)
  106. (:html-head "HTML_HEAD" nil org-html-head newline)
  107. (:html-head-extra "HTML_HEAD_EXTRA" nil org-html-head-extra newline)
  108. (:html-head-include-default-style "HTML_INCLUDE_STYLE" nil org-html-head-include-default-style newline)
  109. (:html-head-include-scripts "HTML_INCLUDE_SCRIPTS" nil org-html-head-include-scripts newline)
  110. (:html-table-tag nil nil org-html-table-tag)
  111. ;; Redefine regular options.
  112. (:creator "CREATOR" nil org-html-creator-string)
  113. (:with-latex nil "tex" org-html-with-latex)
  114. ;; Leave room for "ox-infojs.el" extension.
  115. (:infojs-opt "INFOJS_OPT" nil nil)))
  116. ;;; Internal Variables
  117. (defvar org-html-format-table-no-css)
  118. (defvar htmlize-buffer-places) ; from htmlize.el
  119. (defvar org-html--timestamp-format "%Y-%m-%d %a %H:%M"
  120. "FORMAT used by `format-time-string' for timestamps in
  121. preamble, postamble and metadata.")
  122. (defvar org-html--pre/postamble-class "status"
  123. "CSS class used for pre/postamble")
  124. (defconst org-html-special-string-regexps
  125. '(("\\\\-" . "&#x00ad;") ; shy
  126. ("---\\([^-]\\)" . "&#x2014;\\1") ; mdash
  127. ("--\\([^-]\\)" . "&#x2013;\\1") ; ndash
  128. ("\\.\\.\\." . "&#x2026;")) ; hellip
  129. "Regular expressions for special string conversion.")
  130. (defconst org-html-scripts
  131. "<script type=\"text/javascript\">
  132. /*
  133. @licstart The following is the entire license notice for the
  134. JavaScript code in this tag.
  135. Copyright (C) 2012 Free Software Foundation, Inc.
  136. The JavaScript code in this tag is free software: you can
  137. redistribute it and/or modify it under the terms of the GNU
  138. General Public License (GNU GPL) as published by the Free Software
  139. Foundation, either version 3 of the License, or (at your option)
  140. any later version. The code is distributed WITHOUT ANY WARRANTY;
  141. without even the implied warranty of MERCHANTABILITY or FITNESS
  142. FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
  143. As additional permission under GNU GPL version 3 section 7, you
  144. may distribute non-source (e.g., minimized or compacted) forms of
  145. that code without the copy of the GNU GPL normally required by
  146. section 4, provided you include this license notice and a URL
  147. through which recipients can access the Corresponding Source.
  148. @licend The above is the entire license notice
  149. for the JavaScript code in this tag.
  150. */
  151. <!--/*--><![CDATA[/*><!--*/
  152. function CodeHighlightOn(elem, id)
  153. {
  154. var target = document.getElementById(id);
  155. if(null != target) {
  156. elem.cacheClassElem = elem.className;
  157. elem.cacheClassTarget = target.className;
  158. target.className = \"code-highlighted\";
  159. elem.className = \"code-highlighted\";
  160. }
  161. }
  162. function CodeHighlightOff(elem, id)
  163. {
  164. var target = document.getElementById(id);
  165. if(elem.cacheClassElem)
  166. elem.className = elem.cacheClassElem;
  167. if(elem.cacheClassTarget)
  168. target.className = elem.cacheClassTarget;
  169. }
  170. /*]]>*///-->
  171. </script>"
  172. "Basic JavaScript that is needed by HTML files produced by Org mode.")
  173. (defconst org-html-style-default
  174. "<style type=\"text/css\">
  175. <!--/*--><![CDATA[/*><!--*/
  176. .title { text-align: center; }
  177. .todo { font-family: monospace; color: red; }
  178. .done { color: green; }
  179. .tag { background-color: #eee; font-family: monospace;
  180. padding: 2px; font-size: 80%; font-weight: normal; }
  181. .timestamp { color: #bebebe; }
  182. .timestamp-kwd { color: #5f9ea0; }
  183. .right { margin-left: auto; margin-right: 0px; text-align: right; }
  184. .left { margin-left: 0px; margin-right: auto; text-align: left; }
  185. .center { margin-left: auto; margin-right: auto; text-align: center; }
  186. .underline { text-decoration: underline; }
  187. #postamble p, #preamble p { font-size: 90%; margin: .2em; }
  188. p.verse { margin-left: 3%; }
  189. pre {
  190. border: 1px solid #ccc;
  191. box-shadow: 3px 3px 3px #eee;
  192. padding: 8pt;
  193. font-family: monospace;
  194. overflow: auto;
  195. margin: 1.2em;
  196. }
  197. pre.src {
  198. position: relative;
  199. overflow: visible;
  200. padding-top: 1.2em;
  201. }
  202. pre.src:before {
  203. display: none;
  204. position: absolute;
  205. background-color: white;
  206. top: -10px;
  207. right: 10px;
  208. padding: 3px;
  209. border: 1px solid black;
  210. }
  211. pre.src:hover:before { display: inline;}
  212. pre.src-sh:before { content: 'sh'; }
  213. pre.src-bash:before { content: 'sh'; }
  214. pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
  215. pre.src-R:before { content: 'R'; }
  216. pre.src-perl:before { content: 'Perl'; }
  217. pre.src-java:before { content: 'Java'; }
  218. pre.src-sql:before { content: 'SQL'; }
  219. table { border-collapse:collapse; }
  220. td, th { vertical-align:top; }
  221. th.right { text-align: center; }
  222. th.left { text-align: center; }
  223. th.center { text-align: center; }
  224. td.right { text-align: right; }
  225. td.left { text-align: left; }
  226. td.center { text-align: center; }
  227. dt { font-weight: bold; }
  228. .footpara:nth-child(2) { display: inline; }
  229. .footpara { display: block; }
  230. .footdef { margin-bottom: 1em; }
  231. .figure { padding: 1em; }
  232. .figure p { text-align: center; }
  233. .inlinetask {
  234. padding: 10px;
  235. border: 2px solid gray;
  236. margin: 10px;
  237. background: #ffffcc;
  238. }
  239. #org-div-home-and-up
  240. { text-align: right; font-size: 70%; white-space: nowrap; }
  241. textarea { overflow-x: auto; }
  242. .linenr { font-size: smaller }
  243. .code-highlighted { background-color: #ffff00; }
  244. .org-info-js_info-navigation { border-style: none; }
  245. #org-info-js_console-label
  246. { font-size: 10px; font-weight: bold; white-space: nowrap; }
  247. .org-info-js_search-highlight
  248. { background-color: #ffff00; color: #000000; font-weight: bold; }
  249. /*]]>*/-->
  250. </style>"
  251. "The default style specification for exported HTML files.
  252. You can use `org-html-head' and `org-html-head-extra' to add to
  253. this style. If you don't want to include this default style,
  254. customize `org-html-head-include-default-style'.")
  255. ;;; User Configuration Variables
  256. (defgroup org-export-html nil
  257. "Options for exporting Org mode files to HTML."
  258. :tag "Org Export HTML"
  259. :group 'org-export)
  260. ;;;; Handle infojs
  261. (defvar org-html-infojs-opts-table
  262. '((path PATH "http://orgmode.org/org-info.js")
  263. (view VIEW "info")
  264. (toc TOC :with-toc)
  265. (ftoc FIXED_TOC "0")
  266. (tdepth TOC_DEPTH "max")
  267. (sdepth SECTION_DEPTH "max")
  268. (mouse MOUSE_HINT "underline")
  269. (buttons VIEW_BUTTONS "0")
  270. (ltoc LOCAL_TOC "1")
  271. (up LINK_UP :html-link-up)
  272. (home LINK_HOME :html-link-home))
  273. "JavaScript options, long form for script, default values.")
  274. (defcustom org-html-use-infojs 'when-configured
  275. "Non-nil when Sebastian Rose's Java Script org-info.js should be active.
  276. This option can be nil or t to never or always use the script.
  277. It can also be the symbol `when-configured', meaning that the
  278. script will be linked into the export file if and only if there
  279. is a \"#+INFOJS_OPT:\" line in the buffer. See also the variable
  280. `org-html-infojs-options'."
  281. :group 'org-export-html
  282. :version "24.4"
  283. :package-version '(Org . "8.0")
  284. :type '(choice
  285. (const :tag "Never" nil)
  286. (const :tag "When configured in buffer" when-configured)
  287. (const :tag "Always" t)))
  288. (defcustom org-html-infojs-options
  289. (mapcar (lambda (x) (cons (car x) (nth 2 x))) org-html-infojs-opts-table)
  290. "Options settings for the INFOJS JavaScript.
  291. Each of the options must have an entry in `org-html-infojs-opts-table'.
  292. The value can either be a string that will be passed to the script, or
  293. a property. This property is then assumed to be a property that is defined
  294. by the Export/Publishing setup of Org.
  295. The `sdepth' and `tdepth' parameters can also be set to \"max\", which
  296. means to use the maximum value consistent with other options."
  297. :group 'org-export-html
  298. :version "24.4"
  299. :package-version '(Org . "8.0")
  300. :type
  301. `(set :greedy t :inline t
  302. ,@(mapcar
  303. (lambda (x)
  304. (list 'cons (list 'const (car x))
  305. '(choice
  306. (symbol :tag "Publishing/Export property")
  307. (string :tag "Value"))))
  308. org-html-infojs-opts-table)))
  309. (defcustom org-html-infojs-template
  310. "<script type=\"text/javascript\" src=\"%SCRIPT_PATH\">
  311. /**
  312. *
  313. * @source: %SCRIPT_PATH
  314. *
  315. * @licstart The following is the entire license notice for the
  316. * JavaScript code in %SCRIPT_PATH.
  317. *
  318. * Copyright (C) 2012-2013 Sebastian Rose
  319. *
  320. *
  321. * The JavaScript code in this tag is free software: you can
  322. * redistribute it and/or modify it under the terms of the GNU
  323. * General Public License (GNU GPL) as published by the Free Software
  324. * Foundation, either version 3 of the License, or (at your option)
  325. * any later version. The code is distributed WITHOUT ANY WARRANTY;
  326. * without even the implied warranty of MERCHANTABILITY or FITNESS
  327. * FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
  328. *
  329. * As additional permission under GNU GPL version 3 section 7, you
  330. * may distribute non-source (e.g., minimized or compacted) forms of
  331. * that code without the copy of the GNU GPL normally required by
  332. * section 4, provided you include this license notice and a URL
  333. * through which recipients can access the Corresponding Source.
  334. *
  335. * @licend The above is the entire license notice
  336. * for the JavaScript code in %SCRIPT_PATH.
  337. *
  338. */
  339. </script>
  340. <script type=\"text/javascript\">
  341. /*
  342. @licstart The following is the entire license notice for the
  343. JavaScript code in this tag.
  344. Copyright (C) 2012-2013 Free Software Foundation, Inc.
  345. The JavaScript code in this tag is free software: you can
  346. redistribute it and/or modify it under the terms of the GNU
  347. General Public License (GNU GPL) as published by the Free Software
  348. Foundation, either version 3 of the License, or (at your option)
  349. any later version. The code is distributed WITHOUT ANY WARRANTY;
  350. without even the implied warranty of MERCHANTABILITY or FITNESS
  351. FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
  352. As additional permission under GNU GPL version 3 section 7, you
  353. may distribute non-source (e.g., minimized or compacted) forms of
  354. that code without the copy of the GNU GPL normally required by
  355. section 4, provided you include this license notice and a URL
  356. through which recipients can access the Corresponding Source.
  357. @licend The above is the entire license notice
  358. for the JavaScript code in this tag.
  359. */
  360. <!--/*--><![CDATA[/*><!--*/
  361. %MANAGER_OPTIONS
  362. org_html_manager.setup(); // activate after the parameters are set
  363. /*]]>*///-->
  364. </script>"
  365. "The template for the export style additions when org-info.js is used.
  366. Option settings will replace the %MANAGER-OPTIONS cookie."
  367. :group 'org-export-html
  368. :version "24.4"
  369. :package-version '(Org . "8.0")
  370. :type 'string)
  371. (defun org-html-infojs-install-script (exp-plist backend)
  372. "Install script in export options when appropriate.
  373. EXP-PLIST is a plist containing export options. BACKEND is the
  374. export back-end currently used."
  375. (unless (or (memq 'body-only (plist-get exp-plist :export-options))
  376. (not org-html-use-infojs)
  377. (and (eq org-html-use-infojs 'when-configured)
  378. (or (not (plist-get exp-plist :infojs-opt))
  379. (string-match "\\<view:nil\\>"
  380. (plist-get exp-plist :infojs-opt)))))
  381. (let* ((template org-html-infojs-template)
  382. (ptoc (plist-get exp-plist :with-toc))
  383. (hlevels (plist-get exp-plist :headline-levels))
  384. (sdepth hlevels)
  385. (tdepth (if (integerp ptoc) (min ptoc hlevels) hlevels))
  386. (options (plist-get exp-plist :infojs-opt))
  387. (table org-html-infojs-opts-table)
  388. style)
  389. (dolist (entry table)
  390. (let* ((opt (car entry))
  391. (var (nth 1 entry))
  392. ;; Compute default values for script option OPT from
  393. ;; `org-html-infojs-options' variable.
  394. (default
  395. (let ((default (cdr (assq opt org-html-infojs-options))))
  396. (if (and (symbolp default) (not (memq default '(t nil))))
  397. (plist-get exp-plist default)
  398. default)))
  399. ;; Value set through INFOJS_OPT keyword has precedence
  400. ;; over the default one.
  401. (val (if (and options
  402. (string-match (format "\\<%s:\\(\\S-+\\)" opt)
  403. options))
  404. (match-string 1 options)
  405. default)))
  406. (case opt
  407. (path (setq template
  408. (replace-regexp-in-string
  409. "%SCRIPT_PATH" val template t t)))
  410. (sdepth (when (integerp (read val))
  411. (setq sdepth (min (read val) sdepth))))
  412. (tdepth (when (integerp (read val))
  413. (setq tdepth (min (read val) tdepth))))
  414. (otherwise (setq val
  415. (cond
  416. ((or (eq val t) (equal val "t")) "1")
  417. ((or (eq val nil) (equal val "nil")) "0")
  418. ((stringp val) val)
  419. (t (format "%s" val))))
  420. (push (cons var val) style)))))
  421. ;; Now we set the depth of the *generated* TOC to SDEPTH,
  422. ;; because the toc will actually determine the splitting. How
  423. ;; much of the toc will actually be displayed is governed by the
  424. ;; TDEPTH option.
  425. (setq exp-plist (plist-put exp-plist :with-toc sdepth))
  426. ;; The table of contents should not show more sections than we
  427. ;; generate.
  428. (setq tdepth (min tdepth sdepth))
  429. (push (cons "TOC_DEPTH" tdepth) style)
  430. ;; Build style string.
  431. (setq style (mapconcat
  432. (lambda (x) (format "org_html_manager.set(\"%s\", \"%s\");"
  433. (car x)
  434. (cdr x)))
  435. style "\n"))
  436. (when (and style (> (length style) 0))
  437. (and (string-match "%MANAGER_OPTIONS" template)
  438. (setq style (replace-match style t t template))
  439. (setq exp-plist
  440. (plist-put
  441. exp-plist :html-head-extra
  442. (concat (or (plist-get exp-plist :html-head-extra) "")
  443. "\n"
  444. style)))))
  445. ;; This script absolutely needs the table of contents, so we
  446. ;; change that setting.
  447. (unless (plist-get exp-plist :with-toc)
  448. (setq exp-plist (plist-put exp-plist :with-toc t)))
  449. ;; Return the modified property list.
  450. exp-plist)))
  451. ;;;; Bold, etc.
  452. (defcustom org-html-text-markup-alist
  453. '((bold . "<b>%s</b>")
  454. (code . "<code>%s</code>")
  455. (italic . "<i>%s</i>")
  456. (strike-through . "<del>%s</del>")
  457. (underline . "<span class=\"underline\">%s</span>")
  458. (verbatim . "<code>%s</code>"))
  459. "Alist of HTML expressions to convert text markup.
  460. The key must be a symbol among `bold', `code', `italic',
  461. `strike-through', `underline' and `verbatim'. The value is
  462. a formatting string to wrap fontified text with.
  463. If no association can be found for a given markup, text will be
  464. returned as-is."
  465. :group 'org-export-html
  466. :type '(alist :key-type (symbol :tag "Markup type")
  467. :value-type (string :tag "Format string"))
  468. :options '(bold code italic strike-through underline verbatim))
  469. (defcustom org-html-indent t
  470. "Non-nil means to indent the generated HTML."
  471. :group 'org-export-html
  472. :version "24.4"
  473. :package-version '(Org . "8.0")
  474. :type 'boolean)
  475. (defcustom org-html-use-unicode-chars nil
  476. "Non-nil means to use unicode characters instead of HTML entities."
  477. :group 'org-export-html
  478. :version "24.4"
  479. :package-version '(Org . "8.0")
  480. :type 'boolean)
  481. ;;;; Drawers
  482. (defcustom org-html-format-drawer-function nil
  483. "Function called to format a drawer in HTML code.
  484. The function must accept two parameters:
  485. NAME the drawer name, like \"LOGBOOK\"
  486. CONTENTS the contents of the drawer.
  487. The function should return the string to be exported.
  488. For example, the variable could be set to the following function
  489. in order to mimic default behaviour:
  490. \(defun org-html-format-drawer-default \(name contents\)
  491. \"Format a drawer element for HTML export.\"
  492. contents\)"
  493. :group 'org-export-html
  494. :type 'function)
  495. ;;;; Footnotes
  496. (defcustom org-html-footnotes-section "<div id=\"footnotes\">
  497. <h2 class=\"footnotes\">%s: </h2>
  498. <div id=\"text-footnotes\">
  499. %s
  500. </div>
  501. </div>"
  502. "Format for the footnotes section.
  503. Should contain a two instances of %s. The first will be replaced with the
  504. language-specific word for \"Footnotes\", the second one will be replaced
  505. by the footnotes themselves."
  506. :group 'org-export-html
  507. :type 'string)
  508. (defcustom org-html-footnote-format "<sup>%s</sup>"
  509. "The format for the footnote reference.
  510. %s will be replaced by the footnote reference itself."
  511. :group 'org-export-html
  512. :type 'string)
  513. (defcustom org-html-footnote-separator "<sup>, </sup>"
  514. "Text used to separate footnotes."
  515. :group 'org-export-html
  516. :type 'string)
  517. ;;;; Headline
  518. (defcustom org-html-toplevel-hlevel 2
  519. "The <H> level for level 1 headings in HTML export.
  520. This is also important for the classes that will be wrapped around headlines
  521. and outline structure. If this variable is 1, the top-level headlines will
  522. be <h1>, and the corresponding classes will be outline-1, section-number-1,
  523. and outline-text-1. If this is 2, all of these will get a 2 instead.
  524. The default for this variable is 2, because we use <h1> for formatting the
  525. document title."
  526. :group 'org-export-html
  527. :type 'integer)
  528. (defcustom org-html-format-headline-function nil
  529. "Function to format headline text.
  530. This function will be called with 5 arguments:
  531. TODO the todo keyword (string or nil).
  532. TODO-TYPE the type of todo (symbol: `todo', `done', nil)
  533. PRIORITY the priority of the headline (integer or nil)
  534. TEXT the main headline text (string).
  535. TAGS the tags (string or nil).
  536. The function result will be used in the section format string."
  537. :group 'org-export-html
  538. :type 'function)
  539. ;;;; HTML-specific
  540. (defcustom org-html-allow-name-attribute-in-anchors t
  541. "When nil, do not set \"name\" attribute in anchors.
  542. By default, anchors are formatted with both \"id\" and \"name\"
  543. attributes, when appropriate."
  544. :group 'org-export-html
  545. :version "24.4"
  546. :package-version '(Org . "8.0")
  547. :type 'boolean)
  548. ;;;; Inlinetasks
  549. (defcustom org-html-format-inlinetask-function nil
  550. "Function called to format an inlinetask in HTML code.
  551. The function must accept six parameters:
  552. TODO the todo keyword, as a string
  553. TODO-TYPE the todo type, a symbol among `todo', `done' and nil.
  554. PRIORITY the inlinetask priority, as a string
  555. NAME the inlinetask name, as a string.
  556. TAGS the inlinetask tags, as a list of strings.
  557. CONTENTS the contents of the inlinetask, as a string.
  558. The function should return the string to be exported."
  559. :group 'org-export-html
  560. :type 'function)
  561. ;;;; LaTeX
  562. (defcustom org-html-with-latex org-export-with-latex
  563. "Non-nil means process LaTeX math snippets.
  564. When set, the exporter will process LaTeX environments and
  565. fragments.
  566. This option can also be set with the +OPTIONS line,
  567. e.g. \"tex:mathjax\". Allowed values are:
  568. nil Ignore math snippets.
  569. `verbatim' Keep everything in verbatim
  570. `dvipng' Process the LaTeX fragments to images. This will also
  571. include processing of non-math environments.
  572. `imagemagick' Convert the LaTeX fragments to pdf files and use
  573. imagemagick to convert pdf files to png files.
  574. `mathjax' Do MathJax preprocessing and arrange for MathJax.js to
  575. be loaded.
  576. t Synonym for `mathjax'."
  577. :group 'org-export-html
  578. :version "24.4"
  579. :package-version '(Org . "8.0")
  580. :type '(choice
  581. (const :tag "Do not process math in any way" nil)
  582. (const :tag "Use dvipng to make images" dvipng)
  583. (const :tag "Use imagemagick to make images" imagemagick)
  584. (const :tag "Use MathJax to display math" mathjax)
  585. (const :tag "Leave math verbatim" verbatim)))
  586. ;;;; Links :: Generic
  587. (defcustom org-html-link-org-files-as-html t
  588. "Non-nil means make file links to `file.org' point to `file.html'.
  589. When `org-mode' is exporting an `org-mode' file to HTML, links to
  590. non-html files are directly put into a href tag in HTML.
  591. However, links to other Org-mode files (recognized by the
  592. extension `.org.) should become links to the corresponding html
  593. file, assuming that the linked `org-mode' file will also be
  594. converted to HTML.
  595. When nil, the links still point to the plain `.org' file."
  596. :group 'org-export-html
  597. :type 'boolean)
  598. ;;;; Links :: Inline images
  599. (defcustom org-html-inline-images 'maybe
  600. "Non-nil means inline images into exported HTML pages.
  601. This is done using an <img> tag. When nil, an anchor with href is used to
  602. link to the image. If this option is `maybe', then images in links with
  603. an empty description will be inlined, while images with a description will
  604. be linked only."
  605. :group 'org-export-html
  606. :type '(choice (const :tag "Never" nil)
  607. (const :tag "Always" t)
  608. (const :tag "When there is no description" maybe)))
  609. (defcustom org-html-inline-image-rules
  610. '(("file" . "\\.\\(jpeg\\|jpg\\|png\\|gif\\|svg\\)\\'")
  611. ("http" . "\\.\\(jpeg\\|jpg\\|png\\|gif\\|svg\\)\\'")
  612. ("https" . "\\.\\(jpeg\\|jpg\\|png\\|gif\\|svg\\)\\'"))
  613. "Rules characterizing image files that can be inlined into HTML.
  614. A rule consists in an association whose key is the type of link
  615. to consider, and value is a regexp that will be matched against
  616. link's path.
  617. Note that, by default, the image extension *actually* allowed
  618. depend on the way the HTML file is processed. When used with
  619. pdflatex, pdf, jpg and png images are OK. When processing
  620. through dvi to Postscript, only ps and eps are allowed. The
  621. default we use here encompasses both."
  622. :group 'org-export-html
  623. :version "24.4"
  624. :package-version '(Org . "8.0")
  625. :type '(alist :key-type (string :tag "Type")
  626. :value-type (regexp :tag "Path")))
  627. ;;;; Plain Text
  628. (defcustom org-html-protect-char-alist
  629. '(("&" . "&amp;")
  630. ("<" . "&lt;")
  631. (">" . "&gt;"))
  632. "Alist of characters to be converted by `org-html-protect'."
  633. :group 'org-export-html
  634. :type '(repeat (cons (string :tag "Character")
  635. (string :tag "HTML equivalent"))))
  636. ;;;; Src Block
  637. (defcustom org-html-htmlize-output-type 'inline-css
  638. "Output type to be used by htmlize when formatting code snippets.
  639. Choices are `css', to export the CSS selectors only, or `inline-css', to
  640. export the CSS attribute values inline in the HTML. We use as default
  641. `inline-css', in order to make the resulting HTML self-containing.
  642. However, this will fail when using Emacs in batch mode for export, because
  643. then no rich font definitions are in place. It will also not be good if
  644. people with different Emacs setup contribute HTML files to a website,
  645. because the fonts will represent the individual setups. In these cases,
  646. it is much better to let Org/Htmlize assign classes only, and to use
  647. a style file to define the look of these classes.
  648. To get a start for your css file, start Emacs session and make sure that
  649. all the faces you are interested in are defined, for example by loading files
  650. in all modes you want. Then, use the command
  651. \\[org-html-htmlize-generate-css] to extract class definitions."
  652. :group 'org-export-html
  653. :type '(choice (const css) (const inline-css)))
  654. (defcustom org-html-htmlize-font-prefix "org-"
  655. "The prefix for CSS class names for htmlize font specifications."
  656. :group 'org-export-html
  657. :type 'string)
  658. ;;;; Table
  659. (defcustom org-html-table-tag
  660. "<table border=\"2\" cellspacing=\"0\" cellpadding=\"6\" rules=\"groups\" frame=\"hsides\">"
  661. "The HTML tag that is used to start a table.
  662. This must be a <table> tag, but you may change the options like
  663. borders and spacing."
  664. :group 'org-export-html
  665. :type 'string)
  666. (defcustom org-html-table-header-tags '("<th scope=\"%s\"%s>" . "</th>")
  667. "The opening tag for table header fields.
  668. This is customizable so that alignment options can be specified.
  669. The first %s will be filled with the scope of the field, either row or col.
  670. The second %s will be replaced by a style entry to align the field.
  671. See also the variable `org-html-table-use-header-tags-for-first-column'.
  672. See also the variable `org-html-table-align-individual-fields'."
  673. :group 'org-export-html
  674. :type '(cons (string :tag "Opening tag") (string :tag "Closing tag")))
  675. (defcustom org-html-table-data-tags '("<td%s>" . "</td>")
  676. "The opening tag for table data fields.
  677. This is customizable so that alignment options can be specified.
  678. The first %s will be filled with the scope of the field, either row or col.
  679. The second %s will be replaced by a style entry to align the field.
  680. See also the variable `org-html-table-align-individual-fields'."
  681. :group 'org-export-html
  682. :type '(cons (string :tag "Opening tag") (string :tag "Closing tag")))
  683. (defcustom org-html-table-row-tags '("<tr>" . "</tr>")
  684. "The opening tag for table data fields.
  685. This is customizable so that alignment options can be specified.
  686. Instead of strings, these can be Lisp forms that will be evaluated
  687. for each row in order to construct the table row tags. During evaluation,
  688. the variable `head' will be true when this is a header line, nil when this
  689. is a body line. And the variable `nline' will contain the line number,
  690. starting from 1 in the first header line. For example
  691. (setq org-html-table-row-tags
  692. (cons '(if head
  693. \"<tr>\"
  694. (if (= (mod nline 2) 1)
  695. \"<tr class=\\\"tr-odd\\\">\"
  696. \"<tr class=\\\"tr-even\\\">\"))
  697. \"</tr>\"))
  698. will give even lines the class \"tr-even\" and odd lines the class \"tr-odd\"."
  699. :group 'org-export-html
  700. :type '(cons
  701. (choice :tag "Opening tag"
  702. (string :tag "Specify")
  703. (sexp))
  704. (choice :tag "Closing tag"
  705. (string :tag "Specify")
  706. (sexp))))
  707. (defcustom org-html-table-align-individual-fields t
  708. "Non-nil means attach style attributes for alignment to each table field.
  709. When nil, alignment will only be specified in the column tags, but this
  710. is ignored by some browsers (like Firefox, Safari). Opera does it right
  711. though."
  712. :group 'org-export-html
  713. :type 'boolean)
  714. (defcustom org-html-table-use-header-tags-for-first-column nil
  715. "Non-nil means format column one in tables with header tags.
  716. When nil, also column one will use data tags."
  717. :group 'org-export-html
  718. :type 'boolean)
  719. (defcustom org-html-table-caption-above t
  720. "When non-nil, place caption string at the beginning of the table.
  721. Otherwise, place it near the end."
  722. :group 'org-export-html
  723. :type 'boolean)
  724. ;;;; Tags
  725. (defcustom org-html-tag-class-prefix ""
  726. "Prefix to class names for TODO keywords.
  727. Each tag gets a class given by the tag itself, with this prefix.
  728. The default prefix is empty because it is nice to just use the keyword
  729. as a class name. But if you get into conflicts with other, existing
  730. CSS classes, then this prefix can be very useful."
  731. :group 'org-export-html
  732. :type 'string)
  733. ;;;; Template :: Generic
  734. (defcustom org-html-extension "html"
  735. "The extension for exported HTML files."
  736. :group 'org-export-html
  737. :type 'string)
  738. (defcustom org-html-xml-declaration
  739. '(("html" . "<?xml version=\"1.0\" encoding=\"%s\"?>")
  740. ("php" . "<?php echo \"<?xml version=\\\"1.0\\\" encoding=\\\"%s\\\" ?>\"; ?>"))
  741. "The extension for exported HTML files.
  742. %s will be replaced with the charset of the exported file.
  743. This may be a string, or an alist with export extensions
  744. and corresponding declarations."
  745. :group 'org-export-html
  746. :type '(choice
  747. (string :tag "Single declaration")
  748. (repeat :tag "Dependent on extension"
  749. (cons (string :tag "Extension")
  750. (string :tag "Declaration")))))
  751. (defcustom org-html-coding-system 'utf-8
  752. "Coding system for HTML export.
  753. Use utf-8 as the default value."
  754. :group 'org-export-html
  755. :version "24.4"
  756. :package-version '(Org . "8.0")
  757. :type 'coding-system)
  758. (defcustom org-html-doctype
  759. "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"
  760. \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">"
  761. "Document type definition to use for exported HTML files.
  762. Can be set with the in-buffer HTML_DOCTYPE property or for
  763. publishing, with :html-doctype."
  764. :group 'org-export-html
  765. :version "24.4"
  766. :package-version '(Org . "8.0")
  767. :type 'string)
  768. (defcustom org-html-container-element "div"
  769. "HTML element to use for wrapping top level sections.
  770. Can be set with the in-buffer HTML_CONTAINER property or for
  771. publishing, with :html-container.
  772. Note that changing the default will prevent you from using
  773. org-info.js for your website."
  774. :group 'org-export-html
  775. :version "24.4"
  776. :package-version '(Org . "8.0")
  777. :type 'string)
  778. (defcustom org-html-divs
  779. '((preamble "div" "preamble")
  780. (content "div" "content")
  781. (postamble "div" "postamble"))
  782. "Alist of the threed section elements for HTML export.
  783. The car of each entry is one of 'preamble, 'content or 'postamble.
  784. The cdrs of each entry are the ELEMENT_TYPE and ID for each
  785. section of the exported document.
  786. Note that changing the default will prevent you from using
  787. org-info.js for your website."
  788. :group 'org-export-html
  789. :version "24.4"
  790. :package-version '(Org . "8.0")
  791. :type '(list :greedy t
  792. (list :tag "Preamble"
  793. (const :format "" preamble)
  794. (string :tag "element") (string :tag " id"))
  795. (list :tag "Content"
  796. (const :format "" content)
  797. (string :tag "element") (string :tag " id"))
  798. (list :tag "Postamble" (const :format "" postamble)
  799. (string :tag " id") (string :tag "element"))))
  800. ;;;; Template :: Mathjax
  801. (defcustom org-html-mathjax-options
  802. '((path "http://orgmode.org/mathjax/MathJax.js")
  803. (scale "100")
  804. (align "center")
  805. (indent "2em")
  806. (mathml nil))
  807. "Options for MathJax setup.
  808. path The path where to find MathJax
  809. scale Scaling for the HTML-CSS backend, usually between 100 and 133
  810. align How to align display math: left, center, or right
  811. indent If align is not center, how far from the left/right side?
  812. mathml Should a MathML player be used if available?
  813. This is faster and reduces bandwidth use, but currently
  814. sometimes has lower spacing quality. Therefore, the default is
  815. nil. When browsers get better, this switch can be flipped.
  816. You can also customize this for each buffer, using something like
  817. #+MATHJAX: scale:\"133\" align:\"right\" mathml:t path:\"/MathJax/\""
  818. :group 'org-export-html
  819. :type '(list :greedy t
  820. (list :tag "path (the path from where to load MathJax.js)"
  821. (const :format " " path) (string))
  822. (list :tag "scale (scaling for the displayed math)"
  823. (const :format " " scale) (string))
  824. (list :tag "align (alignment of displayed equations)"
  825. (const :format " " align) (string))
  826. (list :tag "indent (indentation with left or right alignment)"
  827. (const :format " " indent) (string))
  828. (list :tag "mathml (should MathML display be used is possible)"
  829. (const :format " " mathml) (boolean))))
  830. (defcustom org-html-mathjax-template
  831. "<script type=\"text/javascript\" src=\"%PATH\">
  832. <!--/*--><![CDATA[/*><!--*/
  833. MathJax.Hub.Config({
  834. // Only one of the two following lines, depending on user settings
  835. // First allows browser-native MathML display, second forces HTML/CSS
  836. :MMLYES: config: [\"MMLorHTML.js\"], jax: [\"input/TeX\"],
  837. :MMLNO: jax: [\"input/TeX\", \"output/HTML-CSS\"],
  838. extensions: [\"tex2jax.js\",\"TeX/AMSmath.js\",\"TeX/AMSsymbols.js\",
  839. \"TeX/noUndefined.js\"],
  840. tex2jax: {
  841. inlineMath: [ [\"\\\\(\",\"\\\\)\"] ],
  842. displayMath: [ ['$$','$$'], [\"\\\\[\",\"\\\\]\"], [\"\\\\begin{displaymath}\",\"\\\\end{displaymath}\"] ],
  843. skipTags: [\"script\",\"noscript\",\"style\",\"textarea\",\"pre\",\"code\"],
  844. ignoreClass: \"tex2jax_ignore\",
  845. processEscapes: false,
  846. processEnvironments: true,
  847. preview: \"TeX\"
  848. },
  849. showProcessingMessages: true,
  850. displayAlign: \"%ALIGN\",
  851. displayIndent: \"%INDENT\",
  852. \"HTML-CSS\": {
  853. scale: %SCALE,
  854. availableFonts: [\"STIX\",\"TeX\"],
  855. preferredFont: \"TeX\",
  856. webFont: \"TeX\",
  857. imageFont: \"TeX\",
  858. showMathMenu: true,
  859. },
  860. MMLorHTML: {
  861. prefer: {
  862. MSIE: \"MML\",
  863. Firefox: \"MML\",
  864. Opera: \"HTML\",
  865. other: \"HTML\"
  866. }
  867. }
  868. });
  869. /*]]>*///-->
  870. </script>"
  871. "The MathJax setup for XHTML files."
  872. :group 'org-export-html
  873. :type 'string)
  874. ;;;; Template :: Postamble
  875. (defcustom org-html-postamble 'auto
  876. "Non-nil means insert a postamble in HTML export.
  877. When set to 'auto, check against the
  878. `org-export-with-author/email/creator/date' variables to set the
  879. content of the postamble. When set to a string, use this string
  880. as the postamble. When t, insert a string as defined by the
  881. formatting string in `org-html-postamble-format'.
  882. When set to a function, apply this function and insert the
  883. returned string. The function takes the property list of export
  884. options as its only argument.
  885. Setting :html-postamble in publishing projects will take
  886. precedence over this variable."
  887. :group 'org-export-html
  888. :type '(choice (const :tag "No postamble" nil)
  889. (const :tag "Auto postamble" 'auto)
  890. (const :tag "Default formatting string" t)
  891. (string :tag "Custom formatting string")
  892. (function :tag "Function (must return a string)")))
  893. (defcustom org-html-postamble-format
  894. '(("en" "<p class=\"author\">Author: %a (%e)</p>
  895. <p class=\"date\">Date: %d</p>
  896. <p class=\"creator\">Generated by %c</p>
  897. <p class=\"xhtml-validation\">%v</p>"))
  898. "Alist of languages and format strings for the HTML postamble.
  899. The first element of each list is the language code, as used for
  900. the #+LANGUAGE keyword.
  901. The second element of each list is a format string to format the
  902. postamble itself. This format string can contain these elements:
  903. %t stands for the title.
  904. %a stands for the author's name.
  905. %e stands for the author's email.
  906. %d stands for the date.
  907. %c will be replaced by information about Org/Emacs versions.
  908. %v will be replaced by `org-html-validation-link'.
  909. %T will be replace by the creation time of the file.
  910. If you need to use a \"%\" character, you need to escape it
  911. like that: \"%%\"."
  912. :group 'org-export-html
  913. :type '(alist :key-type (string :tag "Language")
  914. :value-type (string :tag "Format string")))
  915. (defcustom org-html-validation-link
  916. "<a href=\"http://validator.w3.org/check?uri=referer\">Validate XHTML 1.0</a>"
  917. "Link to HTML validation service."
  918. :group 'org-export-html
  919. :type 'string)
  920. (defcustom org-html-creator-string
  921. (format "Generated by <a href=\"http://orgmode.org\">Org</a> mode %s in <a href=\"http://www.gnu.org/software/emacs/\">Emacs</a> %s."
  922. (if (fboundp 'org-version) (org-version) "(Unknown)")
  923. emacs-version)
  924. "String to insert at the end of the HTML document."
  925. :group 'org-export-html
  926. :type '(string :tag "Creator string"))
  927. ;;;; Template :: Preamble
  928. (defcustom org-html-preamble t
  929. "Non-nil means insert a preamble in HTML export.
  930. When t, insert a string as defined by the formatting string in
  931. `org-html-preamble-format'. When set to a string, use this
  932. formatting string instead (see `org-html-postamble-format' for an
  933. example of such a formatting string).
  934. When set to a function, apply this function and insert the
  935. returned string. The function takes the property list of export
  936. options as its only argument.
  937. Setting :html-preamble in publishing projects will take
  938. precedence over this variable."
  939. :group 'org-export-html
  940. :type '(choice (const :tag "No preamble" nil)
  941. (const :tag "Default preamble" t)
  942. (string :tag "Custom formatting string")
  943. (function :tag "Function (must return a string)")))
  944. (defcustom org-html-preamble-format '(("en" ""))
  945. "Alist of languages and format strings for the HTML preamble.
  946. The first element of each list is the language code, as used for
  947. the #+LANGUAGE keyword.
  948. The second element of each list is a format string to format the
  949. preamble itself. This format string can contain these elements:
  950. %t stands for the title.
  951. %a stands for the author's name.
  952. %e stands for the author's email.
  953. %d stands for the date.
  954. %c will be replaced by information about Org/Emacs versions.
  955. %v will be replaced by `org-html-validation-link'.
  956. %T will be replace by the creation time of the file.
  957. If you need to use a \"%\" character, you need to escape it
  958. like that: \"%%\".
  959. See the default value of `org-html-postamble-format' for an
  960. example."
  961. :group 'org-export-html
  962. :type '(alist :key-type (string :tag "Language")
  963. :value-type (string :tag "Format string")))
  964. (defcustom org-html-link-up ""
  965. "Where should the \"UP\" link of exported HTML pages lead?"
  966. :group 'org-export-html
  967. :type '(string :tag "File or URL"))
  968. (defcustom org-html-link-home ""
  969. "Where should the \"HOME\" link of exported HTML pages lead?"
  970. :group 'org-export-html
  971. :type '(string :tag "File or URL"))
  972. (defcustom org-html-home/up-format
  973. "<div id=\"org-div-home-and-up\">
  974. <a accesskey=\"h\" href=\"%s\"> UP </a>
  975. |
  976. <a accesskey=\"H\" href=\"%s\"> HOME </a>
  977. </div>"
  978. "Snippet used to insert the HOME and UP links.
  979. This is a format string, the first %s will receive the UP link,
  980. the second the HOME link. If both `org-html-link-up' and
  981. `org-html-link-home' are empty, the entire snippet will be
  982. ignored."
  983. :group 'org-export-html
  984. :type 'string)
  985. ;;;; Template :: Scripts
  986. (define-obsolete-variable-alias
  987. 'org-html-style-include-scripts 'org-html-head-include-scripts "24.4")
  988. (defcustom org-html-head-include-scripts t
  989. "Non-nil means include the JavaScript snippets in exported HTML files.
  990. The actual script is defined in `org-html-scripts' and should
  991. not be modified."
  992. :group 'org-export-html
  993. :version "24.4"
  994. :package-version '(Org . "8.0")
  995. :type 'boolean)
  996. ;;;; Template :: Styles
  997. (define-obsolete-variable-alias
  998. 'org-html-style-include-default 'org-html-head-include-default-style "24.4")
  999. (defcustom org-html-head-include-default-style t
  1000. "Non-nil means include the default style in exported HTML files.
  1001. The actual style is defined in `org-html-style-default' and
  1002. should not be modified. Use `org-html-head' to use your own
  1003. style information."
  1004. :group 'org-export-html
  1005. :version "24.4"
  1006. :package-version '(Org . "8.0")
  1007. :type 'boolean)
  1008. ;;;###autoload
  1009. (put 'org-html-head-include-default-style 'safe-local-variable 'booleanp)
  1010. (define-obsolete-variable-alias 'org-html-style 'org-html-head "24.4")
  1011. (defcustom org-html-head ""
  1012. "Org-wide head definitions for exported HTML files.
  1013. This variable can contain the full HTML structure to provide a
  1014. style, including the surrounding HTML tags. You can consider
  1015. including definitions for the following classes: title, todo,
  1016. done, timestamp, timestamp-kwd, tag, target.
  1017. For example, a valid value would be:
  1018. <style type=\"text/css\">
  1019. <![CDATA[
  1020. p { font-weight: normal; color: gray; }
  1021. h1 { color: black; }
  1022. .title { text-align: center; }
  1023. .todo, .timestamp-kwd { color: red; }
  1024. .done { color: green; }
  1025. ]]>
  1026. </style>
  1027. If you want to refer to an external style, use something like
  1028. <link rel=\"stylesheet\" type=\"text/css\" href=\"mystyles.css\" />
  1029. As the value of this option simply gets inserted into the HTML
  1030. <head> header, you can use it to add any arbitrary text to the
  1031. header.
  1032. You can set this on a per-file basis using #+HTML_HEAD:,
  1033. or for publication projects using the :html-head property."
  1034. :group 'org-export-html
  1035. :version "24.4"
  1036. :package-version '(Org . "8.0")
  1037. :type 'string)
  1038. ;;;###autoload
  1039. (put 'org-html-head 'safe-local-variable 'stringp)
  1040. (defcustom org-html-head-extra ""
  1041. "More head information to add in the HTML output.
  1042. You can set this on a per-file basis using #+HTML_HEAD_EXTRA:,
  1043. or for publication projects using the :html-head-extra property."
  1044. :group 'org-export-html
  1045. :version "24.4"
  1046. :package-version '(Org . "8.0")
  1047. :type 'string)
  1048. ;;;###autoload
  1049. (put 'org-html-head-extra 'safe-local-variable 'stringp)
  1050. ;;;; Todos
  1051. (defcustom org-html-todo-kwd-class-prefix ""
  1052. "Prefix to class names for TODO keywords.
  1053. Each TODO keyword gets a class given by the keyword itself, with this prefix.
  1054. The default prefix is empty because it is nice to just use the keyword
  1055. as a class name. But if you get into conflicts with other, existing
  1056. CSS classes, then this prefix can be very useful."
  1057. :group 'org-export-html
  1058. :type 'string)
  1059. ;;; Internal Functions
  1060. (defun org-html-format-inline-image (src &optional
  1061. caption label attr standalone-p)
  1062. "Format an inline image from SRC.
  1063. CAPTION, LABEL and ATTR are optional arguments providing the
  1064. caption, the label and the attribute of the image.
  1065. When STANDALONE-P is t, wrap the <img.../> into a <div>...</div>."
  1066. (let* ((id (if (not label) ""
  1067. (format " id=\"%s\"" (org-export-solidify-link-text label))))
  1068. (attr (concat attr
  1069. (cond
  1070. ((string-match "\\<alt=" (or attr "")) "")
  1071. ((string-match "^ltxpng/" src)
  1072. (format " alt=\"%s\""
  1073. (org-html-encode-plain-text
  1074. (org-find-text-property-in-string
  1075. 'org-latex-src src))))
  1076. (t (format " alt=\"%s\""
  1077. (file-name-nondirectory src)))))))
  1078. (cond
  1079. (standalone-p
  1080. (let ((img (format "<img src=\"%s\" %s/>" src attr)))
  1081. (format "\n<div%s class=\"figure\">%s%s\n</div>"
  1082. id (format "\n<p>%s</p>" img)
  1083. (if (and caption (not (string= caption "")))
  1084. (format "\n<p>%s</p>" caption) ""))))
  1085. (t (format "<img src=\"%s\" %s/>" src (concat attr id))))))
  1086. (defun org-html--textarea-block (element)
  1087. "Transcode ELEMENT into a textarea block.
  1088. ELEMENT is either a src block or an example block."
  1089. (let* ((code (car (org-export-unravel-code element)))
  1090. (attr (org-export-read-attribute :attr_html element)))
  1091. (format "<p>\n<textarea cols=\"%s\" rows=\"%s\">\n%s</textarea>\n</p>"
  1092. (or (plist-get attr :width) 80)
  1093. (or (plist-get attr :height) (org-count-lines code))
  1094. code)))
  1095. ;;;; Bibliography
  1096. (defun org-html-bibliography ()
  1097. "Find bibliography, cut it out and return it."
  1098. (catch 'exit
  1099. (let (beg end (cnt 1) bib)
  1100. (save-excursion
  1101. (goto-char (point-min))
  1102. (when (re-search-forward
  1103. "^[ \t]*<div \\(id\\|class\\)=\"bibliography\"" nil t)
  1104. (setq beg (match-beginning 0))
  1105. (while (re-search-forward "</?div\\>" nil t)
  1106. (setq cnt (+ cnt (if (string= (match-string 0) "<div") +1 -1)))
  1107. (when (= cnt 0)
  1108. (and (looking-at ">") (forward-char 1))
  1109. (setq bib (buffer-substring beg (point)))
  1110. (delete-region beg (point))
  1111. (throw 'exit bib))))
  1112. nil))))
  1113. ;;;; Table
  1114. (defun org-html-splice-attributes (tag attributes)
  1115. "Return a HTML TAG edited wrt ATTRIBUTES."
  1116. (if (not attributes)
  1117. tag
  1118. (let (oldatt newatt)
  1119. (setq oldatt (org-extract-attributes-from-string tag)
  1120. tag (pop oldatt)
  1121. newatt (cdr (org-extract-attributes-from-string attributes)))
  1122. (while newatt
  1123. (setq oldatt (plist-put oldatt (pop newatt) (pop newatt))))
  1124. (if (string-match ">" tag)
  1125. (setq tag
  1126. (replace-match (concat (org-attributes-to-string oldatt) ">")
  1127. t t tag)))
  1128. tag)))
  1129. (defun org-export-splice-style (style extra)
  1130. "Return STYLE updated wrt EXTRA."
  1131. (if (and (stringp extra)
  1132. (string-match "\\S-" extra)
  1133. (string-match "</style>" style))
  1134. (concat (substring style 0 (match-beginning 0))
  1135. "\n" extra "\n"
  1136. (substring style (match-beginning 0)))
  1137. style))
  1138. (defun org-html-htmlize-region-for-paste (beg end)
  1139. "Convert the region between BEG and END to HTML, using htmlize.el.
  1140. This is much like `htmlize-region-for-paste', only that it uses
  1141. the settings define in the org-... variables."
  1142. (let* ((htmlize-output-type org-html-htmlize-output-type)
  1143. (htmlize-css-name-prefix org-html-htmlize-font-prefix)
  1144. (htmlbuf (htmlize-region beg end)))
  1145. (unwind-protect
  1146. (with-current-buffer htmlbuf
  1147. (buffer-substring (plist-get htmlize-buffer-places 'content-start)
  1148. (plist-get htmlize-buffer-places 'content-end)))
  1149. (kill-buffer htmlbuf))))
  1150. ;;;###autoload
  1151. (defun org-html-htmlize-generate-css ()
  1152. "Create the CSS for all font definitions in the current Emacs session.
  1153. Use this to create face definitions in your CSS style file that can then
  1154. be used by code snippets transformed by htmlize.
  1155. This command just produces a buffer that contains class definitions for all
  1156. faces used in the current Emacs session. You can copy and paste the ones you
  1157. need into your CSS file.
  1158. If you then set `org-html-htmlize-output-type' to `css', calls
  1159. to the function `org-html-htmlize-region-for-paste' will
  1160. produce code that uses these same face definitions."
  1161. (interactive)
  1162. (require 'htmlize)
  1163. (and (get-buffer "*html*") (kill-buffer "*html*"))
  1164. (with-temp-buffer
  1165. (let ((fl (face-list))
  1166. (htmlize-css-name-prefix "org-")
  1167. (htmlize-output-type 'css)
  1168. f i)
  1169. (while (setq f (pop fl)
  1170. i (and f (face-attribute f :inherit)))
  1171. (when (and (symbolp f) (or (not i) (not (listp i))))
  1172. (insert (org-add-props (copy-sequence "1") nil 'face f))))
  1173. (htmlize-region (point-min) (point-max))))
  1174. (org-pop-to-buffer-same-window "*html*")
  1175. (goto-char (point-min))
  1176. (if (re-search-forward "<style" nil t)
  1177. (delete-region (point-min) (match-beginning 0)))
  1178. (if (re-search-forward "</style>" nil t)
  1179. (delete-region (1+ (match-end 0)) (point-max)))
  1180. (beginning-of-line 1)
  1181. (if (looking-at " +") (replace-match ""))
  1182. (goto-char (point-min)))
  1183. (defun org-html--make-string (n string)
  1184. "Build a string by concatenating N times STRING."
  1185. (let (out) (dotimes (i n out) (setq out (concat string out)))))
  1186. (defun org-html-fix-class-name (kwd) ; audit callers of this function
  1187. "Turn todo keyword KWD into a valid class name.
  1188. Replaces invalid characters with \"_\"."
  1189. (save-match-data
  1190. (while (string-match "[^a-zA-Z0-9_]" kwd)
  1191. (setq kwd (replace-match "_" t t kwd))))
  1192. kwd)
  1193. (defun org-html-format-footnote-reference (n def refcnt)
  1194. "Format footnote reference N with definition DEF into HTML."
  1195. (let ((extra (if (= refcnt 1) "" (format ".%d" refcnt))))
  1196. (format org-html-footnote-format
  1197. (let* ((id (format "fnr.%s%s" n extra))
  1198. (href (format " href=\"#fn.%s\"" n))
  1199. (attributes (concat " class=\"footref\"" href)))
  1200. (org-html--anchor id n attributes)))))
  1201. (defun org-html-format-footnotes-section (section-name definitions)
  1202. "Format footnotes section SECTION-NAME."
  1203. (if (not definitions) ""
  1204. (format org-html-footnotes-section section-name definitions)))
  1205. (defun org-html-format-footnote-definition (fn)
  1206. "Format the footnote definition FN."
  1207. (let ((n (car fn)) (def (cdr fn)))
  1208. (format
  1209. "<div class=\"footdef\">%s %s</div>\n"
  1210. (format org-html-footnote-format
  1211. (let* ((id (format "fn.%s" n))
  1212. (href (format " href=\"#fnr.%s\"" n))
  1213. (attributes (concat " class=\"footnum\"" href)))
  1214. (org-html--anchor id n attributes)))
  1215. def)))
  1216. (defun org-html-footnote-section (info)
  1217. "Format the footnote section.
  1218. INFO is a plist used as a communication channel."
  1219. (let* ((fn-alist (org-export-collect-footnote-definitions
  1220. (plist-get info :parse-tree) info))
  1221. (fn-alist
  1222. (loop for (n type raw) in fn-alist collect
  1223. (cons n (if (eq (org-element-type raw) 'org-data)
  1224. (org-trim (org-export-data raw info))
  1225. (format "<p>%s</p>"
  1226. (org-trim (org-export-data raw info))))))))
  1227. (when fn-alist
  1228. (org-html-format-footnotes-section
  1229. (org-html--translate "Footnotes" info)
  1230. (format
  1231. "\n%s\n"
  1232. (mapconcat 'org-html-format-footnote-definition fn-alist "\n"))))))
  1233. ;;; Template
  1234. (defun org-html--build-meta-info (info)
  1235. "Return meta tags for exported document.
  1236. INFO is a plist used as a communication channel."
  1237. (let* ((title (org-export-data (plist-get info :title) info))
  1238. (author (and (plist-get info :with-author)
  1239. (let ((auth (plist-get info :author)))
  1240. (and auth (org-export-data auth info)))))
  1241. (description (plist-get info :description))
  1242. (keywords (plist-get info :keywords)))
  1243. (concat
  1244. (format "<title>%s</title>\n" title)
  1245. (format
  1246. (when :time-stamp-file
  1247. (format-time-string
  1248. (concat "<!-- " org-html--timestamp-format " -->\n")))
  1249. "<meta http-equiv=\"Content-Type\" content=\"text/html;charset=%s\"/>\n"
  1250. (or (and org-html-coding-system
  1251. (fboundp 'coding-system-get)
  1252. (coding-system-get org-html-coding-system 'mime-charset))
  1253. "iso-8859-1"))
  1254. (format "<meta name=\"generator\" content=\"Org-mode\"/>\n")
  1255. (and author (format "<meta name=\"author\" content=\"%s\"/>\n" author))
  1256. (and description
  1257. (format "<meta name=\"description\" content=\"%s\"/>\n" description))
  1258. (and keywords
  1259. (format "<meta name=\"keywords\" content=\"%s\"/>\n" keywords)))))
  1260. (defun org-html--build-head (info)
  1261. "Return information for the <head>..</head> of the HTML output.
  1262. INFO is a plist used as a communication channel."
  1263. (org-element-normalize-string
  1264. (concat
  1265. (when (plist-get info :html-head-include-default-style)
  1266. (org-element-normalize-string org-html-style-default))
  1267. (org-element-normalize-string (plist-get info :html-head))
  1268. (org-element-normalize-string (plist-get info :html-head-extra))
  1269. (when (and (plist-get info :html-htmlized-css-url)
  1270. (eq org-html-htmlize-output-type 'css))
  1271. (format "<link rel=\"stylesheet\" href=\"%s\" type=\"text/css\" />\n"
  1272. (plist-get info :html-htmlized-css-url)))
  1273. (when (plist-get info :html-head-include-scripts) org-html-scripts))))
  1274. (defun org-html--build-mathjax-config (info)
  1275. "Insert the user setup into the mathjax template.
  1276. INFO is a plist used as a communication channel."
  1277. (when (and (memq (plist-get info :with-latex) '(mathjax t))
  1278. (org-element-map (plist-get info :parse-tree)
  1279. '(latex-fragment latex-environment) 'identity info t))
  1280. (let ((template org-html-mathjax-template)
  1281. (options org-html-mathjax-options)
  1282. (in-buffer (or (plist-get info :html-mathjax) ""))
  1283. name val (yes " ") (no "// ") x)
  1284. (mapc
  1285. (lambda (e)
  1286. (setq name (car e) val (nth 1 e))
  1287. (if (string-match (concat "\\<" (symbol-name name) ":") in-buffer)
  1288. (setq val (car (read-from-string
  1289. (substring in-buffer (match-end 0))))))
  1290. (if (not (stringp val)) (setq val (format "%s" val)))
  1291. (if (string-match (concat "%" (upcase (symbol-name name))) template)
  1292. (setq template (replace-match val t t template))))
  1293. options)
  1294. (setq val (nth 1 (assq 'mathml options)))
  1295. (if (string-match (concat "\\<mathml:") in-buffer)
  1296. (setq val (car (read-from-string
  1297. (substring in-buffer (match-end 0))))))
  1298. ;; Exchange prefixes depending on mathml setting.
  1299. (if (not val) (setq x yes yes no no x))
  1300. ;; Replace cookies to turn on or off the config/jax lines.
  1301. (if (string-match ":MMLYES:" template)
  1302. (setq template (replace-match yes t t template)))
  1303. (if (string-match ":MMLNO:" template)
  1304. (setq template (replace-match no t t template)))
  1305. ;; Return the modified template.
  1306. (org-element-normalize-string template))))
  1307. (defun org-html-format-spec (info)
  1308. "Return format specification for elements that can be
  1309. used in the preamble or postamble."
  1310. `((?t . ,(org-export-data (plist-get info :title) info))
  1311. (?d . ,(org-export-data (plist-get info :date) info))
  1312. (?T . ,(format-time-string org-html--timestamp-format))
  1313. (?a . ,(org-export-data (plist-get info :author) info))
  1314. (?e . ,(mapconcat
  1315. (lambda (e)
  1316. (format "<a href=\"mailto:%s\">%s</a>" e e))
  1317. (split-string (plist-get info :email) ",+ *")
  1318. ", "))
  1319. (?c . ,(plist-get info :creator))
  1320. (?v . ,(or org-html-validation-link ""))))
  1321. (defun org-html--build-pre/postamble (type info)
  1322. "Return document preamble or postamble as a string, or nil.
  1323. TYPE is either 'preamble or 'postamble, INFO is a plist used as a
  1324. communication channel."
  1325. (let ((section (plist-get info (intern (format ":html-%s" type))))
  1326. (spec (org-html-format-spec info)))
  1327. (when section
  1328. (let ((section-contents
  1329. (if (functionp section) (funcall section info)
  1330. (cond
  1331. ((stringp section) (format-spec section spec))
  1332. ((eq section 'auto)
  1333. (let ((date (cdr (assq ?d spec)))
  1334. (author (cdr (assq ?a spec)))
  1335. (email (cdr (assq ?e spec)))
  1336. (creator (cdr (assq ?c spec)))
  1337. (timestamp (cdr (assq ?T spec)))
  1338. (validation-link (cdr (assq ?v spec))))
  1339. (concat
  1340. (when (and (plist-get info :with-date)
  1341. (org-string-nw-p date))
  1342. (format "<p class=\"date\">%s: %s</p>\n"
  1343. (org-html--translate "Date" info)
  1344. date))
  1345. (when (and (plist-get info :with-author)
  1346. (org-string-nw-p author))
  1347. (format "<p class=\"author\">%s: %s</p>\n"
  1348. (org-html--translate "Author" info)
  1349. author))
  1350. (when (and (plist-get info :with-email)
  1351. (org-string-nw-p email))
  1352. (format "<p class=\"email\">%s: %s</p>\n"
  1353. (org-html--translate "Email" info)
  1354. email))
  1355. (when (plist-get info :time-stamp-file)
  1356. (format
  1357. "<p class=\"date\">%s: %s</p>\n"
  1358. (org-html--translate "Created" info)
  1359. (format-time-string org-html--timestamp-format)))
  1360. (when (plist-get info :with-creator)
  1361. (format "<p class=\"creator\">%s</p>\n"
  1362. creator))
  1363. (format "<p class=\"xhtml-validation\">%s</p>\n"
  1364. validation-link))))
  1365. (t (format-spec
  1366. (or (cadr (assoc
  1367. (plist-get info :language)
  1368. (eval (intern
  1369. (format "org-html-%s-format" type)))))
  1370. (cadr
  1371. (assoc
  1372. "en"
  1373. (eval
  1374. (intern (format "org-html-%s-format" type))))))
  1375. spec))))))
  1376. (when (org-string-nw-p section-contents)
  1377. (concat
  1378. (format "<%s id=\"%s\" class=\"%s\">\n"
  1379. (nth 1 (assq type org-html-divs))
  1380. (nth 2 (assq type org-html-divs))
  1381. org-html--pre/postamble-class)
  1382. (org-element-normalize-string section-contents)
  1383. (format "</%s>\n" (nth 1 (assq type org-html-divs)))))))))
  1384. (defun org-html-inner-template (contents info)
  1385. "Return body of document string after HTML conversion.
  1386. CONTENTS is the transcoded contents string. INFO is a plist
  1387. holding export options."
  1388. (concat
  1389. ;; Table of contents.
  1390. (let ((depth (plist-get info :with-toc)))
  1391. (when depth (org-html-toc depth info)))
  1392. ;; Document contents.
  1393. contents
  1394. ;; Footnotes section.
  1395. (org-html-footnote-section info)
  1396. ;; Bibliography.
  1397. (org-html-bibliography)))
  1398. (defun org-html-template (contents info)
  1399. "Return complete document string after HTML conversion.
  1400. CONTENTS is the transcoded contents string. INFO is a plist
  1401. holding export options."
  1402. (concat
  1403. (format
  1404. (or (and (stringp org-html-xml-declaration)
  1405. org-html-xml-declaration)
  1406. (cdr (assoc (plist-get info :html-extension)
  1407. org-html-xml-declaration))
  1408. (cdr (assoc "html" org-html-xml-declaration))
  1409. "")
  1410. (or (and org-html-coding-system
  1411. (fboundp 'coding-system-get)
  1412. (coding-system-get org-html-coding-system 'mime-charset))
  1413. "iso-8859-1"))
  1414. "\n"
  1415. (plist-get info :html-doctype)
  1416. "\n"
  1417. (format "<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"%s\" xml:lang=\"%s\">\n"
  1418. (plist-get info :language) (plist-get info :language))
  1419. "<head>\n"
  1420. (org-html--build-meta-info info)
  1421. (org-html--build-head info)
  1422. (org-html--build-mathjax-config info)
  1423. "</head>\n"
  1424. "<body>\n"
  1425. (let ((link-up (org-trim (plist-get info :html-link-up)))
  1426. (link-home (org-trim (plist-get info :html-link-home))))
  1427. (unless (and (string= link-up "") (string= link-up ""))
  1428. (format org-html-home/up-format
  1429. (or link-up link-home)
  1430. (or link-home link-up))))
  1431. ;; Preamble.
  1432. (org-html--build-pre/postamble 'preamble info)
  1433. ;; Document contents.
  1434. (format "<%s id=\"%s\">\n"
  1435. (nth 1 (assq 'content org-html-divs))
  1436. (nth 2 (assq 'content org-html-divs)))
  1437. ;; Document title.
  1438. (let ((title (plist-get info :title)))
  1439. (format "<h1 class=\"title\">%s</h1>\n" (org-export-data (or title "") info)))
  1440. contents
  1441. (format "</%s>\n"
  1442. (nth 1 (assq 'content org-html-divs)))
  1443. ;; Postamble.
  1444. (org-html--build-pre/postamble 'postamble info)
  1445. ;; Closing document.
  1446. "</body>\n</html>"))
  1447. (defun org-html--translate (s info)
  1448. "Translate string S according to specified language.
  1449. INFO is a plist used as a communication channel."
  1450. (org-export-translate s :html info))
  1451. ;;;; Anchor
  1452. (defun org-html--anchor (&optional id desc attributes)
  1453. "Format a HTML anchor."
  1454. (let* ((name (and org-html-allow-name-attribute-in-anchors id))
  1455. (attributes (concat (and id (format " id=\"%s\"" id))
  1456. (and name (format " name=\"%s\"" name))
  1457. attributes)))
  1458. (format "<a%s>%s</a>" attributes (or desc ""))))
  1459. ;;;; Todo
  1460. (defun org-html--todo (todo)
  1461. "Format TODO keywords into HTML."
  1462. (when todo
  1463. (format "<span class=\"%s %s%s\">%s</span>"
  1464. (if (member todo org-done-keywords) "done" "todo")
  1465. org-html-todo-kwd-class-prefix (org-html-fix-class-name todo)
  1466. todo)))
  1467. ;;;; Tags
  1468. (defun org-html--tags (tags)
  1469. "Format TAGS into HTML."
  1470. (when tags
  1471. (format "<span class=\"tag\">%s</span>"
  1472. (mapconcat
  1473. (lambda (tag)
  1474. (format "<span class=\"%s\">%s</span>"
  1475. (concat org-html-tag-class-prefix
  1476. (org-html-fix-class-name tag))
  1477. tag))
  1478. tags "&#xa0;"))))
  1479. ;;;; Headline
  1480. (defun* org-html-format-headline
  1481. (todo todo-type priority text tags
  1482. &key level section-number headline-label &allow-other-keys)
  1483. "Format a headline in HTML."
  1484. (let ((section-number
  1485. (when section-number
  1486. (format "<span class=\"section-number-%d\">%s</span> "
  1487. level section-number)))
  1488. (todo (org-html--todo todo))
  1489. (tags (org-html--tags tags)))
  1490. (concat section-number todo (and todo " ") text
  1491. (and tags "&#xa0;&#xa0;&#xa0;") tags)))
  1492. ;;;; Src Code
  1493. (defun org-html-fontify-code (code lang)
  1494. "Color CODE with htmlize library.
  1495. CODE is a string representing the source code to colorize. LANG
  1496. is the language used for CODE, as a string, or nil."
  1497. (when code
  1498. (cond
  1499. ;; Case 1: No lang. Possibly an example block.
  1500. ((not lang)
  1501. ;; Simple transcoding.
  1502. (org-html-encode-plain-text code))
  1503. ;; Case 2: No htmlize or an inferior version of htmlize
  1504. ((not (and (require 'htmlize nil t) (fboundp 'htmlize-region-for-paste)))
  1505. ;; Emit a warning.
  1506. (message "Cannot fontify src block (htmlize.el >= 1.34 required)")
  1507. ;; Simple transcoding.
  1508. (org-html-encode-plain-text code))
  1509. (t
  1510. ;; Map language
  1511. (setq lang (or (assoc-default lang org-src-lang-modes) lang))
  1512. (let* ((lang-mode (and lang (intern (format "%s-mode" lang)))))
  1513. (cond
  1514. ;; Case 1: Language is not associated with any Emacs mode
  1515. ((not (functionp lang-mode))
  1516. ;; Simple transcoding.
  1517. (org-html-encode-plain-text code))
  1518. ;; Case 2: Default. Fontify code.
  1519. (t
  1520. ;; htmlize
  1521. (setq code (with-temp-buffer
  1522. ;; Switch to language-specific mode.
  1523. (funcall lang-mode)
  1524. (insert code)
  1525. ;; Fontify buffer.
  1526. (font-lock-fontify-buffer)
  1527. ;; Remove formatting on newline characters.
  1528. (save-excursion
  1529. (let ((beg (point-min))
  1530. (end (point-max)))
  1531. (goto-char beg)
  1532. (while (progn (end-of-line) (< (point) end))
  1533. (put-text-property (point) (1+ (point)) 'face nil)
  1534. (forward-char 1))))
  1535. (org-src-mode)
  1536. (set-buffer-modified-p nil)
  1537. ;; Htmlize region.
  1538. (org-html-htmlize-region-for-paste
  1539. (point-min) (point-max))))
  1540. ;; Strip any enclosing <pre></pre> tags.
  1541. (let* ((beg (and (string-match "\\`<pre[^>]*>\n*" code) (match-end 0)))
  1542. (end (and beg (string-match "</pre>\\'" code))))
  1543. (if (and beg end) (substring code beg end) code)))))))))
  1544. (defun org-html-do-format-code
  1545. (code &optional lang refs retain-labels num-start)
  1546. "Format CODE string as source code.
  1547. Optional arguments LANG, REFS, RETAIN-LABELS and NUM-START are,
  1548. respectively, the language of the source code, as a string, an
  1549. alist between line numbers and references (as returned by
  1550. `org-export-unravel-code'), a boolean specifying if labels should
  1551. appear in the source code, and the number associated to the first
  1552. line of code."
  1553. (let* ((code-lines (org-split-string code "\n"))
  1554. (code-length (length code-lines))
  1555. (num-fmt
  1556. (and num-start
  1557. (format "%%%ds: "
  1558. (length (number-to-string (+ code-length num-start))))))
  1559. (code (org-html-fontify-code code lang)))
  1560. (org-export-format-code
  1561. code
  1562. (lambda (loc line-num ref)
  1563. (setq loc
  1564. (concat
  1565. ;; Add line number, if needed.
  1566. (when num-start
  1567. (format "<span class=\"linenr\">%s</span>"
  1568. (format num-fmt line-num)))
  1569. ;; Transcoded src line.
  1570. loc
  1571. ;; Add label, if needed.
  1572. (when (and ref retain-labels) (format " (%s)" ref))))
  1573. ;; Mark transcoded line as an anchor, if needed.
  1574. (if (not ref) loc
  1575. (format "<span id=\"coderef-%s\" class=\"coderef-off\">%s</span>"
  1576. ref loc)))
  1577. num-start refs)))
  1578. (defun org-html-format-code (element info)
  1579. "Format contents of ELEMENT as source code.
  1580. ELEMENT is either an example block or a src block. INFO is
  1581. a plist used as a communication channel."
  1582. (let* ((lang (org-element-property :language element))
  1583. ;; Extract code and references.
  1584. (code-info (org-export-unravel-code element))
  1585. (code (car code-info))
  1586. (refs (cdr code-info))
  1587. ;; Does the src block contain labels?
  1588. (retain-labels (org-element-property :retain-labels element))
  1589. ;; Does it have line numbers?
  1590. (num-start (case (org-element-property :number-lines element)
  1591. (continued (org-export-get-loc element info))
  1592. (new 0))))
  1593. (org-html-do-format-code code lang refs retain-labels num-start)))
  1594. ;;; Tables of Contents
  1595. (defun org-html-toc (depth info)
  1596. "Build a table of contents.
  1597. DEPTH is an integer specifying the depth of the table. INFO is a
  1598. plist used as a communication channel. Return the table of
  1599. contents as a string, or nil if it is empty."
  1600. (let ((toc-entries
  1601. (mapcar (lambda (headline)
  1602. (cons (org-html--format-toc-headline headline info)
  1603. (org-export-get-relative-level headline info)))
  1604. (org-export-collect-headlines info depth))))
  1605. (when toc-entries
  1606. (concat "<div id=\"table-of-contents\">\n"
  1607. (format "<h%d>%s</h%d>\n"
  1608. org-html-toplevel-hlevel
  1609. (org-html--translate "Table of Contents" info)
  1610. org-html-toplevel-hlevel)
  1611. "<div id=\"text-table-of-contents\">"
  1612. (org-html--toc-text toc-entries)
  1613. "</div>\n"
  1614. "</div>\n"))))
  1615. (defun org-html--toc-text (toc-entries)
  1616. "Return innards of a table of contents, as a string.
  1617. TOC-ENTRIES is an alist where key is an entry title, as a string,
  1618. and value is its relative level, as an integer."
  1619. (let* ((prev-level (1- (cdar toc-entries)))
  1620. (start-level prev-level))
  1621. (concat
  1622. (mapconcat
  1623. (lambda (entry)
  1624. (let ((headline (car entry))
  1625. (level (cdr entry)))
  1626. (concat
  1627. (let* ((cnt (- level prev-level))
  1628. (times (if (> cnt 0) (1- cnt) (- cnt)))
  1629. rtn)
  1630. (setq prev-level level)
  1631. (concat
  1632. (org-html--make-string
  1633. times (cond ((> cnt 0) "\n<ul>\n<li>")
  1634. ((< cnt 0) "</li>\n</ul>\n")))
  1635. (if (> cnt 0) "\n<ul>\n<li>" "</li>\n<li>")))
  1636. headline)))
  1637. toc-entries "")
  1638. (org-html--make-string (- prev-level start-level) "</li>\n</ul>\n"))))
  1639. (defun org-html--format-toc-headline (headline info)
  1640. "Return an appropriate table of contents entry for HEADLINE.
  1641. INFO is a plist used as a communication channel."
  1642. (let* ((headline-number (org-export-get-headline-number headline info))
  1643. (section-number
  1644. (and (not (org-export-low-level-p headline info))
  1645. (org-export-numbered-headline-p headline info)
  1646. (concat (mapconcat 'number-to-string headline-number ".") ". ")))
  1647. (tags (and (eq (plist-get info :with-tags) t)
  1648. (org-export-get-tags headline info))))
  1649. (format "<a href=\"#%s\">%s</a>"
  1650. ;; Label.
  1651. (org-export-solidify-link-text
  1652. (or (org-element-property :CUSTOM_ID headline)
  1653. (concat "sec-" (mapconcat 'number-to-string
  1654. headline-number "-"))))
  1655. ;; Body.
  1656. (concat section-number
  1657. (org-export-data-with-translations
  1658. (org-export-get-alt-title headline info)
  1659. ;; Ignore any footnote-reference, link,
  1660. ;; radio-target and target in table of contents.
  1661. (append
  1662. '((footnote-reference . ignore)
  1663. (link . (lambda (link desc i) desc))
  1664. (radio-target . (lambda (radio desc i) desc))
  1665. (target . ignore))
  1666. (org-export-backend-translate-table 'html))
  1667. info)
  1668. (and tags "&#xa0;&#xa0;&#xa0;") (org-html--tags tags)))))
  1669. (defun org-html-list-of-listings (info)
  1670. "Build a list of listings.
  1671. INFO is a plist used as a communication channel. Return the list
  1672. of listings as a string, or nil if it is empty."
  1673. (let ((lol-entries (org-export-collect-listings info)))
  1674. (when lol-entries
  1675. (concat "<div id=\"list-of-listings\">\n"
  1676. (format "<h%d>%s</h%d>\n"
  1677. org-html-toplevel-hlevel
  1678. (org-html--translate "List of Listings" info)
  1679. org-html-toplevel-hlevel)
  1680. "<div id=\"text-list-of-listings\">\n<ul>\n"
  1681. (let ((count 0)
  1682. (initial-fmt (org-html--translate "Listing %d:" info)))
  1683. (mapconcat
  1684. (lambda (entry)
  1685. (let ((label (org-element-property :name entry))
  1686. (title (org-trim
  1687. (org-export-data
  1688. (or (org-export-get-caption entry t)
  1689. (org-export-get-caption entry))
  1690. info))))
  1691. (concat
  1692. "<li>"
  1693. (if (not label)
  1694. (concat (format initial-fmt (incf count)) " " title)
  1695. (format "<a href=\"#%s\">%s %s</a>"
  1696. (org-export-solidify-link-text label)
  1697. (format initial-fmt (incf count))
  1698. title))
  1699. "</li>")))
  1700. lol-entries "\n"))
  1701. "\n</ul>\n</div>\n</div>"))))
  1702. (defun org-html-list-of-tables (info)
  1703. "Build a list of tables.
  1704. INFO is a plist used as a communication channel. Return the list
  1705. of tables as a string, or nil if it is empty."
  1706. (let ((lol-entries (org-export-collect-tables info)))
  1707. (when lol-entries
  1708. (concat "<div id=\"list-of-tables\">\n"
  1709. (format "<h%d>%s</h%d>\n"
  1710. org-html-toplevel-hlevel
  1711. (org-html--translate "List of Tables" info)
  1712. org-html-toplevel-hlevel)
  1713. "<div id=\"text-list-of-tables\">\n<ul>\n"
  1714. (let ((count 0)
  1715. (initial-fmt (org-html--translate "Table %d:" info)))
  1716. (mapconcat
  1717. (lambda (entry)
  1718. (let ((label (org-element-property :name entry))
  1719. (title (org-trim
  1720. (org-export-data
  1721. (or (org-export-get-caption entry t)
  1722. (org-export-get-caption entry))
  1723. info))))
  1724. (concat
  1725. "<li>"
  1726. (if (not label)
  1727. (concat (format initial-fmt (incf count)) " " title)
  1728. (format "<a href=\"#%s\">%s %s</a>"
  1729. (org-export-solidify-link-text label)
  1730. (format initial-fmt (incf count))
  1731. title))
  1732. "</li>")))
  1733. lol-entries "\n"))
  1734. "\n</ul>\n</div>\n</div>"))))
  1735. ;;; Transcode Functions
  1736. ;;;; Bold
  1737. (defun org-html-bold (bold contents info)
  1738. "Transcode BOLD from Org to HTML.
  1739. CONTENTS is the text with bold markup. INFO is a plist holding
  1740. contextual information."
  1741. (format (or (cdr (assq 'bold org-html-text-markup-alist)) "%s")
  1742. contents))
  1743. ;;;; Center Block
  1744. (defun org-html-center-block (center-block contents info)
  1745. "Transcode a CENTER-BLOCK element from Org to HTML.
  1746. CONTENTS holds the contents of the block. INFO is a plist
  1747. holding contextual information."
  1748. (format "<div class=\"center\">\n%s</div>" contents))
  1749. ;;;; Clock
  1750. (defun org-html-clock (clock contents info)
  1751. "Transcode a CLOCK element from Org to HTML.
  1752. CONTENTS is nil. INFO is a plist used as a communication
  1753. channel."
  1754. (format "<p>
  1755. <span class=\"timestamp-wrapper\">
  1756. <span class=\"timestamp-kwd\">%s</span> <span class=\"timestamp\">%s</span>%s
  1757. </span>
  1758. </p>"
  1759. org-clock-string
  1760. (org-translate-time
  1761. (org-element-property :raw-value
  1762. (org-element-property :value clock)))
  1763. (let ((time (org-element-property :duration clock)))
  1764. (and time (format " <span class=\"timestamp\">(%s)</span>" time)))))
  1765. ;;;; Code
  1766. (defun org-html-code (code contents info)
  1767. "Transcode CODE from Org to HTML.
  1768. CONTENTS is nil. INFO is a plist holding contextual
  1769. information."
  1770. (format (or (cdr (assq 'code org-html-text-markup-alist)) "%s")
  1771. (org-html-plain-text (org-element-property :value code) info)))
  1772. ;;;; Drawer
  1773. (defun org-html-drawer (drawer contents info)
  1774. "Transcode a DRAWER element from Org to HTML.
  1775. CONTENTS holds the contents of the block. INFO is a plist
  1776. holding contextual information."
  1777. (if (functionp org-html-format-drawer-function)
  1778. (funcall org-html-format-drawer-function
  1779. (org-element-property :drawer-name drawer)
  1780. contents)
  1781. ;; If there's no user defined function: simply
  1782. ;; display contents of the drawer.
  1783. contents))
  1784. ;;;; Dynamic Block
  1785. (defun org-html-dynamic-block (dynamic-block contents info)
  1786. "Transcode a DYNAMIC-BLOCK element from Org to HTML.
  1787. CONTENTS holds the contents of the block. INFO is a plist
  1788. holding contextual information. See `org-export-data'."
  1789. contents)
  1790. ;;;; Entity
  1791. (defun org-html-entity (entity contents info)
  1792. "Transcode an ENTITY object from Org to HTML.
  1793. CONTENTS are the definition itself. INFO is a plist holding
  1794. contextual information."
  1795. (org-element-property :html entity))
  1796. ;;;; Example Block
  1797. (defun org-html-example-block (example-block contents info)
  1798. "Transcode a EXAMPLE-BLOCK element from Org to HTML.
  1799. CONTENTS is nil. INFO is a plist holding contextual
  1800. information."
  1801. (if (org-export-read-attribute :attr_html example-block :textarea)
  1802. (org-html--textarea-block example-block)
  1803. (format "<pre class=\"example\">\n%s</pre>"
  1804. (org-html-format-code example-block info))))
  1805. ;;;; Export Snippet
  1806. (defun org-html-export-snippet (export-snippet contents info)
  1807. "Transcode a EXPORT-SNIPPET object from Org to HTML.
  1808. CONTENTS is nil. INFO is a plist holding contextual
  1809. information."
  1810. (when (eq (org-export-snippet-backend export-snippet) 'html)
  1811. (org-element-property :value export-snippet)))
  1812. ;;;; Export Block
  1813. (defun org-html-export-block (export-block contents info)
  1814. "Transcode a EXPORT-BLOCK element from Org to HTML.
  1815. CONTENTS is nil. INFO is a plist holding contextual information."
  1816. (when (string= (org-element-property :type export-block) "HTML")
  1817. (org-remove-indentation (org-element-property :value export-block))))
  1818. ;;;; Fixed Width
  1819. (defun org-html-fixed-width (fixed-width contents info)
  1820. "Transcode a FIXED-WIDTH element from Org to HTML.
  1821. CONTENTS is nil. INFO is a plist holding contextual information."
  1822. (format "<pre class=\"example\">\n%s</pre>"
  1823. (org-html-do-format-code
  1824. (org-remove-indentation
  1825. (org-element-property :value fixed-width)))))
  1826. ;;;; Footnote Reference
  1827. (defun org-html-footnote-reference (footnote-reference contents info)
  1828. "Transcode a FOOTNOTE-REFERENCE element from Org to HTML.
  1829. CONTENTS is nil. INFO is a plist holding contextual information."
  1830. (concat
  1831. ;; Insert separator between two footnotes in a row.
  1832. (let ((prev (org-export-get-previous-element footnote-reference info)))
  1833. (when (eq (org-element-type prev) 'footnote-reference)
  1834. org-html-footnote-separator))
  1835. (cond
  1836. ((not (org-export-footnote-first-reference-p footnote-reference info))
  1837. (org-html-format-footnote-reference
  1838. (org-export-get-footnote-number footnote-reference info)
  1839. "IGNORED" 100))
  1840. ;; Inline definitions are secondary strings.
  1841. ((eq (org-element-property :type footnote-reference) 'inline)
  1842. (org-html-format-footnote-reference
  1843. (org-export-get-footnote-number footnote-reference info)
  1844. "IGNORED" 1))
  1845. ;; Non-inline footnotes definitions are full Org data.
  1846. (t (org-html-format-footnote-reference
  1847. (org-export-get-footnote-number footnote-reference info)
  1848. "IGNORED" 1)))))
  1849. ;;;; Headline
  1850. (defun org-html-format-headline--wrap
  1851. (headline info &optional format-function &rest extra-keys)
  1852. "Transcode a HEADLINE element from Org to HTML.
  1853. CONTENTS holds the contents of the headline. INFO is a plist
  1854. holding contextual information."
  1855. (let* ((level (+ (org-export-get-relative-level headline info)
  1856. (1- org-html-toplevel-hlevel)))
  1857. (headline-number (org-export-get-headline-number headline info))
  1858. (section-number (and (not (org-export-low-level-p headline info))
  1859. (org-export-numbered-headline-p headline info)
  1860. (mapconcat 'number-to-string
  1861. headline-number ".")))
  1862. (todo (and (plist-get info :with-todo-keywords)
  1863. (let ((todo (org-element-property :todo-keyword headline)))
  1864. (and todo (org-export-data todo info)))))
  1865. (todo-type (and todo (org-element-property :todo-type headline)))
  1866. (priority (and (plist-get info :with-priority)
  1867. (org-element-property :priority headline)))
  1868. (text (org-export-data (org-element-property :title headline) info))
  1869. (tags (and (plist-get info :with-tags)
  1870. (org-export-get-tags headline info)))
  1871. (headline-label (or (org-element-property :CUSTOM_ID headline)
  1872. (concat "sec-" (mapconcat 'number-to-string
  1873. headline-number "-"))))
  1874. (format-function (cond
  1875. ((functionp format-function) format-function)
  1876. ((functionp org-html-format-headline-function)
  1877. (function*
  1878. (lambda (todo todo-type priority text tags
  1879. &allow-other-keys)
  1880. (funcall org-html-format-headline-function
  1881. todo todo-type priority text tags))))
  1882. (t 'org-html-format-headline))))
  1883. (apply format-function
  1884. todo todo-type priority text tags
  1885. :headline-label headline-label :level level
  1886. :section-number section-number extra-keys)))
  1887. (defun org-html-headline (headline contents info)
  1888. "Transcode a HEADLINE element from Org to HTML.
  1889. CONTENTS holds the contents of the headline. INFO is a plist
  1890. holding contextual information."
  1891. ;; Empty contents?
  1892. (setq contents (or contents ""))
  1893. (let* ((numberedp (org-export-numbered-headline-p headline info))
  1894. (level (org-export-get-relative-level headline info))
  1895. (text (org-export-data (org-element-property :title headline) info))
  1896. (todo (and (plist-get info :with-todo-keywords)
  1897. (let ((todo (org-element-property :todo-keyword headline)))
  1898. (and todo (org-export-data todo info)))))
  1899. (todo-type (and todo (org-element-property :todo-type headline)))
  1900. (tags (and (plist-get info :with-tags)
  1901. (org-export-get-tags headline info)))
  1902. (priority (and (plist-get info :with-priority)
  1903. (org-element-property :priority headline)))
  1904. (section-number (and (org-export-numbered-headline-p headline info)
  1905. (mapconcat 'number-to-string
  1906. (org-export-get-headline-number
  1907. headline info) ".")))
  1908. ;; Create the headline text.
  1909. (full-text (org-html-format-headline--wrap headline info)))
  1910. (cond
  1911. ;; Case 1: This is a footnote section: ignore it.
  1912. ((org-element-property :footnote-section-p headline) nil)
  1913. ;; Case 2. This is a deep sub-tree: export it as a list item.
  1914. ;; Also export as items headlines for which no section
  1915. ;; format has been found.
  1916. ((org-export-low-level-p headline info)
  1917. ;; Build the real contents of the sub-tree.
  1918. (let* ((type (if numberedp 'ordered 'unordered))
  1919. (itemized-body (org-html-format-list-item
  1920. contents type nil nil full-text)))
  1921. (concat
  1922. (and (org-export-first-sibling-p headline info)
  1923. (org-html-begin-plain-list type))
  1924. itemized-body
  1925. (and (org-export-last-sibling-p headline info)
  1926. (org-html-end-plain-list type)))))
  1927. ;; Case 3. Standard headline. Export it as a section.
  1928. (t
  1929. (let* ((section-number (mapconcat 'number-to-string
  1930. (org-export-get-headline-number
  1931. headline info) "-"))
  1932. (ids (remove 'nil
  1933. (list (org-element-property :CUSTOM_ID headline)
  1934. (concat "sec-" section-number)
  1935. (org-element-property :ID headline))))
  1936. (preferred-id (car ids))
  1937. (extra-ids (cdr ids))
  1938. (extra-class (org-element-property :HTML_CONTAINER_CLASS headline))
  1939. (level1 (+ level (1- org-html-toplevel-hlevel)))
  1940. (first-content (car (org-element-contents headline))))
  1941. (format "<%s id=\"%s\" class=\"%s\">%s%s</%s>\n"
  1942. (if (= 1 (org-export-get-relative-level headline info))
  1943. (plist-get info :html-container)
  1944. "div")
  1945. (format "outline-container-%s"
  1946. (or (org-element-property :CUSTOM_ID headline)
  1947. section-number))
  1948. (concat (format "outline-%d" level1) (and extra-class " ")
  1949. extra-class)
  1950. (format "\n<h%d id=\"%s\">%s%s</h%d>\n"
  1951. level1
  1952. preferred-id
  1953. (mapconcat
  1954. (lambda (x)
  1955. (let ((id (org-export-solidify-link-text
  1956. (if (org-uuidgen-p x) (concat "ID-" x)
  1957. x))))
  1958. (org-html--anchor id)))
  1959. extra-ids "")
  1960. full-text
  1961. level1)
  1962. ;; When there is no section, pretend there is an empty
  1963. ;; one to get the correct <div class="outline- ...>
  1964. ;; which is needed by `org-info.js'.
  1965. (if (not (eq (org-element-type first-content) 'section))
  1966. (concat (org-html-section first-content "" info)
  1967. contents)
  1968. contents)
  1969. (if (= 1 (org-export-get-relative-level headline info))
  1970. (plist-get info :html-container)
  1971. "div")))))))
  1972. ;;;; Horizontal Rule
  1973. (defun org-html-horizontal-rule (horizontal-rule contents info)
  1974. "Transcode an HORIZONTAL-RULE object from Org to HTML.
  1975. CONTENTS is nil. INFO is a plist holding contextual information."
  1976. "<hr/>")
  1977. ;;;; Inline Src Block
  1978. (defun org-html-inline-src-block (inline-src-block contents info)
  1979. "Transcode an INLINE-SRC-BLOCK element from Org to HTML.
  1980. CONTENTS holds the contents of the item. INFO is a plist holding
  1981. contextual information."
  1982. (let* ((org-lang (org-element-property :language inline-src-block))
  1983. (code (org-element-property :value inline-src-block)))
  1984. (error "Cannot export inline src block")))
  1985. ;;;; Inlinetask
  1986. (defun org-html-format-section (text class &optional id)
  1987. "Format a section with TEXT into a HTML div with CLASS and ID."
  1988. (let ((extra (concat (when id (format " id=\"%s\"" id)))))
  1989. (concat (format "<div class=\"%s\"%s>\n" class extra) text "</div>\n")))
  1990. (defun org-html-inlinetask (inlinetask contents info)
  1991. "Transcode an INLINETASK element from Org to HTML.
  1992. CONTENTS holds the contents of the block. INFO is a plist
  1993. holding contextual information."
  1994. (cond
  1995. ;; If `org-html-format-inlinetask-function' is provided, call it
  1996. ;; with appropriate arguments.
  1997. ((functionp org-html-format-inlinetask-function)
  1998. (let ((format-function
  1999. (function*
  2000. (lambda (todo todo-type priority text tags
  2001. &key contents &allow-other-keys)
  2002. (funcall org-html-format-inlinetask-function
  2003. todo todo-type priority text tags contents)))))
  2004. (org-html-format-headline--wrap
  2005. inlinetask info format-function :contents contents)))
  2006. ;; Otherwise, use a default template.
  2007. (t (format "<div class=\"inlinetask\">\n<b>%s</b><br/>\n%s</div>"
  2008. (org-html-format-headline--wrap inlinetask info)
  2009. contents))))
  2010. ;;;; Italic
  2011. (defun org-html-italic (italic contents info)
  2012. "Transcode ITALIC from Org to HTML.
  2013. CONTENTS is the text with italic markup. INFO is a plist holding
  2014. contextual information."
  2015. (format (or (cdr (assq 'italic org-html-text-markup-alist)) "%s") contents))
  2016. ;;;; Item
  2017. (defun org-html-checkbox (checkbox)
  2018. "Format CHECKBOX into HTML."
  2019. (case checkbox (on "<code>[X]</code>")
  2020. (off "<code>[&#xa0;]</code>")
  2021. (trans "<code>[-]</code>")
  2022. (t "")))
  2023. (defun org-html-format-list-item (contents type checkbox
  2024. &optional term-counter-id
  2025. headline)
  2026. "Format a list item into HTML."
  2027. (let ((checkbox (concat (org-html-checkbox checkbox) (and checkbox " "))))
  2028. (concat
  2029. (case type
  2030. (ordered
  2031. (let* ((counter term-counter-id)
  2032. (extra (if counter (format " value=\"%s\"" counter) "")))
  2033. (concat
  2034. (format "<li%s>" extra)
  2035. (when headline (concat headline "<br/>")))))
  2036. (unordered
  2037. (let* ((id term-counter-id)
  2038. (extra (if id (format " id=\"%s\"" id) "")))
  2039. (concat
  2040. (format "<li%s>" extra)
  2041. (when headline (concat headline "<br/>")))))
  2042. (descriptive
  2043. (let* ((term term-counter-id))
  2044. (setq term (or term "(no term)"))
  2045. ;; Check-boxes in descriptive lists are associated to tag.
  2046. (concat (format "<dt> %s </dt>"
  2047. (concat checkbox term))
  2048. "<dd>"))))
  2049. (unless (eq type 'descriptive) checkbox)
  2050. contents
  2051. (case type
  2052. (ordered "</li>")
  2053. (unordered "</li>")
  2054. (descriptive "</dd>")))))
  2055. (defun org-html-item (item contents info)
  2056. "Transcode an ITEM element from Org to HTML.
  2057. CONTENTS holds the contents of the item. INFO is a plist holding
  2058. contextual information."
  2059. (let* ((plain-list (org-export-get-parent item))
  2060. (type (org-element-property :type plain-list))
  2061. (counter (org-element-property :counter item))
  2062. (checkbox (org-element-property :checkbox item))
  2063. (tag (let ((tag (org-element-property :tag item)))
  2064. (and tag (org-export-data tag info)))))
  2065. (org-html-format-list-item
  2066. contents type checkbox (or tag counter))))
  2067. ;;;; Keyword
  2068. (defun org-html-keyword (keyword contents info)
  2069. "Transcode a KEYWORD element from Org to HTML.
  2070. CONTENTS is nil. INFO is a plist holding contextual information."
  2071. (let ((key (org-element-property :key keyword))
  2072. (value (org-element-property :value keyword)))
  2073. (cond
  2074. ((string= key "HTML") value)
  2075. ;; Invisible targets.
  2076. ((string= key "TARGET") nil)
  2077. ((string= key "TOC")
  2078. (let ((value (downcase value)))
  2079. (cond
  2080. ((string-match "\\<headlines\\>" value)
  2081. (let ((depth (or (and (string-match "[0-9]+" value)
  2082. (string-to-number (match-string 0 value)))
  2083. (plist-get info :with-toc))))
  2084. (org-html-toc depth info)))
  2085. ((string= "listings" value) (org-html-list-of-listings info))
  2086. ((string= "tables" value) (org-html-list-of-tables info))))))))
  2087. ;;;; Latex Environment
  2088. (defun org-html-format-latex (latex-frag processing-type)
  2089. "Format the LaTeX fragment LATEX-FRAG into HTML."
  2090. (let ((cache-relpath "") (cache-dir "") bfn)
  2091. (unless (eq processing-type 'mathjax)
  2092. (setq bfn (buffer-file-name)
  2093. cache-relpath
  2094. (concat "ltxpng/"
  2095. (file-name-sans-extension
  2096. (file-name-nondirectory bfn)))
  2097. cache-dir (file-name-directory bfn)))
  2098. (with-temp-buffer
  2099. (insert latex-frag)
  2100. (org-format-latex cache-relpath cache-dir nil "Creating LaTeX Image..."
  2101. nil nil processing-type)
  2102. (buffer-string))))
  2103. (defun org-html-latex-environment (latex-environment contents info)
  2104. "Transcode a LATEX-ENVIRONMENT element from Org to HTML.
  2105. CONTENTS is nil. INFO is a plist holding contextual information."
  2106. (let ((processing-type (plist-get info :with-latex))
  2107. (latex-frag (org-remove-indentation
  2108. (org-element-property :value latex-environment)))
  2109. (caption (org-export-data
  2110. (org-export-get-caption latex-environment) info))
  2111. (attr nil) ; FIXME
  2112. (label (org-element-property :name latex-environment)))
  2113. (cond
  2114. ((memq processing-type '(t mathjax))
  2115. (org-html-format-latex latex-frag 'mathjax))
  2116. ((eq processing-type 'dvipng)
  2117. (let* ((formula-link (org-html-format-latex
  2118. latex-frag processing-type)))
  2119. (when (and formula-link
  2120. (string-match "file:\\([^]]*\\)" formula-link))
  2121. (org-html-format-inline-image
  2122. (match-string 1 formula-link) caption label attr t))))
  2123. (t latex-frag))))
  2124. ;;;; Latex Fragment
  2125. (defun org-html-latex-fragment (latex-fragment contents info)
  2126. "Transcode a LATEX-FRAGMENT object from Org to HTML.
  2127. CONTENTS is nil. INFO is a plist holding contextual information."
  2128. (let ((latex-frag (org-element-property :value latex-fragment))
  2129. (processing-type (plist-get info :with-latex)))
  2130. (case processing-type
  2131. ((t mathjax)
  2132. (org-html-format-latex latex-frag 'mathjax))
  2133. (dvipng
  2134. (let* ((formula-link (org-html-format-latex
  2135. latex-frag processing-type)))
  2136. (when (and formula-link
  2137. (string-match "file:\\([^]]*\\)" formula-link))
  2138. (org-html-format-inline-image
  2139. (match-string 1 formula-link)))))
  2140. (t latex-frag))))
  2141. ;;;; Line Break
  2142. (defun org-html-line-break (line-break contents info)
  2143. "Transcode a LINE-BREAK object from Org to HTML.
  2144. CONTENTS is nil. INFO is a plist holding contextual information."
  2145. "<br/>\n")
  2146. ;;;; Link
  2147. (defun org-html-link--inline-image (link desc info)
  2148. "Return HTML code for an inline image.
  2149. LINK is the link pointing to the inline image. INFO is a plist
  2150. used as a communication channel."
  2151. (let* ((type (org-element-property :type link))
  2152. (raw-path (org-element-property :path link))
  2153. (path (cond ((member type '("http" "https"))
  2154. (concat type ":" raw-path))
  2155. ((file-name-absolute-p raw-path)
  2156. (expand-file-name raw-path))
  2157. (t raw-path)))
  2158. (parent (org-export-get-parent-element link))
  2159. (caption (org-export-data (org-export-get-caption parent) info))
  2160. (label (org-element-property :name parent))
  2161. (attr (mapconcat #'identity (org-element-property :attr_html parent) " ")))
  2162. ;; Return proper string, depending on DISPOSITION.
  2163. (org-html-format-inline-image
  2164. path caption label attr (org-html-standalone-image-p link info))))
  2165. (defvar org-html-standalone-image-predicate)
  2166. (defun org-html-standalone-image-p (element info &optional predicate)
  2167. "Test if ELEMENT is a standalone image for the purpose HTML export.
  2168. INFO is a plist holding contextual information.
  2169. Return non-nil, if ELEMENT is of type paragraph and it's sole
  2170. content, save for whitespaces, is a link that qualifies as an
  2171. inline image.
  2172. Return non-nil, if ELEMENT is of type link and it's containing
  2173. paragraph has no other content save for leading and trailing
  2174. whitespaces.
  2175. Return nil, otherwise.
  2176. Bind `org-html-standalone-image-predicate' to constrain
  2177. paragraph further. For example, to check for only captioned
  2178. standalone images, do the following.
  2179. \(setq org-html-standalone-image-predicate
  2180. \(lambda \(paragraph\)
  2181. \(org-element-property :caption paragraph\)\)\)"
  2182. (let ((paragraph (case (org-element-type element)
  2183. (paragraph element)
  2184. (link (and (org-export-inline-image-p
  2185. element org-html-inline-image-rules)
  2186. (org-export-get-parent element)))
  2187. (t nil))))
  2188. (when (eq (org-element-type paragraph) 'paragraph)
  2189. (when (or (not (and (boundp 'org-html-standalone-image-predicate)
  2190. (functionp org-html-standalone-image-predicate)))
  2191. (funcall org-html-standalone-image-predicate paragraph))
  2192. (let ((contents (org-element-contents paragraph)))
  2193. (loop for x in contents
  2194. with inline-image-count = 0
  2195. always (cond
  2196. ((eq (org-element-type x) 'plain-text)
  2197. (not (org-string-nw-p x)))
  2198. ((eq (org-element-type x) 'link)
  2199. (when (org-export-inline-image-p
  2200. x org-html-inline-image-rules)
  2201. (= (incf inline-image-count) 1)))
  2202. (t nil))))))))
  2203. (defun org-html-link (link desc info)
  2204. "Transcode a LINK object from Org to HTML.
  2205. DESC is the description part of the link, or the empty string.
  2206. INFO is a plist holding contextual information. See
  2207. `org-export-data'."
  2208. (let* ((link-org-files-as-html-maybe
  2209. (function
  2210. (lambda (raw-path info)
  2211. "Treat links to `file.org' as links to `file.html', if needed.
  2212. See `org-html-link-org-files-as-html'."
  2213. (cond
  2214. ((and org-html-link-org-files-as-html
  2215. (string= ".org"
  2216. (downcase (file-name-extension raw-path "."))))
  2217. (concat (file-name-sans-extension raw-path) "."
  2218. (plist-get info :html-extension)))
  2219. (t raw-path)))))
  2220. (type (org-element-property :type link))
  2221. (raw-path (org-element-property :path link))
  2222. ;; Ensure DESC really exists, or set it to nil.
  2223. (desc (and (not (string= desc "")) desc))
  2224. (path
  2225. (cond
  2226. ((member type '("http" "https" "ftp" "mailto"))
  2227. (concat type ":" raw-path))
  2228. ((string= type "file")
  2229. ;; Treat links to ".org" files as ".html", if needed.
  2230. (setq raw-path
  2231. (funcall link-org-files-as-html-maybe raw-path info))
  2232. ;; If file path is absolute, prepend it with protocol
  2233. ;; component - "file://".
  2234. (when (file-name-absolute-p raw-path)
  2235. (setq raw-path
  2236. (concat "file://" (expand-file-name raw-path))))
  2237. ;; Add search option, if any. A search option can be
  2238. ;; relative to a custom-id or a headline title. Any other
  2239. ;; option is ignored.
  2240. (let ((option (org-element-property :search-option link)))
  2241. (cond ((not option) raw-path)
  2242. ((eq (aref option 0) ?#) (concat raw-path option))
  2243. ;; External fuzzy link: try to resolve it if path
  2244. ;; belongs to current project, if any.
  2245. ((eq (aref option 0) ?*)
  2246. (concat
  2247. raw-path
  2248. (let ((numbers
  2249. (org-publish-resolve-external-fuzzy-link
  2250. (org-element-property :path link) option)))
  2251. (and numbers (concat "#sec-"
  2252. (mapconcat 'number-to-string
  2253. numbers "-"))))))
  2254. (t raw-path))))
  2255. (t raw-path)))
  2256. attributes protocol)
  2257. ;; Extract attributes from parent's paragraph. HACK: Only do this
  2258. ;; for the first link in parent. This is needed as long as
  2259. ;; attributes cannot be set on a per link basis.
  2260. (and (setq attributes
  2261. (let ((parent (org-export-get-parent-element link)))
  2262. (if (not (eq (org-element-map parent 'link 'identity info t)
  2263. link))
  2264. ""
  2265. (mapconcat
  2266. 'identity
  2267. (let ((att (org-element-property :attr_html parent)))
  2268. (unless (and desc att
  2269. (string-match (regexp-quote (car att)) desc))
  2270. att))
  2271. " "))))
  2272. (unless (string= attributes "")
  2273. (setq attributes (concat " " attributes))))
  2274. (cond
  2275. ;; Image file.
  2276. ((and (or (eq t org-html-inline-images)
  2277. (and org-html-inline-images (not desc)))
  2278. (org-export-inline-image-p link org-html-inline-image-rules))
  2279. (org-html-link--inline-image link desc info))
  2280. ;; Radio target: Transcode target's contents and use them as
  2281. ;; link's description.
  2282. ((string= type "radio")
  2283. (let ((destination (org-export-resolve-radio-link link info)))
  2284. (when destination
  2285. (format "<a href=\"#%s\"%s>%s</a>"
  2286. (org-export-solidify-link-text path)
  2287. attributes
  2288. (org-export-data (org-element-contents destination) info)))))
  2289. ;; Links pointing to a headline: Find destination and build
  2290. ;; appropriate referencing command.
  2291. ((member type '("custom-id" "fuzzy" "id"))
  2292. (let ((destination (if (string= type "fuzzy")
  2293. (org-export-resolve-fuzzy-link link info)
  2294. (org-export-resolve-id-link link info))))
  2295. (case (org-element-type destination)
  2296. ;; ID link points to an external file.
  2297. (plain-text
  2298. (let ((fragment (concat "ID-" path))
  2299. ;; Treat links to ".org" files as ".html", if needed.
  2300. (path (funcall link-org-files-as-html-maybe
  2301. destination info)))
  2302. (format "<a href=\"%s#%s\"%s>%s</a>"
  2303. path fragment attributes (or desc destination))))
  2304. ;; Fuzzy link points nowhere.
  2305. ((nil)
  2306. (format "<i>%s</i>"
  2307. (or desc
  2308. (org-export-data
  2309. (org-element-property :raw-link link) info))))
  2310. ;; Fuzzy link points to an invisible target.
  2311. (keyword nil)
  2312. ;; Link points to a headline.
  2313. (headline
  2314. (let ((href
  2315. ;; What href to use?
  2316. (cond
  2317. ;; Case 1: Headline is linked via it's CUSTOM_ID
  2318. ;; property. Use CUSTOM_ID.
  2319. ((string= type "custom-id")
  2320. (org-element-property :CUSTOM_ID destination))
  2321. ;; Case 2: Headline is linked via it's ID property
  2322. ;; or through other means. Use the default href.
  2323. ((member type '("id" "fuzzy"))
  2324. (format "sec-%s"
  2325. (mapconcat 'number-to-string
  2326. (org-export-get-headline-number
  2327. destination info) "-")))
  2328. (t (error "Shouldn't reach here"))))
  2329. ;; What description to use?
  2330. (desc
  2331. ;; Case 1: Headline is numbered and LINK has no
  2332. ;; description or LINK's description matches
  2333. ;; headline's title. Display section number.
  2334. (if (and (org-export-numbered-headline-p destination info)
  2335. (or (not desc)
  2336. (string= desc (org-element-property
  2337. :raw-value destination))))
  2338. (mapconcat 'number-to-string
  2339. (org-export-get-headline-number
  2340. destination info) ".")
  2341. ;; Case 2: Either the headline is un-numbered or
  2342. ;; LINK has a custom description. Display LINK's
  2343. ;; description or headline's title.
  2344. (or desc (org-export-data (org-element-property
  2345. :title destination) info)))))
  2346. (format "<a href=\"#%s\"%s>%s</a>"
  2347. (org-export-solidify-link-text href) attributes desc)))
  2348. ;; Fuzzy link points to a target. Do as above.
  2349. (t
  2350. (let ((path (org-export-solidify-link-text path)) number)
  2351. (unless desc
  2352. (setq number (cond
  2353. ((org-html-standalone-image-p destination info)
  2354. (org-export-get-ordinal
  2355. (assoc 'link (org-element-contents destination))
  2356. info 'link 'org-html-standalone-image-p))
  2357. (t (org-export-get-ordinal destination info))))
  2358. (setq desc (when number
  2359. (if (atom number) (number-to-string number)
  2360. (mapconcat 'number-to-string number ".")))))
  2361. (format "<a href=\"#%s\"%s>%s</a>"
  2362. path attributes (or desc "No description for this link")))))))
  2363. ;; Coderef: replace link with the reference name or the
  2364. ;; equivalent line number.
  2365. ((string= type "coderef")
  2366. (let ((fragment (concat "coderef-" path)))
  2367. (format "<a href=\"#%s\"%s%s>%s</a>"
  2368. fragment
  2369. (org-trim
  2370. (format (concat "class=\"coderef\""
  2371. " onmouseover=\"CodeHighlightOn(this, '%s');\""
  2372. " onmouseout=\"CodeHighlightOff(this, '%s');\"")
  2373. fragment fragment))
  2374. attributes
  2375. (format (org-export-get-coderef-format path desc)
  2376. (org-export-resolve-coderef path info)))))
  2377. ;; Link type is handled by a special function.
  2378. ((functionp (setq protocol (nth 2 (assoc type org-link-protocols))))
  2379. (funcall protocol (org-link-unescape path) desc 'html))
  2380. ;; External link with a description part.
  2381. ((and path desc) (format "<a href=\"%s\"%s>%s</a>" path attributes desc))
  2382. ;; External link without a description part.
  2383. (path (format "<a href=\"%s\"%s>%s</a>" path attributes path))
  2384. ;; No path, only description. Try to do something useful.
  2385. (t (format "<i>%s</i>" desc)))))
  2386. ;;;; Paragraph
  2387. (defun org-html-paragraph (paragraph contents info)
  2388. "Transcode a PARAGRAPH element from Org to HTML.
  2389. CONTENTS is the contents of the paragraph, as a string. INFO is
  2390. the plist used as a communication channel."
  2391. (let* ((parent (org-export-get-parent paragraph))
  2392. (parent-type (org-element-type parent))
  2393. (style '((footnote-definition " class=\"footpara\"")))
  2394. (extra (or (cadr (assoc parent-type style)) "")))
  2395. (cond
  2396. ((and (eq (org-element-type parent) 'item)
  2397. (= (org-element-property :begin paragraph)
  2398. (org-element-property :contents-begin parent)))
  2399. ;; leading paragraph in a list item have no tags
  2400. contents)
  2401. ((org-html-standalone-image-p paragraph info)
  2402. ;; standalone image
  2403. contents)
  2404. (t (format "<p%s>\n%s</p>" extra contents)))))
  2405. ;;;; Plain List
  2406. ;; FIXME Maybe arg1 is not needed because <li value="20"> already sets
  2407. ;; the correct value for the item counter
  2408. (defun org-html-begin-plain-list (type &optional arg1)
  2409. "Insert the beginning of the HTML list depending on TYPE.
  2410. When ARG1 is a string, use it as the start parameter for ordered
  2411. lists."
  2412. (case type
  2413. (ordered
  2414. (format "<ol class=\"org-ol\"%s>"
  2415. (if arg1 (format " start=\"%d\"" arg1) "")))
  2416. (unordered "<ul class=\"org-ul\">")
  2417. (descriptive "<dl class=\"org-dl\">")))
  2418. (defun org-html-end-plain-list (type)
  2419. "Insert the end of the HTML list depending on TYPE."
  2420. (case type
  2421. (ordered "</ol>")
  2422. (unordered "</ul>")
  2423. (descriptive "</dl>")))
  2424. (defun org-html-plain-list (plain-list contents info)
  2425. "Transcode a PLAIN-LIST element from Org to HTML.
  2426. CONTENTS is the contents of the list. INFO is a plist holding
  2427. contextual information."
  2428. (let* (arg1 ;; (assoc :counter (org-element-map plain-list 'item
  2429. (type (org-element-property :type plain-list)))
  2430. (format "%s\n%s%s"
  2431. (org-html-begin-plain-list type)
  2432. contents (org-html-end-plain-list type))))
  2433. ;;;; Plain Text
  2434. (defun org-html-convert-special-strings (string)
  2435. "Convert special characters in STRING to HTML."
  2436. (let ((all org-html-special-string-regexps)
  2437. e a re rpl start)
  2438. (while (setq a (pop all))
  2439. (setq re (car a) rpl (cdr a) start 0)
  2440. (while (string-match re string start)
  2441. (setq string (replace-match rpl t nil string))))
  2442. string))
  2443. (defun org-html-encode-plain-text (text)
  2444. "Convert plain text characters from TEXT to HTML equivalent.
  2445. Possible conversions are set in `org-html-protect-char-alist'."
  2446. (mapc
  2447. (lambda (pair)
  2448. (setq text (replace-regexp-in-string (car pair) (cdr pair) text t t)))
  2449. org-html-protect-char-alist)
  2450. text)
  2451. (defun org-html-plain-text (text info)
  2452. "Transcode a TEXT string from Org to HTML.
  2453. TEXT is the string to transcode. INFO is a plist holding
  2454. contextual information."
  2455. (let ((output text))
  2456. ;; Protect following characters: <, >, &.
  2457. (setq output (org-html-encode-plain-text output))
  2458. ;; Handle smart quotes. Be sure to provide original string since
  2459. ;; OUTPUT may have been modified.
  2460. (when (plist-get info :with-smart-quotes)
  2461. (setq output (org-export-activate-smart-quotes output :html info text)))
  2462. ;; Handle special strings.
  2463. (when (plist-get info :with-special-strings)
  2464. (setq output (org-html-convert-special-strings output)))
  2465. ;; Handle break preservation if required.
  2466. (when (plist-get info :preserve-breaks)
  2467. (setq output
  2468. (replace-regexp-in-string
  2469. "\\(\\\\\\\\\\)?[ \t]*\n" "<br/>\n" output)))
  2470. ;; Return value.
  2471. output))
  2472. ;; Planning
  2473. (defun org-html-planning (planning contents info)
  2474. "Transcode a PLANNING element from Org to HTML.
  2475. CONTENTS is nil. INFO is a plist used as a communication
  2476. channel."
  2477. (let ((span-fmt "<span class=\"timestamp-kwd\">%s</span> <span class=\"timestamp\">%s</span>"))
  2478. (format
  2479. "<p><span class=\"timestamp-wrapper\">%s</span></p>"
  2480. (mapconcat
  2481. 'identity
  2482. (delq nil
  2483. (list
  2484. (let ((closed (org-element-property :closed planning)))
  2485. (when closed
  2486. (format span-fmt org-closed-string
  2487. (org-translate-time
  2488. (org-element-property :raw-value closed)))))
  2489. (let ((deadline (org-element-property :deadline planning)))
  2490. (when deadline
  2491. (format span-fmt org-deadline-string
  2492. (org-translate-time
  2493. (org-element-property :raw-value deadline)))))
  2494. (let ((scheduled (org-element-property :scheduled planning)))
  2495. (when scheduled
  2496. (format span-fmt org-scheduled-string
  2497. (org-translate-time
  2498. (org-element-property :raw-value scheduled)))))))
  2499. " "))))
  2500. ;;;; Property Drawer
  2501. (defun org-html-property-drawer (property-drawer contents info)
  2502. "Transcode a PROPERTY-DRAWER element from Org to HTML.
  2503. CONTENTS is nil. INFO is a plist holding contextual
  2504. information."
  2505. ;; The property drawer isn't exported but we want separating blank
  2506. ;; lines nonetheless.
  2507. "")
  2508. ;;;; Quote Block
  2509. (defun org-html-quote-block (quote-block contents info)
  2510. "Transcode a QUOTE-BLOCK element from Org to HTML.
  2511. CONTENTS holds the contents of the block. INFO is a plist
  2512. holding contextual information."
  2513. (format "<blockquote>\n%s</blockquote>" contents))
  2514. ;;;; Quote Section
  2515. (defun org-html-quote-section (quote-section contents info)
  2516. "Transcode a QUOTE-SECTION element from Org to HTML.
  2517. CONTENTS is nil. INFO is a plist holding contextual information."
  2518. (let ((value (org-remove-indentation
  2519. (org-element-property :value quote-section))))
  2520. (when value (format "<pre>\n%s</pre>" value))))
  2521. ;;;; Section
  2522. (defun org-html-section (section contents info)
  2523. "Transcode a SECTION element from Org to HTML.
  2524. CONTENTS holds the contents of the section. INFO is a plist
  2525. holding contextual information."
  2526. (let ((parent (org-export-get-parent-headline section)))
  2527. ;; Before first headline: no container, just return CONTENTS.
  2528. (if (not parent) contents
  2529. ;; Get div's class and id references.
  2530. (let* ((class-num (+ (org-export-get-relative-level parent info)
  2531. (1- org-html-toplevel-hlevel)))
  2532. (section-number
  2533. (mapconcat
  2534. 'number-to-string
  2535. (org-export-get-headline-number parent info) "-")))
  2536. ;; Build return value.
  2537. (format "<div class=\"outline-text-%d\" id=\"text-%s\">\n%s</div>"
  2538. class-num
  2539. (or (org-element-property :CUSTOM_ID parent) section-number)
  2540. contents)))))
  2541. ;;;; Radio Target
  2542. (defun org-html-radio-target (radio-target text info)
  2543. "Transcode a RADIO-TARGET object from Org to HTML.
  2544. TEXT is the text of the target. INFO is a plist holding
  2545. contextual information."
  2546. (let ((id (org-export-solidify-link-text
  2547. (org-element-property :value radio-target))))
  2548. (org-html--anchor id text)))
  2549. ;;;; Special Block
  2550. (defun org-html-special-block (special-block contents info)
  2551. "Transcode a SPECIAL-BLOCK element from Org to HTML.
  2552. CONTENTS holds the contents of the block. INFO is a plist
  2553. holding contextual information."
  2554. (format "<div class=\"%s\">\n%s\n</div>"
  2555. (downcase (org-element-property :type special-block))
  2556. contents))
  2557. ;;;; Src Block
  2558. (defun org-html-src-block (src-block contents info)
  2559. "Transcode a SRC-BLOCK element from Org to HTML.
  2560. CONTENTS holds the contents of the item. INFO is a plist holding
  2561. contextual information."
  2562. (if (org-export-read-attribute :attr_html src-block :textarea)
  2563. (org-html--textarea-block src-block)
  2564. (let ((lang (org-element-property :language src-block))
  2565. (caption (org-export-get-caption src-block))
  2566. (code (org-html-format-code src-block info))
  2567. (label (let ((lbl (org-element-property :name src-block)))
  2568. (if (not lbl) ""
  2569. (format " id=\"%s\""
  2570. (org-export-solidify-link-text lbl))))))
  2571. (if (not lang) (format "<pre class=\"example\"%s>\n%s</pre>" label code)
  2572. (format
  2573. "<div class=\"org-src-container\">\n%s%s\n</div>"
  2574. (if (not caption) ""
  2575. (format "<label class=\"org-src-name\">%s</label>"
  2576. (org-export-data caption info)))
  2577. (format "\n<pre class=\"src src-%s\"%s>%s</pre>" lang label code))))))
  2578. ;;;; Statistics Cookie
  2579. (defun org-html-statistics-cookie (statistics-cookie contents info)
  2580. "Transcode a STATISTICS-COOKIE object from Org to HTML.
  2581. CONTENTS is nil. INFO is a plist holding contextual information."
  2582. (let ((cookie-value (org-element-property :value statistics-cookie)))
  2583. (format "<code>%s</code>" cookie-value)))
  2584. ;;;; Strike-Through
  2585. (defun org-html-strike-through (strike-through contents info)
  2586. "Transcode STRIKE-THROUGH from Org to HTML.
  2587. CONTENTS is the text with strike-through markup. INFO is a plist
  2588. holding contextual information."
  2589. (format (or (cdr (assq 'strike-through org-html-text-markup-alist)) "%s")
  2590. contents))
  2591. ;;;; Subscript
  2592. (defun org-html-subscript (subscript contents info)
  2593. "Transcode a SUBSCRIPT object from Org to HTML.
  2594. CONTENTS is the contents of the object. INFO is a plist holding
  2595. contextual information."
  2596. (format "<sub>%s</sub>" contents))
  2597. ;;;; Superscript
  2598. (defun org-html-superscript (superscript contents info)
  2599. "Transcode a SUPERSCRIPT object from Org to HTML.
  2600. CONTENTS is the contents of the object. INFO is a plist holding
  2601. contextual information."
  2602. (format "<sup>%s</sup>" contents))
  2603. ;;;; Tabel Cell
  2604. (defun org-html-table-cell (table-cell contents info)
  2605. "Transcode a TABLE-CELL element from Org to HTML.
  2606. CONTENTS is nil. INFO is a plist used as a communication
  2607. channel."
  2608. (let* ((table-row (org-export-get-parent table-cell))
  2609. (table (org-export-get-parent-table table-cell))
  2610. (cell-attrs
  2611. (if (not org-html-table-align-individual-fields) ""
  2612. (format (if (and (boundp 'org-html-format-table-no-css)
  2613. org-html-format-table-no-css)
  2614. " align=\"%s\"" " class=\"%s\"")
  2615. (org-export-table-cell-alignment table-cell info)))))
  2616. (when (or (not contents) (string= "" (org-trim contents)))
  2617. (setq contents "&#xa0;"))
  2618. (cond
  2619. ((and (org-export-table-has-header-p table info)
  2620. (= 1 (org-export-table-row-group table-row info)))
  2621. (concat "\n" (format (car org-html-table-header-tags) "col" cell-attrs)
  2622. contents (cdr org-html-table-header-tags)))
  2623. ((and org-html-table-use-header-tags-for-first-column
  2624. (zerop (cdr (org-export-table-cell-address table-cell info))))
  2625. (concat "\n" (format (car org-html-table-header-tags) "row" cell-attrs)
  2626. contents (cdr org-html-table-header-tags)))
  2627. (t (concat "\n" (format (car org-html-table-data-tags) cell-attrs)
  2628. contents (cdr org-html-table-data-tags))))))
  2629. ;;;; Table Row
  2630. (defun org-html-table-row (table-row contents info)
  2631. "Transcode a TABLE-ROW element from Org to HTML.
  2632. CONTENTS is the contents of the row. INFO is a plist used as a
  2633. communication channel."
  2634. ;; Rules are ignored since table separators are deduced from
  2635. ;; borders of the current row.
  2636. (when (eq (org-element-property :type table-row) 'standard)
  2637. (let* ((first-rowgroup-p (= 1 (org-export-table-row-group table-row info)))
  2638. (rowgroup-tags
  2639. (cond
  2640. ;; Case 1: Row belongs to second or subsequent rowgroups.
  2641. ((not (= 1 (org-export-table-row-group table-row info)))
  2642. '("<tbody>" . "\n</tbody>"))
  2643. ;; Case 2: Row is from first rowgroup. Table has >=1 rowgroups.
  2644. ((org-export-table-has-header-p
  2645. (org-export-get-parent-table table-row) info)
  2646. '("<thead>" . "\n</thead>"))
  2647. ;; Case 2: Row is from first and only row group.
  2648. (t '("<tbody>" . "\n</tbody>")))))
  2649. (concat
  2650. ;; Begin a rowgroup?
  2651. (when (org-export-table-row-starts-rowgroup-p table-row info)
  2652. (car rowgroup-tags))
  2653. ;; Actual table row
  2654. (concat "\n" (eval (car org-html-table-row-tags))
  2655. contents
  2656. "\n"
  2657. (eval (cdr org-html-table-row-tags)))
  2658. ;; End a rowgroup?
  2659. (when (org-export-table-row-ends-rowgroup-p table-row info)
  2660. (cdr rowgroup-tags))))))
  2661. ;;;; Table
  2662. (defun org-html-table-first-row-data-cells (table info)
  2663. "Transcode the first row of TABLE.
  2664. INFO is a plist used as a communication channel."
  2665. (let ((table-row
  2666. (org-element-map table 'table-row
  2667. (lambda (row)
  2668. (unless (eq (org-element-property :type row) 'rule) row))
  2669. info 'first-match))
  2670. (special-column-p (org-export-table-has-special-column-p table)))
  2671. (if (not special-column-p) (org-element-contents table-row)
  2672. (cdr (org-element-contents table-row)))))
  2673. (defun org-html-table--table.el-table (table info)
  2674. "Format table.el tables into HTML.
  2675. INFO is a plist used as a communication channel."
  2676. (when (eq (org-element-property :type table) 'table.el)
  2677. (require 'table)
  2678. (let ((outbuf (with-current-buffer
  2679. (get-buffer-create "*org-export-table*")
  2680. (erase-buffer) (current-buffer))))
  2681. (with-temp-buffer
  2682. (insert (org-element-property :value table))
  2683. (goto-char 1)
  2684. (re-search-forward "^[ \t]*|[^|]" nil t)
  2685. (table-generate-source 'html outbuf))
  2686. (with-current-buffer outbuf
  2687. (prog1 (org-trim (buffer-string))
  2688. (kill-buffer) )))))
  2689. (defun org-html-table (table contents info)
  2690. "Transcode a TABLE element from Org to HTML.
  2691. CONTENTS is the contents of the table. INFO is a plist holding
  2692. contextual information."
  2693. (case (org-element-property :type table)
  2694. ;; Case 1: table.el table. Convert it using appropriate tools.
  2695. (table.el (org-html-table--table.el-table table info))
  2696. ;; Case 2: Standard table.
  2697. (t
  2698. (let* ((label (org-element-property :name table))
  2699. (caption (org-export-get-caption table))
  2700. (attributes (mapconcat #'identity
  2701. (org-element-property :attr_html table)
  2702. " "))
  2703. (alignspec
  2704. (if (and (boundp 'org-html-format-table-no-css)
  2705. org-html-format-table-no-css)
  2706. "align=\"%s\"" "class=\"%s\""))
  2707. (table-column-specs
  2708. (function
  2709. (lambda (table info)
  2710. (mapconcat
  2711. (lambda (table-cell)
  2712. (let ((alignment (org-export-table-cell-alignment
  2713. table-cell info)))
  2714. (concat
  2715. ;; Begin a colgroup?
  2716. (when (org-export-table-cell-starts-colgroup-p
  2717. table-cell info)
  2718. "\n<colgroup>")
  2719. ;; Add a column. Also specify it's alignment.
  2720. (format "\n<col %s/>" (format alignspec alignment))
  2721. ;; End a colgroup?
  2722. (when (org-export-table-cell-ends-colgroup-p
  2723. table-cell info)
  2724. "\n</colgroup>"))))
  2725. (org-html-table-first-row-data-cells table info) "\n"))))
  2726. (table-attributes
  2727. (let ((table-tag (plist-get info :html-table-tag)))
  2728. (concat
  2729. (and (string-match "<table\\(.*\\)>" table-tag)
  2730. (match-string 1 table-tag))
  2731. (and label (format " id=\"%s\""
  2732. (org-export-solidify-link-text label)))
  2733. (unless (string= attributes "")
  2734. (concat " " attributes))))))
  2735. ;; Remove last blank line.
  2736. (setq contents (substring contents 0 -1))
  2737. (format "<table%s>\n%s\n%s\n%s\n</table>"
  2738. table-attributes
  2739. (if (not caption) ""
  2740. (format "<caption>%s</caption>"
  2741. (org-export-data caption info)))
  2742. (funcall table-column-specs table info)
  2743. contents)))))
  2744. ;;;; Target
  2745. (defun org-html-target (target contents info)
  2746. "Transcode a TARGET object from Org to HTML.
  2747. CONTENTS is nil. INFO is a plist holding contextual
  2748. information."
  2749. (let ((id (org-export-solidify-link-text
  2750. (org-element-property :value target))))
  2751. (org-html--anchor id)))
  2752. ;;;; Timestamp
  2753. (defun org-html-timestamp (timestamp contents info)
  2754. "Transcode a TIMESTAMP object from Org to HTML.
  2755. CONTENTS is nil. INFO is a plist holding contextual
  2756. information."
  2757. (let ((value (org-html-plain-text
  2758. (org-timestamp-translate timestamp) info)))
  2759. (format "<span class=\"timestamp-wrapper\"><span class=\"timestamp\">%s</span></span>"
  2760. (replace-regexp-in-string "--" "&#x2013;" value))))
  2761. ;;;; Underline
  2762. (defun org-html-underline (underline contents info)
  2763. "Transcode UNDERLINE from Org to HTML.
  2764. CONTENTS is the text with underline markup. INFO is a plist
  2765. holding contextual information."
  2766. (format (or (cdr (assq 'underline org-html-text-markup-alist)) "%s")
  2767. contents))
  2768. ;;;; Verbatim
  2769. (defun org-html-verbatim (verbatim contents info)
  2770. "Transcode VERBATIM from Org to HTML.
  2771. CONTENTS is nil. INFO is a plist holding contextual
  2772. information."
  2773. (format (or (cdr (assq 'verbatim org-html-text-markup-alist)) "%s")
  2774. (org-html-plain-text (org-element-property :value verbatim) info)))
  2775. ;;;; Verse Block
  2776. (defun org-html-verse-block (verse-block contents info)
  2777. "Transcode a VERSE-BLOCK element from Org to HTML.
  2778. CONTENTS is verse block contents. INFO is a plist holding
  2779. contextual information."
  2780. ;; Replace each newline character with line break. Also replace
  2781. ;; each blank line with a line break.
  2782. (setq contents (replace-regexp-in-string
  2783. "^ *\\\\\\\\$" "<br/>\n"
  2784. (replace-regexp-in-string
  2785. "\\(\\\\\\\\\\)?[ \t]*\n" " <br/>\n" contents)))
  2786. ;; Replace each white space at beginning of a line with a
  2787. ;; non-breaking space.
  2788. (while (string-match "^[ \t]+" contents)
  2789. (let* ((num-ws (length (match-string 0 contents)))
  2790. (ws (let (out) (dotimes (i num-ws out)
  2791. (setq out (concat out "&#xa0;"))))))
  2792. (setq contents (replace-match ws nil t contents))))
  2793. (format "<p class=\"verse\">\n%s</p>" contents))
  2794. ;;; Filter Functions
  2795. (defun org-html-final-function (contents backend info)
  2796. "Filter to indent the HTML and convert HTML entities."
  2797. (with-temp-buffer
  2798. (insert contents)
  2799. (set-auto-mode t)
  2800. (if org-html-indent
  2801. (indent-region (point-min) (point-max)))
  2802. (when org-html-use-unicode-chars
  2803. (require 'mm-url)
  2804. (mm-url-decode-entities))
  2805. (buffer-substring-no-properties (point-min) (point-max))))
  2806. ;;; End-user functions
  2807. ;;;###autoload
  2808. (defun org-html-export-as-html
  2809. (&optional async subtreep visible-only body-only ext-plist)
  2810. "Export current buffer to an HTML buffer.
  2811. If narrowing is active in the current buffer, only export its
  2812. narrowed part.
  2813. If a region is active, export that region.
  2814. A non-nil optional argument ASYNC means the process should happen
  2815. asynchronously. The resulting buffer should be accessible
  2816. through the `org-export-stack' interface.
  2817. When optional argument SUBTREEP is non-nil, export the sub-tree
  2818. at point, extracting information from the headline properties
  2819. first.
  2820. When optional argument VISIBLE-ONLY is non-nil, don't export
  2821. contents of hidden elements.
  2822. When optional argument BODY-ONLY is non-nil, only write code
  2823. between \"<body>\" and \"</body>\" tags.
  2824. EXT-PLIST, when provided, is a property list with external
  2825. parameters overriding Org default settings, but still inferior to
  2826. file-local settings.
  2827. Export is done in a buffer named \"*Org HTML Export*\", which
  2828. will be displayed when `org-export-show-temporary-export-buffer'
  2829. is non-nil."
  2830. (interactive)
  2831. (if async
  2832. (org-export-async-start
  2833. (lambda (output)
  2834. (with-current-buffer (get-buffer-create "*Org HTML Export*")
  2835. (erase-buffer)
  2836. (insert output)
  2837. (goto-char (point-min))
  2838. (set-auto-mode t)
  2839. (org-export-add-to-stack (current-buffer) 'html)))
  2840. `(org-export-as 'html ,subtreep ,visible-only ,body-only ',ext-plist))
  2841. (let ((outbuf (org-export-to-buffer
  2842. 'html "*Org HTML Export*"
  2843. subtreep visible-only body-only ext-plist)))
  2844. ;; Set major mode.
  2845. (with-current-buffer outbuf (set-auto-mode t))
  2846. (when org-export-show-temporary-export-buffer
  2847. (switch-to-buffer-other-window outbuf)))))
  2848. ;;;###autoload
  2849. (defun org-html-export-to-html
  2850. (&optional async subtreep visible-only body-only ext-plist)
  2851. "Export current buffer to a HTML file.
  2852. If narrowing is active in the current buffer, only export its
  2853. narrowed part.
  2854. If a region is active, export that region.
  2855. A non-nil optional argument ASYNC means the process should happen
  2856. asynchronously. The resulting file should be accessible through
  2857. the `org-export-stack' interface.
  2858. When optional argument SUBTREEP is non-nil, export the sub-tree
  2859. at point, extracting information from the headline properties
  2860. first.
  2861. When optional argument VISIBLE-ONLY is non-nil, don't export
  2862. contents of hidden elements.
  2863. When optional argument BODY-ONLY is non-nil, only write code
  2864. between \"<body>\" and \"</body>\" tags.
  2865. EXT-PLIST, when provided, is a property list with external
  2866. parameters overriding Org default settings, but still inferior to
  2867. file-local settings.
  2868. Return output file's name."
  2869. (interactive)
  2870. (let* ((extension (concat "." org-html-extension))
  2871. (file (org-export-output-file-name extension subtreep))
  2872. (org-export-coding-system org-html-coding-system))
  2873. (if async
  2874. (org-export-async-start
  2875. (lambda (f) (org-export-add-to-stack f 'html))
  2876. (let ((org-export-coding-system org-html-coding-system))
  2877. `(expand-file-name
  2878. (org-export-to-file
  2879. 'html ,file ,subtreep ,visible-only ,body-only ',ext-plist))))
  2880. (let ((org-export-coding-system org-html-coding-system))
  2881. (org-export-to-file
  2882. 'html file subtreep visible-only body-only ext-plist)))))
  2883. ;;;###autoload
  2884. (defun org-html-publish-to-html (plist filename pub-dir)
  2885. "Publish an org file to HTML.
  2886. FILENAME is the filename of the Org file to be published. PLIST
  2887. is the property list for the given project. PUB-DIR is the
  2888. publishing directory.
  2889. Return output file name."
  2890. (org-publish-org-to 'html filename ".html" plist pub-dir))
  2891. ;;; FIXME
  2892. ;;;; org-format-table-html
  2893. ;;;; org-format-org-table-html
  2894. ;;;; org-format-table-table-html
  2895. ;;;; org-table-number-fraction
  2896. ;;;; org-table-number-regexp
  2897. ;;;; org-html-table-caption-above
  2898. ;;;; org-html-inline-image-extensions
  2899. ;;;; org-export-preferred-target-alist
  2900. ;;;; class for anchors
  2901. ;;;; org-export-with-section-numbers, body-only
  2902. ;;;; org-export-mark-todo-in-toc
  2903. ;;;; org-html-format-org-link
  2904. ;;;; (caption (and caption (org-xml-encode-org-text caption)))
  2905. ;;;; alt = (file-name-nondirectory path)
  2906. (provide 'ox-html)
  2907. ;; Local variables:
  2908. ;; generated-autoload-file: "org-loaddefs.el"
  2909. ;; End:
  2910. ;;; ox-html.el ends here