ox-html.el 118 KB

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