ox-html.el 137 KB

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