ox-html.el 117 KB

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