ox-html.el 118 KB

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