ox-html.el 137 KB

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