ox-html.el 117 KB

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