ox-html.el 137 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727
  1. ;;; ox-html.el --- HTML Back-End for Org Export Engine -*- lexical-binding: t; -*-
  2. ;; Copyright (C) 2011-2016 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-2013 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-2013 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-2013 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 "25.2"
  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 "25.2"
  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-p': non-nil means the row starts a group
  850. `end-group-p': non-nil means the row ends a group
  851. `topp': non-nil means this is the top row
  852. `bottomp': 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-p end-group-p topp bottomp)
  856. \(cond (topp \"<tr class=\\\"tr-top\\\">\")
  857. \(bottomp \"<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 "http://cdn.mathjax.org/mathjax/latest/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. Please note that by using the default CDN one must agree with
  1059. MathJax CDN Terms of Service.
  1060. http://www.mathjax.org/mathjax-cdn-terms-of-service.html"
  1061. :group 'org-export-html
  1062. :package-version '(Org . "8.3")
  1063. :type '(list :greedy t
  1064. (list :tag "path (the path from where to load MathJax.js)"
  1065. (const :format " " path) (string))
  1066. (list :tag "scale (scaling for the displayed math)"
  1067. (const :format " " scale) (string))
  1068. (list :tag "align (alignment of displayed equations)"
  1069. (const :format " " align) (string))
  1070. (list :tag "font (used to display math)"
  1071. (const :format " " font)
  1072. (choice (const "TeX")
  1073. (const "STIX-Web")
  1074. (const "Asana-Math")
  1075. (const "Neo-Euler")
  1076. (const "Gyre-Pagella")
  1077. (const "Gyre-Termes")
  1078. (const "Latin-Modern")))
  1079. (list :tag "linebreaks (automatic line-breaking)"
  1080. (const :format " " linebreaks)
  1081. (choice (const "true")
  1082. (const "false")))
  1083. (list :tag "autonumber (when should equations be numbered)"
  1084. (const :format " " autonumber)
  1085. (choice (const "AMS")
  1086. (const "None")
  1087. (const "All")))
  1088. (list :tag "indent (indentation with left or right alignment)"
  1089. (const :format " " indent) (string))
  1090. (list :tag "multlinewidth (width to use for the multline environment)"
  1091. (const :format " " multlinewidth) (string))
  1092. (list :tag "tagindent (the indentation of tags from left or right)"
  1093. (const :format " " tagindent) (string))
  1094. (list :tag "tagside (location of tags)"
  1095. (const :format " " tagside)
  1096. (choice (const "left")
  1097. (const "right")))))
  1098. (defcustom org-html-mathjax-template
  1099. "<script type=\"text/x-mathjax-config\">
  1100. MathJax.Hub.Config({
  1101. displayAlign: \"%ALIGN\",
  1102. displayIndent: \"%INDENT\",
  1103. \"HTML-CSS\": { scale: %SCALE,
  1104. linebreaks: { automatic: \"%LINEBREAKS\" },
  1105. webFont: \"%FONT\"
  1106. },
  1107. SVG: {scale: %SCALE,
  1108. linebreaks: { automatic: \"%LINEBREAKS\" },
  1109. font: \"%FONT\"},
  1110. NativeMML: {scale: %SCALE},
  1111. TeX: { equationNumbers: {autoNumber: \"%AUTONUMBER\"},
  1112. MultLineWidth: \"%MULTLINEWIDTH\",
  1113. TagSide: \"%TAGSIDE\",
  1114. TagIndent: \"%TAGINDENT\"
  1115. }
  1116. });
  1117. </script>
  1118. <script type=\"text/javascript\"
  1119. src=\"%PATH\"></script>"
  1120. "The MathJax template. See also `org-html-mathjax-options'."
  1121. :group 'org-export-html
  1122. :type 'string)
  1123. ;;;; Template :: Postamble
  1124. (defcustom org-html-postamble 'auto
  1125. "Non-nil means insert a postamble in HTML export.
  1126. When set to `auto', check against the
  1127. `org-export-with-author/email/creator/date' variables to set the
  1128. content of the postamble. When set to a string, use this string
  1129. as the postamble. When t, insert a string as defined by the
  1130. formatting string in `org-html-postamble-format'.
  1131. When set to a function, apply this function and insert the
  1132. returned string. The function takes the property list of export
  1133. options as its only argument.
  1134. Setting :html-postamble in publishing projects will take
  1135. precedence over this variable."
  1136. :group 'org-export-html
  1137. :type '(choice (const :tag "No postamble" nil)
  1138. (const :tag "Auto postamble" auto)
  1139. (const :tag "Default formatting string" t)
  1140. (string :tag "Custom formatting string")
  1141. (function :tag "Function (must return a string)")))
  1142. (defcustom org-html-postamble-format
  1143. '(("en" "<p class=\"author\">Author: %a (%e)</p>
  1144. <p class=\"date\">Date: %d</p>
  1145. <p class=\"creator\">%c</p>
  1146. <p class=\"validation\">%v</p>"))
  1147. "Alist of languages and format strings for the HTML postamble.
  1148. The first element of each list is the language code, as used for
  1149. the LANGUAGE keyword. See `org-export-default-language'.
  1150. The second element of each list is a format string to format the
  1151. postamble itself. This format string can contain these elements:
  1152. %t stands for the title.
  1153. %s stands for the subtitle.
  1154. %a stands for the author's name.
  1155. %e stands for the author's email.
  1156. %d stands for the date.
  1157. %c will be replaced by `org-html-creator-string'.
  1158. %v will be replaced by `org-html-validation-link'.
  1159. %T will be replaced by the export time.
  1160. %C will be replaced by the last modification time.
  1161. If you need to use a \"%\" character, you need to escape it
  1162. like that: \"%%\"."
  1163. :group 'org-export-html
  1164. :type '(repeat
  1165. (list (string :tag "Language")
  1166. (string :tag "Format string"))))
  1167. (defcustom org-html-validation-link
  1168. "<a href=\"http://validator.w3.org/check?uri=referer\">Validate</a>"
  1169. "Link to HTML validation service."
  1170. :group 'org-export-html
  1171. :type 'string)
  1172. (defcustom org-html-creator-string
  1173. (format "<a href=\"http://www.gnu.org/software/emacs/\">Emacs</a> %s (<a href=\"http://orgmode.org\">Org</a> mode %s)"
  1174. emacs-version
  1175. (if (fboundp 'org-version) (org-version) "unknown version"))
  1176. "Information about the creator of the HTML document.
  1177. This option can also be set on with the CREATOR keyword."
  1178. :group 'org-export-html
  1179. :version "24.4"
  1180. :package-version '(Org . "8.0")
  1181. :type '(string :tag "Creator string"))
  1182. ;;;; Template :: Preamble
  1183. (defcustom org-html-preamble t
  1184. "Non-nil means insert a preamble in HTML export.
  1185. When t, insert a string as defined by the formatting string in
  1186. `org-html-preamble-format'. When set to a string, use this
  1187. formatting string instead (see `org-html-postamble-format' for an
  1188. example of such a formatting string).
  1189. When set to a function, apply this function and insert the
  1190. returned string. The function takes the property list of export
  1191. options as its only argument.
  1192. Setting :html-preamble in publishing projects will take
  1193. precedence over this variable."
  1194. :group 'org-export-html
  1195. :type '(choice (const :tag "No preamble" nil)
  1196. (const :tag "Default preamble" t)
  1197. (string :tag "Custom formatting string")
  1198. (function :tag "Function (must return a string)")))
  1199. (defcustom org-html-preamble-format '(("en" ""))
  1200. "Alist of languages and format strings for the HTML preamble.
  1201. The first element of each list is the language code, as used for
  1202. the LANGUAGE keyword. See `org-export-default-language'.
  1203. The second element of each list is a format string to format the
  1204. preamble itself. This format string can contain these elements:
  1205. %t stands for the title.
  1206. %s stands for the subtitle.
  1207. %a stands for the author's name.
  1208. %e stands for the author's email.
  1209. %d stands for the date.
  1210. %c will be replaced by `org-html-creator-string'.
  1211. %v will be replaced by `org-html-validation-link'.
  1212. %T will be replaced by the export time.
  1213. %C will be replaced by the last modification time.
  1214. If you need to use a \"%\" character, you need to escape it
  1215. like that: \"%%\".
  1216. See the default value of `org-html-postamble-format' for an
  1217. example."
  1218. :group 'org-export-html
  1219. :type '(repeat
  1220. (list (string :tag "Language")
  1221. (string :tag "Format string"))))
  1222. (defcustom org-html-link-up ""
  1223. "Where should the \"UP\" link of exported HTML pages lead?"
  1224. :group 'org-export-html
  1225. :type '(string :tag "File or URL"))
  1226. (defcustom org-html-link-home ""
  1227. "Where should the \"HOME\" link of exported HTML pages lead?"
  1228. :group 'org-export-html
  1229. :type '(string :tag "File or URL"))
  1230. (defcustom org-html-link-use-abs-url nil
  1231. "Should we prepend relative links with HTML_LINK_HOME?"
  1232. :group 'org-export-html
  1233. :version "24.4"
  1234. :package-version '(Org . "8.1")
  1235. :type 'boolean)
  1236. (defcustom org-html-home/up-format
  1237. "<div id=\"org-div-home-and-up\">
  1238. <a accesskey=\"h\" href=\"%s\"> UP </a>
  1239. |
  1240. <a accesskey=\"H\" href=\"%s\"> HOME </a>
  1241. </div>"
  1242. "Snippet used to insert the HOME and UP links.
  1243. This is a format string, the first %s will receive the UP link,
  1244. the second the HOME link. If both `org-html-link-up' and
  1245. `org-html-link-home' are empty, the entire snippet will be
  1246. ignored."
  1247. :group 'org-export-html
  1248. :type 'string)
  1249. ;;;; Template :: Scripts
  1250. (defcustom org-html-head-include-scripts t
  1251. "Non-nil means include the JavaScript snippets in exported HTML files.
  1252. The actual script is defined in `org-html-scripts' and should
  1253. not be modified."
  1254. :group 'org-export-html
  1255. :version "24.4"
  1256. :package-version '(Org . "8.0")
  1257. :type 'boolean)
  1258. ;;;; Template :: Styles
  1259. (defcustom org-html-head-include-default-style t
  1260. "Non-nil means include the default style in exported HTML files.
  1261. The actual style is defined in `org-html-style-default' and
  1262. should not be modified. Use `org-html-head' to use your own
  1263. style information."
  1264. :group 'org-export-html
  1265. :version "24.4"
  1266. :package-version '(Org . "8.0")
  1267. :type 'boolean)
  1268. ;;;###autoload
  1269. (put 'org-html-head-include-default-style 'safe-local-variable 'booleanp)
  1270. (defcustom org-html-head ""
  1271. "Org-wide head definitions for exported HTML files.
  1272. This variable can contain the full HTML structure to provide a
  1273. style, including the surrounding HTML tags. You can consider
  1274. including definitions for the following classes: title, todo,
  1275. done, timestamp, timestamp-kwd, tag, target.
  1276. For example, a valid value would be:
  1277. <style type=\"text/css\">
  1278. <![CDATA[
  1279. p { font-weight: normal; color: gray; }
  1280. h1 { color: black; }
  1281. .title { text-align: center; }
  1282. .todo, .timestamp-kwd { color: red; }
  1283. .done { color: green; }
  1284. ]]>
  1285. </style>
  1286. If you want to refer to an external style, use something like
  1287. <link rel=\"stylesheet\" type=\"text/css\" href=\"mystyles.css\" />
  1288. As the value of this option simply gets inserted into the HTML
  1289. <head> header, you can use it to add any arbitrary text to the
  1290. header.
  1291. You can set this on a per-file basis using #+HTML_HEAD:,
  1292. or for publication projects using the :html-head property."
  1293. :group 'org-export-html
  1294. :version "24.4"
  1295. :package-version '(Org . "8.0")
  1296. :type 'string)
  1297. ;;;###autoload
  1298. (put 'org-html-head 'safe-local-variable 'stringp)
  1299. (defcustom org-html-head-extra ""
  1300. "More head information to add in the HTML output.
  1301. You can set this on a per-file basis using #+HTML_HEAD_EXTRA:,
  1302. or for publication projects using the :html-head-extra property."
  1303. :group 'org-export-html
  1304. :version "24.4"
  1305. :package-version '(Org . "8.0")
  1306. :type 'string)
  1307. ;;;###autoload
  1308. (put 'org-html-head-extra 'safe-local-variable 'stringp)
  1309. ;;;; Template :: Viewport
  1310. (defcustom org-html-viewport '((width "device-width")
  1311. (initial-scale "1")
  1312. (minimum-scale "")
  1313. (maximum-scale "")
  1314. (user-scalable ""))
  1315. "Viewport options for mobile-optimized sites.
  1316. The following values are recognized
  1317. width Size of the viewport.
  1318. initial-scale Zoom level when the page is first loaded.
  1319. minimum-scale Minimum allowed zoom level.
  1320. maximum-scale Maximum allowed zoom level.
  1321. user-scalable Whether zoom can be changed.
  1322. The viewport meta tag is inserted if this variable is non-nil.
  1323. See the following site for a reference:
  1324. https://developer.mozilla.org/en-US/docs/Mozilla/Mobile/Viewport_meta_tag"
  1325. :group 'org-export-html
  1326. :version "25.2"
  1327. :package-version '(Org . "8.3")
  1328. :type '(choice (const :tag "Disable" nil)
  1329. (list :tag "Enable"
  1330. (list :tag "Width of viewport"
  1331. (const :format " " width)
  1332. (choice (const :tag "unset" "")
  1333. (string)))
  1334. (list :tag "Initial scale"
  1335. (const :format " " initial-scale)
  1336. (choice (const :tag "unset" "")
  1337. (string)))
  1338. (list :tag "Minimum scale/zoom"
  1339. (const :format " " minimum-scale)
  1340. (choice (const :tag "unset" "")
  1341. (string)))
  1342. (list :tag "Maximum scale/zoom"
  1343. (const :format " " maximum-scale)
  1344. (choice (const :tag "unset" "")
  1345. (string)))
  1346. (list :tag "User scalable/zoomable"
  1347. (const :format " " user-scalable)
  1348. (choice (const :tag "unset" "")
  1349. (const "true")
  1350. (const "false"))))))
  1351. ;;;; Todos
  1352. (defcustom org-html-todo-kwd-class-prefix ""
  1353. "Prefix to class names for TODO keywords.
  1354. Each TODO keyword gets a class given by the keyword itself, with this prefix.
  1355. The default prefix is empty because it is nice to just use the keyword
  1356. as a class name. But if you get into conflicts with other, existing
  1357. CSS classes, then this prefix can be very useful."
  1358. :group 'org-export-html
  1359. :type 'string)
  1360. ;;; Internal Functions
  1361. (defun org-html-xhtml-p (info)
  1362. (let ((dt (downcase (plist-get info :html-doctype))))
  1363. (string-match-p "xhtml" dt)))
  1364. (defun org-html-html5-p (info)
  1365. (let ((dt (downcase (plist-get info :html-doctype))))
  1366. (member dt '("html5" "xhtml5" "<!doctype html>"))))
  1367. (defun org-html--html5-fancy-p (info)
  1368. "Non-nil when exporting to HTML5 with fancy elements.
  1369. INFO is the current state of the export process, as a plist."
  1370. (and (plist-get info :html-html5-fancy)
  1371. (org-html-html5-p info)))
  1372. (defun org-html-close-tag (tag attr info)
  1373. (concat "<" tag " " attr
  1374. (if (org-html-xhtml-p info) " />" ">")))
  1375. (defun org-html-doctype (info)
  1376. "Return correct html doctype tag from `org-html-doctype-alist',
  1377. or the literal value of :html-doctype from INFO if :html-doctype
  1378. is not found in the alist.
  1379. INFO is a plist used as a communication channel."
  1380. (let ((dt (plist-get info :html-doctype)))
  1381. (or (cdr (assoc dt org-html-doctype-alist)) dt)))
  1382. (defun org-html--make-attribute-string (attributes)
  1383. "Return a list of attributes, as a string.
  1384. ATTRIBUTES is a plist where values are either strings or nil. An
  1385. attributes with a nil value will be omitted from the result."
  1386. (let (output)
  1387. (dolist (item attributes (mapconcat 'identity (nreverse output) " "))
  1388. (cond ((null item) (pop output))
  1389. ((symbolp item) (push (substring (symbol-name item) 1) output))
  1390. (t (let ((key (car output))
  1391. (value (replace-regexp-in-string
  1392. "\"" "&quot;" (org-html-encode-plain-text item))))
  1393. (setcar output (format "%s=\"%s\"" key value))))))))
  1394. (defun org-html--wrap-image (contents info &optional caption label)
  1395. "Wrap CONTENTS string within an appropriate environment for images.
  1396. INFO is a plist used as a communication channel. When optional
  1397. arguments CAPTION and LABEL are given, use them for caption and
  1398. \"id\" attribute."
  1399. (let ((html5-fancy (org-html--html5-fancy-p info)))
  1400. (format (if html5-fancy "\n<figure%s>%s%s\n</figure>"
  1401. "\n<div%s class=\"figure\">%s%s\n</div>")
  1402. ;; ID.
  1403. (if (org-string-nw-p label) (format " id=\"%s\"" label) "")
  1404. ;; Contents.
  1405. (format "\n<p>%s</p>" contents)
  1406. ;; Caption.
  1407. (if (not (org-string-nw-p caption)) ""
  1408. (format (if html5-fancy "\n<figcaption>%s</figcaption>"
  1409. "\n<p>%s</p>")
  1410. caption)))))
  1411. (defun org-html--format-image (source attributes info)
  1412. "Return \"img\" tag with given SOURCE and ATTRIBUTES.
  1413. SOURCE is a string specifying the location of the image.
  1414. ATTRIBUTES is a plist, as returned by
  1415. `org-export-read-attribute'. INFO is a plist used as
  1416. a communication channel."
  1417. (if (string= "svg" (file-name-extension source))
  1418. (org-html--svg-image source attributes info)
  1419. (org-html-close-tag
  1420. "img"
  1421. (org-html--make-attribute-string
  1422. (org-combine-plists
  1423. (list :src source
  1424. :alt (if (string-match-p "^ltxpng/" source)
  1425. (org-html-encode-plain-text
  1426. (org-find-text-property-in-string 'org-latex-src source))
  1427. (file-name-nondirectory source)))
  1428. attributes))
  1429. info)))
  1430. (defun org-html--svg-image (source attributes info)
  1431. "Return \"object\" embedding svg file SOURCE with given ATTRIBUTES.
  1432. INFO is a plist used as a communication channel.
  1433. The special attribute \"fallback\" can be used to specify a
  1434. fallback image file to use if the object embedding is not
  1435. supported. CSS class \"org-svg\" is assigned as the class of the
  1436. object unless a different class is specified with an attribute."
  1437. (let ((fallback (plist-get attributes :fallback))
  1438. (attrs (org-html--make-attribute-string
  1439. (org-combine-plists
  1440. ;; Remove fallback attribute, which is not meant to
  1441. ;; appear directly in the attributes string, and
  1442. ;; provide a default class if none is set.
  1443. '(:class "org-svg") attributes '(:fallback nil)))))
  1444. (format "<object type=\"image/svg+xml\" data=\"%s\" %s>\n%s</object>"
  1445. source
  1446. attrs
  1447. (if fallback
  1448. (org-html-close-tag
  1449. "img" (format "src=\"%s\" %s" fallback attrs) info)
  1450. "Sorry, your browser does not support SVG."))))
  1451. (defun org-html--textarea-block (element)
  1452. "Transcode ELEMENT into a textarea block.
  1453. ELEMENT is either a src block or an example block."
  1454. (let* ((code (car (org-export-unravel-code element)))
  1455. (attr (org-export-read-attribute :attr_html element)))
  1456. (format "<p>\n<textarea cols=\"%s\" rows=\"%s\">\n%s</textarea>\n</p>"
  1457. (or (plist-get attr :width) 80)
  1458. (or (plist-get attr :height) (org-count-lines code))
  1459. code)))
  1460. (defun org-html--has-caption-p (element &optional _info)
  1461. "Non-nil when ELEMENT has a caption affiliated keyword.
  1462. INFO is a plist used as a communication channel. This function
  1463. is meant to be used as a predicate for `org-export-get-ordinal' or
  1464. a value to `org-html-standalone-image-predicate'."
  1465. (org-element-property :caption element))
  1466. ;;;; Table
  1467. (defun org-html-htmlize-region-for-paste (beg end)
  1468. "Convert the region between BEG and END to HTML, using htmlize.el.
  1469. This is much like `htmlize-region-for-paste', only that it uses
  1470. the settings define in the org-... variables."
  1471. (let* ((htmlize-output-type org-html-htmlize-output-type)
  1472. (htmlize-css-name-prefix org-html-htmlize-font-prefix)
  1473. (htmlbuf (htmlize-region beg end)))
  1474. (unwind-protect
  1475. (with-current-buffer htmlbuf
  1476. (buffer-substring (plist-get htmlize-buffer-places 'content-start)
  1477. (plist-get htmlize-buffer-places 'content-end)))
  1478. (kill-buffer htmlbuf))))
  1479. ;;;###autoload
  1480. (defun org-html-htmlize-generate-css ()
  1481. "Create the CSS for all font definitions in the current Emacs session.
  1482. Use this to create face definitions in your CSS style file that can then
  1483. be used by code snippets transformed by htmlize.
  1484. This command just produces a buffer that contains class definitions for all
  1485. faces used in the current Emacs session. You can copy and paste the ones you
  1486. need into your CSS file.
  1487. If you then set `org-html-htmlize-output-type' to `css', calls
  1488. to the function `org-html-htmlize-region-for-paste' will
  1489. produce code that uses these same face definitions."
  1490. (interactive)
  1491. (require 'htmlize)
  1492. (and (get-buffer "*html*") (kill-buffer "*html*"))
  1493. (with-temp-buffer
  1494. (let ((fl (face-list))
  1495. (htmlize-css-name-prefix "org-")
  1496. (htmlize-output-type 'css)
  1497. f i)
  1498. (while (setq f (pop fl)
  1499. i (and f (face-attribute f :inherit)))
  1500. (when (and (symbolp f) (or (not i) (not (listp i))))
  1501. (insert (org-add-props (copy-sequence "1") nil 'face f))))
  1502. (htmlize-region (point-min) (point-max))))
  1503. (pop-to-buffer-same-window "*html*")
  1504. (goto-char (point-min))
  1505. (if (re-search-forward "<style" nil t)
  1506. (delete-region (point-min) (match-beginning 0)))
  1507. (if (re-search-forward "</style>" nil t)
  1508. (delete-region (1+ (match-end 0)) (point-max)))
  1509. (beginning-of-line 1)
  1510. (if (looking-at " +") (replace-match ""))
  1511. (goto-char (point-min)))
  1512. (defun org-html--make-string (n string)
  1513. "Build a string by concatenating N times STRING."
  1514. (let (out) (dotimes (_ n out) (setq out (concat string out)))))
  1515. (defun org-html-fix-class-name (kwd) ; audit callers of this function
  1516. "Turn todo keyword KWD into a valid class name.
  1517. Replaces invalid characters with \"_\"."
  1518. (replace-regexp-in-string "[^a-zA-Z0-9_]" "_" kwd nil t))
  1519. (defun org-html-footnote-section (info)
  1520. "Format the footnote section.
  1521. INFO is a plist used as a communication channel."
  1522. (let* ((fn-alist (org-export-collect-footnote-definitions info))
  1523. (fn-alist
  1524. (cl-loop for (n _type raw) in fn-alist collect
  1525. (cons n (if (eq (org-element-type raw) 'org-data)
  1526. (org-trim (org-export-data raw info))
  1527. (format "<div class=\"footpara\">%s</div>"
  1528. (org-trim (org-export-data raw info))))))))
  1529. (when fn-alist
  1530. (format
  1531. (plist-get info :html-footnotes-section)
  1532. (org-html--translate "Footnotes" info)
  1533. (format
  1534. "\n%s\n"
  1535. (mapconcat
  1536. (lambda (fn)
  1537. (let ((n (car fn)) (def (cdr fn)))
  1538. (format
  1539. "<div class=\"footdef\">%s %s</div>\n"
  1540. (format
  1541. (plist-get info :html-footnote-format)
  1542. (org-html--anchor
  1543. (format "fn.%d" n)
  1544. n
  1545. (format " class=\"footnum\" href=\"#fnr.%d\"" n)
  1546. info))
  1547. def)))
  1548. fn-alist
  1549. "\n"))))))
  1550. ;;; Template
  1551. (defun org-html--build-meta-info (info)
  1552. "Return meta tags for exported document.
  1553. INFO is a plist used as a communication channel."
  1554. (let ((protect-string
  1555. (lambda (str)
  1556. (replace-regexp-in-string
  1557. "\"" "&quot;" (org-html-encode-plain-text str))))
  1558. (title (org-export-data (plist-get info :title) info))
  1559. (author (and (plist-get info :with-author)
  1560. (let ((auth (plist-get info :author)))
  1561. (and auth
  1562. ;; Return raw Org syntax, skipping non
  1563. ;; exportable objects.
  1564. (org-element-interpret-data
  1565. (org-element-map auth
  1566. (cons 'plain-text org-element-all-objects)
  1567. 'identity info))))))
  1568. (description (plist-get info :description))
  1569. (keywords (plist-get info :keywords))
  1570. (charset (or (and org-html-coding-system
  1571. (fboundp 'coding-system-get)
  1572. (coding-system-get org-html-coding-system
  1573. 'mime-charset))
  1574. "iso-8859-1")))
  1575. (concat
  1576. (when (plist-get info :time-stamp-file)
  1577. (format-time-string
  1578. (concat "<!-- "
  1579. (plist-get info :html-metadata-timestamp-format)
  1580. " -->\n")))
  1581. (format
  1582. (if (org-html-html5-p info)
  1583. (org-html-close-tag "meta" "charset=\"%s\"" info)
  1584. (org-html-close-tag
  1585. "meta" "http-equiv=\"Content-Type\" content=\"text/html;charset=%s\""
  1586. info))
  1587. charset) "\n"
  1588. (let ((viewport-options
  1589. (cl-remove-if-not (lambda (cell) (org-string-nw-p (cadr cell)))
  1590. (plist-get info :html-viewport))))
  1591. (and viewport-options
  1592. (concat
  1593. (org-html-close-tag
  1594. "meta"
  1595. (format "name=\"viewport\" content=\"%s\""
  1596. (mapconcat
  1597. (lambda (elm) (format "%s=%s" (car elm) (cadr elm)))
  1598. viewport-options ", "))
  1599. info)
  1600. "\n")))
  1601. (format "<title>%s</title>\n" title)
  1602. (org-html-close-tag "meta" "name=\"generator\" content=\"Org mode\"" info)
  1603. "\n"
  1604. (and (org-string-nw-p author)
  1605. (concat
  1606. (org-html-close-tag "meta"
  1607. (format "name=\"author\" content=\"%s\""
  1608. (funcall protect-string author))
  1609. info)
  1610. "\n"))
  1611. (and (org-string-nw-p description)
  1612. (concat
  1613. (org-html-close-tag "meta"
  1614. (format "name=\"description\" content=\"%s\"\n"
  1615. (funcall protect-string description))
  1616. info)
  1617. "\n"))
  1618. (and (org-string-nw-p keywords)
  1619. (concat
  1620. (org-html-close-tag "meta"
  1621. (format "name=\"keywords\" content=\"%s\""
  1622. (funcall protect-string keywords))
  1623. info)
  1624. "\n")))))
  1625. (defun org-html--build-head (info)
  1626. "Return information for the <head>..</head> of the HTML output.
  1627. INFO is a plist used as a communication channel."
  1628. (org-element-normalize-string
  1629. (concat
  1630. (when (plist-get info :html-head-include-default-style)
  1631. (org-element-normalize-string org-html-style-default))
  1632. (org-element-normalize-string (plist-get info :html-head))
  1633. (org-element-normalize-string (plist-get info :html-head-extra))
  1634. (when (and (plist-get info :html-htmlized-css-url)
  1635. (eq org-html-htmlize-output-type 'css))
  1636. (org-html-close-tag "link"
  1637. (format "rel=\"stylesheet\" href=\"%s\" type=\"text/css\""
  1638. (plist-get info :html-htmlized-css-url))
  1639. info))
  1640. (when (plist-get info :html-head-include-scripts) org-html-scripts))))
  1641. (defun org-html--build-mathjax-config (info)
  1642. "Insert the user setup into the mathjax template.
  1643. INFO is a plist used as a communication channel."
  1644. (when (and (memq (plist-get info :with-latex) '(mathjax t))
  1645. (org-element-map (plist-get info :parse-tree)
  1646. '(latex-fragment latex-environment) 'identity info t))
  1647. (let ((template (plist-get info :html-mathjax-template))
  1648. (options (plist-get info :html-mathjax-options))
  1649. (in-buffer (or (plist-get info :html-mathjax) "")))
  1650. (dolist (e options (org-element-normalize-string template))
  1651. (let ((name (car e))
  1652. (val (nth 1 e)))
  1653. (when (string-match (concat "\\<" (symbol-name name) ":") in-buffer)
  1654. (setq val
  1655. (car (read-from-string (substring in-buffer (match-end 0))))))
  1656. (unless (stringp val) (setq val (format "%s" val)))
  1657. (while (string-match (concat "%" (upcase (symbol-name name)))
  1658. template)
  1659. (setq template (replace-match val t t template))))))))
  1660. (defun org-html-format-spec (info)
  1661. "Return format specification for elements that can be
  1662. used in the preamble or postamble."
  1663. `((?t . ,(org-export-data (plist-get info :title) info))
  1664. (?s . ,(org-export-data (plist-get info :subtitle) info))
  1665. (?d . ,(org-export-data (org-export-get-date info) info))
  1666. (?T . ,(format-time-string
  1667. (plist-get info :html-metadata-timestamp-format)))
  1668. (?a . ,(org-export-data (plist-get info :author) info))
  1669. (?e . ,(mapconcat
  1670. (lambda (e)
  1671. (format "<a href=\"mailto:%s\">%s</a>" e e))
  1672. (split-string (plist-get info :email) ",+ *")
  1673. ", "))
  1674. (?c . ,(plist-get info :creator))
  1675. (?C . ,(let ((file (plist-get info :input-file)))
  1676. (format-time-string
  1677. (plist-get info :html-metadata-timestamp-format)
  1678. (when file (nth 5 (file-attributes file))))))
  1679. (?v . ,(or (plist-get info :html-validation-link) ""))))
  1680. (defun org-html--build-pre/postamble (type info)
  1681. "Return document preamble or postamble as a string, or nil.
  1682. TYPE is either `preamble' or `postamble', INFO is a plist used as a
  1683. communication channel."
  1684. (let ((section (plist-get info (intern (format ":html-%s" type))))
  1685. (spec (org-html-format-spec info)))
  1686. (when section
  1687. (let ((section-contents
  1688. (if (functionp section) (funcall section info)
  1689. (cond
  1690. ((stringp section) (format-spec section spec))
  1691. ((eq section 'auto)
  1692. (let ((date (cdr (assq ?d spec)))
  1693. (author (cdr (assq ?a spec)))
  1694. (email (cdr (assq ?e spec)))
  1695. (creator (cdr (assq ?c spec)))
  1696. (validation-link (cdr (assq ?v spec))))
  1697. (concat
  1698. (when (and (plist-get info :with-date)
  1699. (org-string-nw-p date))
  1700. (format "<p class=\"date\">%s: %s</p>\n"
  1701. (org-html--translate "Date" info)
  1702. date))
  1703. (when (and (plist-get info :with-author)
  1704. (org-string-nw-p author))
  1705. (format "<p class=\"author\">%s: %s</p>\n"
  1706. (org-html--translate "Author" info)
  1707. author))
  1708. (when (and (plist-get info :with-email)
  1709. (org-string-nw-p email))
  1710. (format "<p class=\"email\">%s: %s</p>\n"
  1711. (org-html--translate "Email" info)
  1712. email))
  1713. (when (plist-get info :time-stamp-file)
  1714. (format
  1715. "<p class=\"date\">%s: %s</p>\n"
  1716. (org-html--translate "Created" info)
  1717. (format-time-string
  1718. (plist-get info :html-metadata-timestamp-format))))
  1719. (when (plist-get info :with-creator)
  1720. (format "<p class=\"creator\">%s</p>\n" creator))
  1721. (format "<p class=\"validation\">%s</p>\n"
  1722. validation-link))))
  1723. (t (format-spec
  1724. (or (cadr (assoc-string
  1725. (plist-get info :language)
  1726. (eval (intern
  1727. (format "org-html-%s-format" type)))
  1728. t))
  1729. (cadr
  1730. (assoc-string
  1731. "en"
  1732. (eval
  1733. (intern (format "org-html-%s-format" type)))
  1734. t)))
  1735. spec))))))
  1736. (let ((div (assq type (plist-get info :html-divs))))
  1737. (when (org-string-nw-p section-contents)
  1738. (concat
  1739. (format "<%s id=\"%s\" class=\"%s\">\n"
  1740. (nth 1 div)
  1741. (nth 2 div)
  1742. org-html--pre/postamble-class)
  1743. (org-element-normalize-string section-contents)
  1744. (format "</%s>\n" (nth 1 div)))))))))
  1745. (defun org-html-inner-template (contents info)
  1746. "Return body of document string after HTML conversion.
  1747. CONTENTS is the transcoded contents string. INFO is a plist
  1748. holding export options."
  1749. (concat
  1750. ;; Table of contents.
  1751. (let ((depth (plist-get info :with-toc)))
  1752. (when depth (org-html-toc depth info)))
  1753. ;; Document contents.
  1754. contents
  1755. ;; Footnotes section.
  1756. (org-html-footnote-section info)))
  1757. (defun org-html-template (contents info)
  1758. "Return complete document string after HTML conversion.
  1759. CONTENTS is the transcoded contents string. INFO is a plist
  1760. holding export options."
  1761. (concat
  1762. (when (and (not (org-html-html5-p info)) (org-html-xhtml-p info))
  1763. (let* ((xml-declaration (plist-get info :html-xml-declaration))
  1764. (decl (or (and (stringp xml-declaration) xml-declaration)
  1765. (cdr (assoc (plist-get info :html-extension)
  1766. xml-declaration))
  1767. (cdr (assoc "html" xml-declaration))
  1768. "")))
  1769. (when (not (or (not decl) (string= "" decl)))
  1770. (format "%s\n"
  1771. (format decl
  1772. (or (and org-html-coding-system
  1773. (fboundp 'coding-system-get)
  1774. (coding-system-get org-html-coding-system 'mime-charset))
  1775. "iso-8859-1"))))))
  1776. (org-html-doctype info)
  1777. "\n"
  1778. (concat "<html"
  1779. (cond ((org-html-xhtml-p info)
  1780. (format
  1781. " xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"%s\" xml:lang=\"%s\""
  1782. (plist-get info :language) (plist-get info :language)))
  1783. ((org-html-html5-p info)
  1784. (format " lang=\"%s\"" (plist-get info :language))))
  1785. ">\n")
  1786. "<head>\n"
  1787. (org-html--build-meta-info info)
  1788. (org-html--build-head info)
  1789. (org-html--build-mathjax-config info)
  1790. "</head>\n"
  1791. "<body>\n"
  1792. (let ((link-up (org-trim (plist-get info :html-link-up)))
  1793. (link-home (org-trim (plist-get info :html-link-home))))
  1794. (unless (and (string= link-up "") (string= link-home ""))
  1795. (format (plist-get info :html-home/up-format)
  1796. (or link-up link-home)
  1797. (or link-home link-up))))
  1798. ;; Preamble.
  1799. (org-html--build-pre/postamble 'preamble info)
  1800. ;; Document contents.
  1801. (let ((div (assq 'content (plist-get info :html-divs))))
  1802. (format "<%s id=\"%s\">\n" (nth 1 div) (nth 2 div)))
  1803. ;; Document title.
  1804. (when (plist-get info :with-title)
  1805. (let ((title (plist-get info :title))
  1806. (subtitle (plist-get info :subtitle))
  1807. (html5-fancy (org-html--html5-fancy-p info)))
  1808. (when title
  1809. (format
  1810. (if html5-fancy
  1811. "<header>\n<h1 class=\"title\">%s</h1>\n%s</header>"
  1812. "<h1 class=\"title\">%s%s</h1>\n")
  1813. (org-export-data title info)
  1814. (if subtitle
  1815. (format
  1816. (if html5-fancy
  1817. "<p class=\"subtitle\">%s</p>\n"
  1818. "\n<br>\n<span class=\"subtitle\">%s</span>\n")
  1819. (org-export-data subtitle info))
  1820. "")))))
  1821. contents
  1822. (format "</%s>\n" (nth 1 (assq 'content (plist-get info :html-divs))))
  1823. ;; Postamble.
  1824. (org-html--build-pre/postamble 'postamble info)
  1825. ;; Closing document.
  1826. "</body>\n</html>"))
  1827. (defun org-html--translate (s info)
  1828. "Translate string S according to specified language.
  1829. INFO is a plist used as a communication channel."
  1830. (org-export-translate s :html info))
  1831. ;;;; Anchor
  1832. (defun org-html--anchor (id desc attributes info)
  1833. "Format a HTML anchor."
  1834. (let* ((name (and (plist-get info :html-allow-name-attribute-in-anchors) id))
  1835. (attributes (concat (and id (format " id=\"%s\"" id))
  1836. (and name (format " name=\"%s\"" name))
  1837. attributes)))
  1838. (format "<a%s>%s</a>" attributes (or desc ""))))
  1839. ;;;; Todo
  1840. (defun org-html--todo (todo info)
  1841. "Format TODO keywords into HTML."
  1842. (when todo
  1843. (format "<span class=\"%s %s%s\">%s</span>"
  1844. (if (member todo org-done-keywords) "done" "todo")
  1845. (or (plist-get info :html-todo-kwd-class-prefix) "")
  1846. (org-html-fix-class-name todo)
  1847. todo)))
  1848. ;;;; Priority
  1849. (defun org-html--priority (priority _info)
  1850. "Format a priority into HTML.
  1851. PRIORITY is the character code of the priority or nil. INFO is
  1852. a plist containing export options."
  1853. (and priority (format "<span class=\"priority\">[%c]</span>" priority)))
  1854. ;;;; Tags
  1855. (defun org-html--tags (tags info)
  1856. "Format TAGS into HTML.
  1857. INFO is a plist containing export options."
  1858. (when tags
  1859. (format "<span class=\"tag\">%s</span>"
  1860. (mapconcat
  1861. (lambda (tag)
  1862. (format "<span class=\"%s\">%s</span>"
  1863. (concat (plist-get info :html-tag-class-prefix)
  1864. (org-html-fix-class-name tag))
  1865. tag))
  1866. tags "&#xa0;"))))
  1867. ;;;; Src Code
  1868. (defun org-html-fontify-code (code lang)
  1869. "Color CODE with htmlize library.
  1870. CODE is a string representing the source code to colorize. LANG
  1871. is the language used for CODE, as a string, or nil."
  1872. (when code
  1873. (cond
  1874. ;; Case 1: No lang. Possibly an example block.
  1875. ((not lang)
  1876. ;; Simple transcoding.
  1877. (org-html-encode-plain-text code))
  1878. ;; Case 2: No htmlize or an inferior version of htmlize
  1879. ((not (and (require 'htmlize nil t) (fboundp 'htmlize-region-for-paste)))
  1880. ;; Emit a warning.
  1881. (message "Cannot fontify src block (htmlize.el >= 1.34 required)")
  1882. ;; Simple transcoding.
  1883. (org-html-encode-plain-text code))
  1884. ;; Case 3: plain text explicitly set
  1885. ((not org-html-htmlize-output-type)
  1886. ;; Simple transcoding.
  1887. (org-html-encode-plain-text code))
  1888. (t
  1889. ;; Map language
  1890. (setq lang (or (assoc-default lang org-src-lang-modes) lang))
  1891. (let* ((lang-mode (and lang (intern (format "%s-mode" lang)))))
  1892. (cond
  1893. ;; Case 1: Language is not associated with any Emacs mode
  1894. ((not (functionp lang-mode))
  1895. ;; Simple transcoding.
  1896. (org-html-encode-plain-text code))
  1897. ;; Case 2: Default. Fontify code.
  1898. (t
  1899. ;; htmlize
  1900. (setq code
  1901. (let ((output-type org-html-htmlize-output-type)
  1902. (font-prefix org-html-htmlize-font-prefix))
  1903. (with-temp-buffer
  1904. ;; Switch to language-specific mode.
  1905. (funcall lang-mode)
  1906. (insert code)
  1907. ;; Fontify buffer.
  1908. (org-font-lock-ensure)
  1909. ;; Remove formatting on newline characters.
  1910. (save-excursion
  1911. (let ((beg (point-min))
  1912. (end (point-max)))
  1913. (goto-char beg)
  1914. (while (progn (end-of-line) (< (point) end))
  1915. (put-text-property (point) (1+ (point)) 'face nil)
  1916. (forward-char 1))))
  1917. (org-src-mode)
  1918. (set-buffer-modified-p nil)
  1919. ;; Htmlize region.
  1920. (let ((org-html-htmlize-output-type output-type)
  1921. (org-html-htmlize-font-prefix font-prefix))
  1922. (org-html-htmlize-region-for-paste
  1923. (point-min) (point-max))))))
  1924. ;; Strip any enclosing <pre></pre> tags.
  1925. (let* ((beg (and (string-match "\\`<pre[^>]*>\n*" code) (match-end 0)))
  1926. (end (and beg (string-match "</pre>\\'" code))))
  1927. (if (and beg end) (substring code beg end) code)))))))))
  1928. (defun org-html-do-format-code
  1929. (code &optional lang refs retain-labels num-start)
  1930. "Format CODE string as source code.
  1931. Optional arguments LANG, REFS, RETAIN-LABELS and NUM-START are,
  1932. respectively, the language of the source code, as a string, an
  1933. alist between line numbers and references (as returned by
  1934. `org-export-unravel-code'), a boolean specifying if labels should
  1935. appear in the source code, and the number associated to the first
  1936. line of code."
  1937. (let* ((code-lines (org-split-string code "\n"))
  1938. (code-length (length code-lines))
  1939. (num-fmt
  1940. (and num-start
  1941. (format "%%%ds: "
  1942. (length (number-to-string (+ code-length num-start))))))
  1943. (code (org-html-fontify-code code lang)))
  1944. (org-export-format-code
  1945. code
  1946. (lambda (loc line-num ref)
  1947. (setq loc
  1948. (concat
  1949. ;; Add line number, if needed.
  1950. (when num-start
  1951. (format "<span class=\"linenr\">%s</span>"
  1952. (format num-fmt line-num)))
  1953. ;; Transcoded src line.
  1954. loc
  1955. ;; Add label, if needed.
  1956. (when (and ref retain-labels) (format " (%s)" ref))))
  1957. ;; Mark transcoded line as an anchor, if needed.
  1958. (if (not ref) loc
  1959. (format "<span id=\"coderef-%s\" class=\"coderef-off\">%s</span>"
  1960. ref loc)))
  1961. num-start refs)))
  1962. (defun org-html-format-code (element info)
  1963. "Format contents of ELEMENT as source code.
  1964. ELEMENT is either an example block or a src block. INFO is
  1965. a plist used as a communication channel."
  1966. (let* ((lang (org-element-property :language element))
  1967. ;; Extract code and references.
  1968. (code-info (org-export-unravel-code element))
  1969. (code (car code-info))
  1970. (refs (cdr code-info))
  1971. ;; Does the src block contain labels?
  1972. (retain-labels (org-element-property :retain-labels element))
  1973. ;; Does it have line numbers?
  1974. (num-start (org-export-get-loc element info)))
  1975. (org-html-do-format-code code lang refs retain-labels num-start)))
  1976. ;;; Tables of Contents
  1977. (defun org-html-toc (depth info &optional scope)
  1978. "Build a table of contents.
  1979. DEPTH is an integer specifying the depth of the table. INFO is
  1980. a plist used as a communication channel. Optional argument SCOPE
  1981. is an element defining the scope of the table. Return the table
  1982. of contents as a string, or nil if it is empty."
  1983. (let ((toc-entries
  1984. (mapcar (lambda (headline)
  1985. (cons (org-html--format-toc-headline headline info)
  1986. (org-export-get-relative-level headline info)))
  1987. (org-export-collect-headlines info depth scope))))
  1988. (when toc-entries
  1989. (let ((toc (concat "<div id=\"text-table-of-contents\">"
  1990. (org-html--toc-text toc-entries)
  1991. "</div>\n")))
  1992. (if scope toc
  1993. (let ((outer-tag (if (org-html--html5-fancy-p info)
  1994. "nav"
  1995. "div")))
  1996. (concat (format "<%s id=\"table-of-contents\">\n" outer-tag)
  1997. (let ((top-level (plist-get info :html-toplevel-hlevel)))
  1998. (format "<h%d>%s</h%d>\n"
  1999. top-level
  2000. (org-html--translate "Table of Contents" info)
  2001. top-level))
  2002. toc
  2003. (format "</%s>\n" outer-tag))))))))
  2004. (defun org-html--toc-text (toc-entries)
  2005. "Return innards of a table of contents, as a string.
  2006. TOC-ENTRIES is an alist where key is an entry title, as a string,
  2007. and value is its relative level, as an integer."
  2008. (let* ((prev-level (1- (cdar toc-entries)))
  2009. (start-level prev-level))
  2010. (concat
  2011. (mapconcat
  2012. (lambda (entry)
  2013. (let ((headline (car entry))
  2014. (level (cdr entry)))
  2015. (concat
  2016. (let* ((cnt (- level prev-level))
  2017. (times (if (> cnt 0) (1- cnt) (- cnt))))
  2018. (setq prev-level level)
  2019. (concat
  2020. (org-html--make-string
  2021. times (cond ((> cnt 0) "\n<ul>\n<li>")
  2022. ((< cnt 0) "</li>\n</ul>\n")))
  2023. (if (> cnt 0) "\n<ul>\n<li>" "</li>\n<li>")))
  2024. headline)))
  2025. toc-entries "")
  2026. (org-html--make-string (- prev-level start-level) "</li>\n</ul>\n"))))
  2027. (defun org-html--format-toc-headline (headline info)
  2028. "Return an appropriate table of contents entry for HEADLINE.
  2029. INFO is a plist used as a communication channel."
  2030. (let* ((headline-number (org-export-get-headline-number headline info))
  2031. (todo (and (plist-get info :with-todo-keywords)
  2032. (let ((todo (org-element-property :todo-keyword headline)))
  2033. (and todo (org-export-data todo info)))))
  2034. (todo-type (and todo (org-element-property :todo-type headline)))
  2035. (priority (and (plist-get info :with-priority)
  2036. (org-element-property :priority headline)))
  2037. (text (org-export-data-with-backend
  2038. (org-export-get-alt-title headline info)
  2039. ;; Create an anonymous back-end that will ignore any
  2040. ;; footnote-reference, link, radio-target and target
  2041. ;; in table of contents.
  2042. (org-export-create-backend
  2043. :parent 'html
  2044. :transcoders '((footnote-reference . ignore)
  2045. (link . (lambda (object c i) c))
  2046. (radio-target . (lambda (object c i) c))
  2047. (target . ignore)))
  2048. info))
  2049. (tags (and (eq (plist-get info :with-tags) t)
  2050. (org-export-get-tags headline info))))
  2051. (format "<a href=\"#%s\">%s</a>"
  2052. ;; Label.
  2053. (or (org-element-property :CUSTOM_ID headline)
  2054. (org-export-get-reference headline info))
  2055. ;; Body.
  2056. (concat
  2057. (and (not (org-export-low-level-p headline info))
  2058. (org-export-numbered-headline-p headline info)
  2059. (concat (mapconcat #'number-to-string headline-number ".")
  2060. ". "))
  2061. (apply (plist-get info :html-format-headline-function)
  2062. todo todo-type priority text tags :section-number nil)))))
  2063. (defun org-html-list-of-listings (info)
  2064. "Build a list of listings.
  2065. INFO is a plist used as a communication channel. Return the list
  2066. of listings as a string, or nil if it is empty."
  2067. (let ((lol-entries (org-export-collect-listings info)))
  2068. (when lol-entries
  2069. (concat "<div id=\"list-of-listings\">\n"
  2070. (let ((top-level (plist-get info :html-toplevel-hlevel)))
  2071. (format "<h%d>%s</h%d>\n"
  2072. top-level
  2073. (org-html--translate "List of Listings" info)
  2074. top-level))
  2075. "<div id=\"text-list-of-listings\">\n<ul>\n"
  2076. (let ((count 0)
  2077. (initial-fmt (format "<span class=\"listing-number\">%s</span>"
  2078. (org-html--translate "Listing %d:" info))))
  2079. (mapconcat
  2080. (lambda (entry)
  2081. (let ((label (and (org-element-property :name entry)
  2082. (org-export-get-reference entry info)))
  2083. (title (org-trim
  2084. (org-export-data
  2085. (or (org-export-get-caption entry t)
  2086. (org-export-get-caption entry))
  2087. info))))
  2088. (concat
  2089. "<li>"
  2090. (if (not label)
  2091. (concat (format initial-fmt (cl-incf count))
  2092. " "
  2093. title)
  2094. (format "<a href=\"#%s\">%s %s</a>"
  2095. label
  2096. (format initial-fmt (cl-incf count))
  2097. title))
  2098. "</li>")))
  2099. lol-entries "\n"))
  2100. "\n</ul>\n</div>\n</div>"))))
  2101. (defun org-html-list-of-tables (info)
  2102. "Build a list of tables.
  2103. INFO is a plist used as a communication channel. Return the list
  2104. of tables as a string, or nil if it is empty."
  2105. (let ((lol-entries (org-export-collect-tables info)))
  2106. (when lol-entries
  2107. (concat "<div id=\"list-of-tables\">\n"
  2108. (let ((top-level (plist-get info :html-toplevel-hlevel)))
  2109. (format "<h%d>%s</h%d>\n"
  2110. top-level
  2111. (org-html--translate "List of Tables" info)
  2112. top-level))
  2113. "<div id=\"text-list-of-tables\">\n<ul>\n"
  2114. (let ((count 0)
  2115. (initial-fmt (format "<span class=\"table-number\">%s</span>"
  2116. (org-html--translate "Table %d:" info))))
  2117. (mapconcat
  2118. (lambda (entry)
  2119. (let ((label (and (org-element-property :name entry)
  2120. (org-export-get-reference entry info)))
  2121. (title (org-trim
  2122. (org-export-data
  2123. (or (org-export-get-caption entry t)
  2124. (org-export-get-caption entry))
  2125. info))))
  2126. (concat
  2127. "<li>"
  2128. (if (not label)
  2129. (concat (format initial-fmt (cl-incf count))
  2130. " "
  2131. title)
  2132. (format "<a href=\"#%s\">%s %s</a>"
  2133. label
  2134. (format initial-fmt (cl-incf count))
  2135. title))
  2136. "</li>")))
  2137. lol-entries "\n"))
  2138. "\n</ul>\n</div>\n</div>"))))
  2139. ;;; Transcode Functions
  2140. ;;;; Bold
  2141. (defun org-html-bold (_bold contents info)
  2142. "Transcode BOLD from Org to HTML.
  2143. CONTENTS is the text with bold markup. INFO is a plist holding
  2144. contextual information."
  2145. (format (or (cdr (assq 'bold (plist-get info :html-text-markup-alist))) "%s")
  2146. contents))
  2147. ;;;; Center Block
  2148. (defun org-html-center-block (_center-block contents _info)
  2149. "Transcode a CENTER-BLOCK element from Org to HTML.
  2150. CONTENTS holds the contents of the block. INFO is a plist
  2151. holding contextual information."
  2152. (format "<div class=\"org-center\">\n%s</div>" contents))
  2153. ;;;; Clock
  2154. (defun org-html-clock (clock _contents _info)
  2155. "Transcode a CLOCK element from Org to HTML.
  2156. CONTENTS is nil. INFO is a plist used as a communication
  2157. channel."
  2158. (format "<p>
  2159. <span class=\"timestamp-wrapper\">
  2160. <span class=\"timestamp-kwd\">%s</span> <span class=\"timestamp\">%s</span>%s
  2161. </span>
  2162. </p>"
  2163. org-clock-string
  2164. (org-timestamp-translate (org-element-property :value clock))
  2165. (let ((time (org-element-property :duration clock)))
  2166. (and time (format " <span class=\"timestamp\">(%s)</span>" time)))))
  2167. ;;;; Code
  2168. (defun org-html-code (code _contents info)
  2169. "Transcode CODE from Org to HTML.
  2170. CONTENTS is nil. INFO is a plist holding contextual
  2171. information."
  2172. (format (or (cdr (assq 'code (plist-get info :html-text-markup-alist))) "%s")
  2173. (org-html-encode-plain-text (org-element-property :value code))))
  2174. ;;;; Drawer
  2175. (defun org-html-drawer (drawer contents info)
  2176. "Transcode a DRAWER element from Org to HTML.
  2177. CONTENTS holds the contents of the block. INFO is a plist
  2178. holding contextual information."
  2179. (funcall (plist-get info :html-format-drawer-function)
  2180. (org-element-property :drawer-name drawer)
  2181. contents))
  2182. ;;;; Dynamic Block
  2183. (defun org-html-dynamic-block (_dynamic-block contents _info)
  2184. "Transcode a DYNAMIC-BLOCK element from Org to HTML.
  2185. CONTENTS holds the contents of the block. INFO is a plist
  2186. holding contextual information. See `org-export-data'."
  2187. contents)
  2188. ;;;; Entity
  2189. (defun org-html-entity (entity _contents _info)
  2190. "Transcode an ENTITY object from Org to HTML.
  2191. CONTENTS are the definition itself. INFO is a plist holding
  2192. contextual information."
  2193. (org-element-property :html entity))
  2194. ;;;; Example Block
  2195. (defun org-html-example-block (example-block _contents info)
  2196. "Transcode a EXAMPLE-BLOCK element from Org to HTML.
  2197. CONTENTS is nil. INFO is a plist holding contextual
  2198. information."
  2199. (let ((attributes (org-export-read-attribute :attr_html example-block)))
  2200. (if (plist-get attributes :textarea)
  2201. (org-html--textarea-block example-block)
  2202. (format "<pre class=\"example\"%s>\n%s</pre>"
  2203. (let* ((name (org-element-property :name example-block))
  2204. (a (org-html--make-attribute-string
  2205. (if (or (not name) (plist-member attributes :id))
  2206. attributes
  2207. (plist-put attributes :id name)))))
  2208. (if (org-string-nw-p a) (concat " " a) ""))
  2209. (org-html-format-code example-block info)))))
  2210. ;;;; Export Snippet
  2211. (defun org-html-export-snippet (export-snippet _contents _info)
  2212. "Transcode a EXPORT-SNIPPET object from Org to HTML.
  2213. CONTENTS is nil. INFO is a plist holding contextual
  2214. information."
  2215. (when (eq (org-export-snippet-backend export-snippet) 'html)
  2216. (org-element-property :value export-snippet)))
  2217. ;;;; Export Block
  2218. (defun org-html-export-block (export-block _contents _info)
  2219. "Transcode a EXPORT-BLOCK element from Org to HTML.
  2220. CONTENTS is nil. INFO is a plist holding contextual information."
  2221. (when (string= (org-element-property :type export-block) "HTML")
  2222. (org-remove-indentation (org-element-property :value export-block))))
  2223. ;;;; Fixed Width
  2224. (defun org-html-fixed-width (fixed-width _contents _info)
  2225. "Transcode a FIXED-WIDTH element from Org to HTML.
  2226. CONTENTS is nil. INFO is a plist holding contextual information."
  2227. (format "<pre class=\"example\">\n%s</pre>"
  2228. (org-html-do-format-code
  2229. (org-remove-indentation
  2230. (org-element-property :value fixed-width)))))
  2231. ;;;; Footnote Reference
  2232. (defun org-html-footnote-reference (footnote-reference _contents info)
  2233. "Transcode a FOOTNOTE-REFERENCE element from Org to HTML.
  2234. CONTENTS is nil. INFO is a plist holding contextual information."
  2235. (concat
  2236. ;; Insert separator between two footnotes in a row.
  2237. (let ((prev (org-export-get-previous-element footnote-reference info)))
  2238. (when (eq (org-element-type prev) 'footnote-reference)
  2239. (plist-get info :html-footnote-separator)))
  2240. (let* ((n (org-export-get-footnote-number footnote-reference info))
  2241. (id (format "fnr.%d%s"
  2242. n
  2243. (if (org-export-footnote-first-reference-p
  2244. footnote-reference info)
  2245. ""
  2246. ".100"))))
  2247. (format
  2248. (plist-get info :html-footnote-format)
  2249. (org-html--anchor
  2250. id n (format " class=\"footref\" href=\"#fn.%d\"" n) info)))))
  2251. ;;;; Headline
  2252. (defun org-html-headline (headline contents info)
  2253. "Transcode a HEADLINE element from Org to HTML.
  2254. CONTENTS holds the contents of the headline. INFO is a plist
  2255. holding contextual information."
  2256. (unless (org-element-property :footnote-section-p headline)
  2257. (let* ((numberedp (org-export-numbered-headline-p headline info))
  2258. (numbers (org-export-get-headline-number headline info))
  2259. (level (+ (org-export-get-relative-level headline info)
  2260. (1- (plist-get info :html-toplevel-hlevel))))
  2261. (todo (and (plist-get info :with-todo-keywords)
  2262. (let ((todo (org-element-property :todo-keyword headline)))
  2263. (and todo (org-export-data todo info)))))
  2264. (todo-type (and todo (org-element-property :todo-type headline)))
  2265. (priority (and (plist-get info :with-priority)
  2266. (org-element-property :priority headline)))
  2267. (text (org-export-data (org-element-property :title headline) info))
  2268. (tags (and (plist-get info :with-tags)
  2269. (org-export-get-tags headline info)))
  2270. (full-text (funcall (plist-get info :html-format-headline-function)
  2271. todo todo-type priority text tags info))
  2272. (contents (or contents ""))
  2273. (ids (delq nil
  2274. (list (org-element-property :CUSTOM_ID headline)
  2275. (org-export-get-reference headline info)
  2276. (org-element-property :ID headline))))
  2277. (preferred-id (car ids))
  2278. (extra-ids
  2279. (mapconcat
  2280. (lambda (id)
  2281. (org-html--anchor
  2282. (if (org-uuidgen-p id) (concat "ID-" id) id)
  2283. nil nil info))
  2284. (cdr ids) "")))
  2285. (if (org-export-low-level-p headline info)
  2286. ;; This is a deep sub-tree: export it as a list item.
  2287. (let* ((type (if numberedp 'ordered 'unordered))
  2288. (itemized-body
  2289. (org-html-format-list-item
  2290. contents type nil info nil
  2291. (concat (org-html--anchor preferred-id nil nil info)
  2292. extra-ids
  2293. full-text))))
  2294. (concat (and (org-export-first-sibling-p headline info)
  2295. (org-html-begin-plain-list type))
  2296. itemized-body
  2297. (and (org-export-last-sibling-p headline info)
  2298. (org-html-end-plain-list type))))
  2299. (let ((extra-class (org-element-property :HTML_CONTAINER_CLASS headline))
  2300. (first-content (car (org-element-contents headline))))
  2301. ;; Standard headline. Export it as a section.
  2302. (format "<%s id=\"%s\" class=\"%s\">%s%s</%s>\n"
  2303. (org-html--container headline info)
  2304. (concat "outline-container-"
  2305. (org-export-get-reference headline info))
  2306. (concat (format "outline-%d" level)
  2307. (and extra-class " ")
  2308. extra-class)
  2309. (format "\n<h%d id=\"%s\">%s%s</h%d>\n"
  2310. level
  2311. preferred-id
  2312. extra-ids
  2313. (concat
  2314. (and numberedp
  2315. (format
  2316. "<span class=\"section-number-%d\">%s</span> "
  2317. level
  2318. (mapconcat #'number-to-string numbers ".")))
  2319. full-text)
  2320. level)
  2321. ;; When there is no section, pretend there is an
  2322. ;; empty one to get the correct <div
  2323. ;; class="outline-...> which is needed by
  2324. ;; `org-info.js'.
  2325. (if (eq (org-element-type first-content) 'section) contents
  2326. (concat (org-html-section first-content "" info) contents))
  2327. (org-html--container headline info)))))))
  2328. (defun org-html-format-headline-default-function
  2329. (todo _todo-type priority text tags info)
  2330. "Default format function for a headline.
  2331. See `org-html-format-headline-function' for details."
  2332. (let ((todo (org-html--todo todo info))
  2333. (priority (org-html--priority priority info))
  2334. (tags (org-html--tags tags info)))
  2335. (concat todo (and todo " ")
  2336. priority (and priority " ")
  2337. text
  2338. (and tags "&#xa0;&#xa0;&#xa0;") tags)))
  2339. (defun org-html--container (headline info)
  2340. (or (org-element-property :HTML_CONTAINER headline)
  2341. (if (= 1 (org-export-get-relative-level headline info))
  2342. (plist-get info :html-container)
  2343. "div")))
  2344. ;;;; Horizontal Rule
  2345. (defun org-html-horizontal-rule (_horizontal-rule _contents info)
  2346. "Transcode an HORIZONTAL-RULE object from Org to HTML.
  2347. CONTENTS is nil. INFO is a plist holding contextual information."
  2348. (org-html-close-tag "hr" nil info))
  2349. ;;;; Inline Src Block
  2350. (defun org-html-inline-src-block (inline-src-block _contents info)
  2351. "Transcode an INLINE-SRC-BLOCK element from Org to HTML.
  2352. CONTENTS holds the contents of the item. INFO is a plist holding
  2353. contextual information."
  2354. (let ((lang (org-element-property :language inline-src-block))
  2355. (code (org-element-property :value inline-src-block))
  2356. (label
  2357. (let ((lbl (and (org-element-property :name inline-src-block)
  2358. (org-export-get-reference inline-src-block info))))
  2359. (if (not lbl) "" (format " id=\"%s\"" lbl)))))
  2360. (format "<code class=\"src src-%s\"%s>%s</code>" lang label code)))
  2361. ;;;; Inlinetask
  2362. (defun org-html-inlinetask (inlinetask contents info)
  2363. "Transcode an INLINETASK element from Org to HTML.
  2364. CONTENTS holds the contents of the block. INFO is a plist
  2365. holding contextual information."
  2366. (let* ((todo (and (plist-get info :with-todo-keywords)
  2367. (let ((todo (org-element-property :todo-keyword inlinetask)))
  2368. (and todo (org-export-data todo info)))))
  2369. (todo-type (and todo (org-element-property :todo-type inlinetask)))
  2370. (priority (and (plist-get info :with-priority)
  2371. (org-element-property :priority inlinetask)))
  2372. (text (org-export-data (org-element-property :title inlinetask) info))
  2373. (tags (and (plist-get info :with-tags)
  2374. (org-export-get-tags inlinetask info))))
  2375. (funcall (plist-get info :html-format-inlinetask-function)
  2376. todo todo-type priority text tags contents info)))
  2377. (defun org-html-format-inlinetask-default-function
  2378. (todo todo-type priority text tags contents info)
  2379. "Default format function for a inlinetasks.
  2380. See `org-html-format-inlinetask-function' for details."
  2381. (format "<div class=\"inlinetask\">\n<b>%s</b>%s\n%s</div>"
  2382. (org-html-format-headline-default-function
  2383. todo todo-type priority text tags info)
  2384. (org-html-close-tag "br" nil info)
  2385. contents))
  2386. ;;;; Italic
  2387. (defun org-html-italic (_italic contents info)
  2388. "Transcode ITALIC from Org to HTML.
  2389. CONTENTS is the text with italic markup. INFO is a plist holding
  2390. contextual information."
  2391. (format
  2392. (or (cdr (assq 'italic (plist-get info :html-text-markup-alist))) "%s")
  2393. contents))
  2394. ;;;; Item
  2395. (defun org-html-checkbox (checkbox info)
  2396. "Format CHECKBOX into HTML.
  2397. INFO is a plist holding contextual information. See
  2398. `org-html-checkbox-type' for customization options."
  2399. (cdr (assq checkbox
  2400. (cdr (assq (plist-get info :html-checkbox-type)
  2401. org-html-checkbox-types)))))
  2402. (defun org-html-format-list-item (contents type checkbox info
  2403. &optional term-counter-id
  2404. headline)
  2405. "Format a list item into HTML."
  2406. (let ((class (if checkbox
  2407. (format " class=\"%s\""
  2408. (symbol-name checkbox)) ""))
  2409. (checkbox (concat (org-html-checkbox checkbox info)
  2410. (and checkbox " ")))
  2411. (br (org-html-close-tag "br" nil info)))
  2412. (concat
  2413. (pcase type
  2414. (`ordered
  2415. (let* ((counter term-counter-id)
  2416. (extra (if counter (format " value=\"%s\"" counter) "")))
  2417. (concat
  2418. (format "<li%s%s>" class extra)
  2419. (when headline (concat headline br)))))
  2420. (`unordered
  2421. (let* ((id term-counter-id)
  2422. (extra (if id (format " id=\"%s\"" id) "")))
  2423. (concat
  2424. (format "<li%s%s>" class extra)
  2425. (when headline (concat headline br)))))
  2426. (`descriptive
  2427. (let* ((term term-counter-id))
  2428. (setq term (or term "(no term)"))
  2429. ;; Check-boxes in descriptive lists are associated to tag.
  2430. (concat (format "<dt%s>%s</dt>"
  2431. class (concat checkbox term))
  2432. "<dd>"))))
  2433. (unless (eq type 'descriptive) checkbox)
  2434. (and contents (org-trim contents))
  2435. (pcase type
  2436. (`ordered "</li>")
  2437. (`unordered "</li>")
  2438. (`descriptive "</dd>")))))
  2439. (defun org-html-item (item contents info)
  2440. "Transcode an ITEM element from Org to HTML.
  2441. CONTENTS holds the contents of the item. INFO is a plist holding
  2442. contextual information."
  2443. (let* ((plain-list (org-export-get-parent item))
  2444. (type (org-element-property :type plain-list))
  2445. (counter (org-element-property :counter item))
  2446. (checkbox (org-element-property :checkbox item))
  2447. (tag (let ((tag (org-element-property :tag item)))
  2448. (and tag (org-export-data tag info)))))
  2449. (org-html-format-list-item
  2450. contents type checkbox info (or tag counter))))
  2451. ;;;; Keyword
  2452. (defun org-html-keyword (keyword _contents info)
  2453. "Transcode a KEYWORD element from Org to HTML.
  2454. CONTENTS is nil. INFO is a plist holding contextual information."
  2455. (let ((key (org-element-property :key keyword))
  2456. (value (org-element-property :value keyword)))
  2457. (cond
  2458. ((string= key "HTML") value)
  2459. ((string= key "TOC")
  2460. (let ((case-fold-search t))
  2461. (cond
  2462. ((string-match "\\<headlines\\>" value)
  2463. (let ((depth (and (string-match "\\<[0-9]+\\>" value)
  2464. (string-to-number (match-string 0 value))))
  2465. (localp (string-match-p "\\<local\\>" value)))
  2466. (org-html-toc depth info (and localp keyword))))
  2467. ((string= "listings" value) (org-html-list-of-listings info))
  2468. ((string= "tables" value) (org-html-list-of-tables info))))))))
  2469. ;;;; Latex Environment
  2470. (defun org-html-format-latex (latex-frag processing-type info)
  2471. "Format a LaTeX fragment LATEX-FRAG into HTML.
  2472. PROCESSING-TYPE designates the tool used for conversion. It can
  2473. be `mathjax', `verbatim', nil, t or symbols in
  2474. `org-preview-latex-process-alist', e.g., `dvipng', `dvisvgm' or
  2475. `imagemagick'. See `org-html-with-latex' for more information.
  2476. INFO is a plist containing export properties."
  2477. (let ((cache-relpath "") (cache-dir ""))
  2478. (unless (eq processing-type 'mathjax)
  2479. (let ((bfn (or (buffer-file-name)
  2480. (make-temp-name
  2481. (expand-file-name "latex" temporary-file-directory))))
  2482. (latex-header
  2483. (let ((header (plist-get info :latex-header)))
  2484. (and header
  2485. (concat (mapconcat
  2486. (lambda (line) (concat "#+LATEX_HEADER: " line))
  2487. (org-split-string header "\n")
  2488. "\n")
  2489. "\n")))))
  2490. (setq cache-relpath
  2491. (concat (file-name-as-directory org-preview-latex-image-directory)
  2492. (file-name-sans-extension
  2493. (file-name-nondirectory bfn)))
  2494. cache-dir (file-name-directory bfn))
  2495. ;; Re-create LaTeX environment from original buffer in
  2496. ;; temporary buffer so that dvipng/imagemagick can properly
  2497. ;; turn the fragment into an image.
  2498. (setq latex-frag (concat latex-header latex-frag))))
  2499. (with-temp-buffer
  2500. (insert latex-frag)
  2501. (org-format-latex cache-relpath nil nil cache-dir nil
  2502. "Creating LaTeX Image..." nil processing-type)
  2503. (buffer-string))))
  2504. (defun org-html-latex-environment (latex-environment _contents info)
  2505. "Transcode a LATEX-ENVIRONMENT element from Org to HTML.
  2506. CONTENTS is nil. INFO is a plist holding contextual information."
  2507. (let ((processing-type (plist-get info :with-latex))
  2508. (latex-frag (org-remove-indentation
  2509. (org-element-property :value latex-environment)))
  2510. (attributes (org-export-read-attribute :attr_html latex-environment)))
  2511. (cond
  2512. ((memq processing-type '(t mathjax))
  2513. (org-html-format-latex latex-frag 'mathjax info))
  2514. ((assq processing-type org-preview-latex-process-alist)
  2515. (let ((formula-link
  2516. (org-html-format-latex latex-frag processing-type info)))
  2517. (when (and formula-link (string-match "file:\\([^]]*\\)" formula-link))
  2518. ;; Do not provide a caption or a name to be consistent with
  2519. ;; `mathjax' handling.
  2520. (org-html--wrap-image
  2521. (org-html--format-image
  2522. (match-string 1 formula-link) attributes info) info))))
  2523. (t latex-frag))))
  2524. ;;;; Latex Fragment
  2525. (defun org-html-latex-fragment (latex-fragment _contents info)
  2526. "Transcode a LATEX-FRAGMENT object from Org to HTML.
  2527. CONTENTS is nil. INFO is a plist holding contextual information."
  2528. (let ((latex-frag (org-element-property :value latex-fragment))
  2529. (processing-type (plist-get info :with-latex)))
  2530. (cond
  2531. ((memq processing-type '(t mathjax))
  2532. (org-html-format-latex latex-frag 'mathjax info))
  2533. ((assq processing-type org-preview-latex-process-alist)
  2534. (let ((formula-link
  2535. (org-html-format-latex latex-frag processing-type info)))
  2536. (when (and formula-link (string-match "file:\\([^]]*\\)" formula-link))
  2537. (org-html--format-image (match-string 1 formula-link) nil info))))
  2538. (t latex-frag))))
  2539. ;;;; Line Break
  2540. (defun org-html-line-break (_line-break _contents info)
  2541. "Transcode a LINE-BREAK object from Org to HTML.
  2542. CONTENTS is nil. INFO is a plist holding contextual information."
  2543. (concat (org-html-close-tag "br" nil info) "\n"))
  2544. ;;;; Link
  2545. (defun org-html-inline-image-p (link info)
  2546. "Non-nil when LINK is meant to appear as an image.
  2547. INFO is a plist used as a communication channel. LINK is an
  2548. inline image when it has no description and targets an image
  2549. file (see `org-html-inline-image-rules' for more information), or
  2550. if its description is a single link targeting an image file."
  2551. (if (not (org-element-contents link))
  2552. (org-export-inline-image-p
  2553. link (plist-get info :html-inline-image-rules))
  2554. (not
  2555. (let ((link-count 0))
  2556. (org-element-map (org-element-contents link)
  2557. (cons 'plain-text org-element-all-objects)
  2558. (lambda (obj)
  2559. (pcase (org-element-type obj)
  2560. (`plain-text (org-string-nw-p obj))
  2561. (`link (if (= link-count 1) t
  2562. (cl-incf link-count)
  2563. (not (org-export-inline-image-p
  2564. obj (plist-get info :html-inline-image-rules)))))
  2565. (_ t)))
  2566. info t)))))
  2567. (defvar org-html-standalone-image-predicate)
  2568. (defun org-html-standalone-image-p (element info)
  2569. "Non-nil if ELEMENT is a standalone image.
  2570. INFO is a plist holding contextual information.
  2571. An element or object is a standalone image when
  2572. - its type is `paragraph' and its sole content, save for white
  2573. spaces, is a link that qualifies as an inline image;
  2574. - its type is `link' and its containing paragraph has no other
  2575. content save white spaces.
  2576. Bind `org-html-standalone-image-predicate' to constrain paragraph
  2577. further. For example, to check for only captioned standalone
  2578. images, set it to:
  2579. (lambda (paragraph) (org-element-property :caption paragraph))"
  2580. (let ((paragraph (pcase (org-element-type element)
  2581. (`paragraph element)
  2582. (`link (org-export-get-parent element)))))
  2583. (and (eq (org-element-type paragraph) 'paragraph)
  2584. (or (not (fboundp 'org-html-standalone-image-predicate))
  2585. (funcall org-html-standalone-image-predicate paragraph))
  2586. (catch 'exit
  2587. (let ((link-count 0))
  2588. (org-element-map (org-element-contents paragraph)
  2589. (cons 'plain-text org-element-all-objects)
  2590. (lambda (obj)
  2591. (when (pcase (org-element-type obj)
  2592. (`plain-text (org-string-nw-p obj))
  2593. (`link (or (> (cl-incf link-count) 1)
  2594. (not (org-html-inline-image-p obj info))))
  2595. (_ t))
  2596. (throw 'exit nil)))
  2597. info nil 'link)
  2598. (= link-count 1))))))
  2599. (defun org-html-link (link desc info)
  2600. "Transcode a LINK object from Org to HTML.
  2601. DESC is the description part of the link, or the empty string.
  2602. INFO is a plist holding contextual information. See
  2603. `org-export-data'."
  2604. (let* ((home (when (plist-get info :html-link-home)
  2605. (org-trim (plist-get info :html-link-home))))
  2606. (use-abs-url (plist-get info :html-link-use-abs-url))
  2607. (link-org-files-as-html-maybe
  2608. (lambda (raw-path info)
  2609. ;; Treat links to `file.org' as links to `file.html', if
  2610. ;; needed. See `org-html-link-org-files-as-html'.
  2611. (cond
  2612. ((and (plist-get info :html-link-org-files-as-html)
  2613. (string= ".org"
  2614. (downcase (file-name-extension raw-path "."))))
  2615. (concat (file-name-sans-extension raw-path) "."
  2616. (plist-get info :html-extension)))
  2617. (t raw-path))))
  2618. (type (org-element-property :type link))
  2619. (raw-path (org-element-property :path link))
  2620. ;; Ensure DESC really exists, or set it to nil.
  2621. (desc (org-string-nw-p desc))
  2622. (path
  2623. (cond
  2624. ((member type '("http" "https" "ftp" "mailto" "news"))
  2625. (url-encode-url (org-link-unescape (concat type ":" raw-path))))
  2626. ((string= type "file")
  2627. ;; Treat links to ".org" files as ".html", if needed.
  2628. (setq raw-path
  2629. (funcall link-org-files-as-html-maybe raw-path info))
  2630. ;; If file path is absolute, prepend it with protocol
  2631. ;; component - "file://".
  2632. (cond
  2633. ((file-name-absolute-p raw-path)
  2634. (setq raw-path (org-export-file-uri raw-path)))
  2635. ((and home use-abs-url)
  2636. (setq raw-path (concat (file-name-as-directory home) raw-path))))
  2637. ;; Add search option, if any. A search option can be
  2638. ;; relative to a custom-id, a headline title, a name or
  2639. ;; a target.
  2640. (let ((option (org-element-property :search-option link)))
  2641. (cond ((not option) raw-path)
  2642. ;; Since HTML back-end use custom-id value as-is,
  2643. ;; resolving is them is trivial.
  2644. ((eq (string-to-char option) ?#) (concat raw-path option))
  2645. (t
  2646. (concat raw-path
  2647. "#"
  2648. (org-publish-resolve-external-link
  2649. option
  2650. (org-element-property :path link)))))))
  2651. (t raw-path)))
  2652. ;; Extract attributes from parent's paragraph. HACK: Only do
  2653. ;; this for the first link in parent (inner image link for
  2654. ;; inline images). This is needed as long as attributes
  2655. ;; cannot be set on a per link basis.
  2656. (attributes-plist
  2657. (let* ((parent (org-export-get-parent-element link))
  2658. (link (let ((container (org-export-get-parent link)))
  2659. (if (and (eq (org-element-type container) 'link)
  2660. (org-html-inline-image-p link info))
  2661. container
  2662. link))))
  2663. (and (eq (org-element-map parent 'link 'identity info t) link)
  2664. (org-export-read-attribute :attr_html parent))))
  2665. (attributes
  2666. (let ((attr (org-html--make-attribute-string attributes-plist)))
  2667. (if (org-string-nw-p attr) (concat " " attr) ""))))
  2668. (cond
  2669. ;; Link type is handled by a special function.
  2670. ((org-export-custom-protocol-maybe link desc 'html))
  2671. ;; Image file.
  2672. ((and (plist-get info :html-inline-images)
  2673. (org-export-inline-image-p
  2674. link (plist-get info :html-inline-image-rules)))
  2675. (org-html--format-image path attributes-plist info))
  2676. ;; Radio target: Transcode target's contents and use them as
  2677. ;; link's description.
  2678. ((string= type "radio")
  2679. (let ((destination (org-export-resolve-radio-link link info)))
  2680. (if (not destination) desc
  2681. (format "<a href=\"#%s\"%s>%s</a>"
  2682. (org-export-get-reference destination info)
  2683. attributes
  2684. desc))))
  2685. ;; Links pointing to a headline: Find destination and build
  2686. ;; appropriate referencing command.
  2687. ((member type '("custom-id" "fuzzy" "id"))
  2688. (let ((destination (if (string= type "fuzzy")
  2689. (org-export-resolve-fuzzy-link link info)
  2690. (org-export-resolve-id-link link info))))
  2691. (pcase (org-element-type destination)
  2692. ;; ID link points to an external file.
  2693. (`plain-text
  2694. (let ((fragment (concat "ID-" path))
  2695. ;; Treat links to ".org" files as ".html", if needed.
  2696. (path (funcall link-org-files-as-html-maybe
  2697. destination info)))
  2698. (format "<a href=\"%s#%s\"%s>%s</a>"
  2699. path fragment attributes (or desc destination))))
  2700. ;; Fuzzy link points nowhere.
  2701. (`nil
  2702. (format "<i>%s</i>"
  2703. (or desc
  2704. (org-export-data
  2705. (org-element-property :raw-link link) info))))
  2706. ;; Link points to a headline.
  2707. (`headline
  2708. (let ((href (or (org-element-property :CUSTOM_ID destination)
  2709. (org-export-get-reference destination info)))
  2710. ;; What description to use?
  2711. (desc
  2712. ;; Case 1: Headline is numbered and LINK has no
  2713. ;; description. Display section number.
  2714. (if (and (org-export-numbered-headline-p destination info)
  2715. (not desc))
  2716. (mapconcat #'number-to-string
  2717. (org-export-get-headline-number
  2718. destination info) ".")
  2719. ;; Case 2: Either the headline is un-numbered or
  2720. ;; LINK has a custom description. Display LINK's
  2721. ;; description or headline's title.
  2722. (or desc
  2723. (org-export-data
  2724. (org-element-property :title destination) info)))))
  2725. (format "<a href=\"#%s\"%s>%s</a>" href attributes desc)))
  2726. ;; Fuzzy link points to a target or an element.
  2727. (_
  2728. (let* ((ref (org-export-get-reference destination info))
  2729. (org-html-standalone-image-predicate
  2730. #'org-html--has-caption-p)
  2731. (number (cond
  2732. (desc nil)
  2733. ((org-html-standalone-image-p destination info)
  2734. (org-export-get-ordinal
  2735. (org-element-map destination 'link
  2736. #'identity info t)
  2737. info 'link 'org-html-standalone-image-p))
  2738. (t (org-export-get-ordinal
  2739. destination info nil 'org-html--has-caption-p))))
  2740. (desc (cond (desc)
  2741. ((not number) "No description for this link")
  2742. ((numberp number) (number-to-string number))
  2743. (t (mapconcat #'number-to-string number ".")))))
  2744. (format "<a href=\"#%s\"%s>%s</a>" ref attributes desc))))))
  2745. ;; Coderef: replace link with the reference name or the
  2746. ;; equivalent line number.
  2747. ((string= type "coderef")
  2748. (let ((fragment (concat "coderef-" (org-html-encode-plain-text path))))
  2749. (format "<a href=\"#%s\"%s%s>%s</a>"
  2750. fragment
  2751. (format "class=\"coderef\" onmouseover=\"CodeHighlightOn(this, \
  2752. '%s');\" onmouseout=\"CodeHighlightOff(this, '%s');\""
  2753. fragment fragment)
  2754. attributes
  2755. (format (org-export-get-coderef-format path desc)
  2756. (org-export-resolve-coderef path info)))))
  2757. ;; External link with a description part.
  2758. ((and path desc) (format "<a href=\"%s\"%s>%s</a>"
  2759. (org-html-encode-plain-text path)
  2760. attributes
  2761. desc))
  2762. ;; External link without a description part.
  2763. (path (let ((path (org-html-encode-plain-text path)))
  2764. (format "<a href=\"%s\"%s>%s</a>"
  2765. path
  2766. attributes
  2767. (org-link-unescape path))))
  2768. ;; No path, only description. Try to do something useful.
  2769. (t (format "<i>%s</i>" desc)))))
  2770. ;;;; Node Property
  2771. (defun org-html-node-property (node-property _contents _info)
  2772. "Transcode a NODE-PROPERTY element from Org to HTML.
  2773. CONTENTS is nil. INFO is a plist holding contextual
  2774. information."
  2775. (format "%s:%s"
  2776. (org-element-property :key node-property)
  2777. (let ((value (org-element-property :value node-property)))
  2778. (if value (concat " " value) ""))))
  2779. ;;;; Paragraph
  2780. (defun org-html-paragraph (paragraph contents info)
  2781. "Transcode a PARAGRAPH element from Org to HTML.
  2782. CONTENTS is the contents of the paragraph, as a string. INFO is
  2783. the plist used as a communication channel."
  2784. (let* ((parent (org-export-get-parent paragraph))
  2785. (parent-type (org-element-type parent))
  2786. (style '((footnote-definition " class=\"footpara\"")
  2787. (org-data " class=\"footpara\"")))
  2788. (attributes (org-html--make-attribute-string
  2789. (org-export-read-attribute :attr_html paragraph)))
  2790. (extra (or (cadr (assq parent-type style)) "")))
  2791. (cond
  2792. ((and (eq parent-type 'item)
  2793. (not (org-export-get-previous-element paragraph info))
  2794. (let ((followers (org-export-get-next-element paragraph info 2)))
  2795. (and (not (cdr followers))
  2796. (memq (org-element-type (car followers)) '(nil plain-list)))))
  2797. ;; First paragraph in an item has no tag if it is alone or
  2798. ;; followed, at most, by a sub-list.
  2799. contents)
  2800. ((org-html-standalone-image-p paragraph info)
  2801. ;; Standalone image.
  2802. (let ((caption
  2803. (let ((raw (org-export-data
  2804. (org-export-get-caption paragraph) info))
  2805. (org-html-standalone-image-predicate
  2806. #'org-html--has-caption-p))
  2807. (if (not (org-string-nw-p raw)) raw
  2808. (concat "<span class=\"figure-number\">"
  2809. (format (org-html--translate "Figure %d:" info)
  2810. (org-export-get-ordinal
  2811. (org-element-map paragraph 'link
  2812. #'identity info t)
  2813. info nil #'org-html-standalone-image-p))
  2814. " </span>"
  2815. raw))))
  2816. (label (and (org-element-property :name paragraph)
  2817. (org-export-get-reference paragraph info))))
  2818. (org-html--wrap-image contents info caption label)))
  2819. ;; Regular paragraph.
  2820. (t (format "<p%s%s>\n%s</p>"
  2821. (if (org-string-nw-p attributes)
  2822. (concat " " attributes) "")
  2823. extra contents)))))
  2824. ;;;; Plain List
  2825. ;; FIXME Maybe arg1 is not needed because <li value="20"> already sets
  2826. ;; the correct value for the item counter
  2827. (defun org-html-begin-plain-list (type &optional arg1)
  2828. "Insert the beginning of the HTML list depending on TYPE.
  2829. When ARG1 is a string, use it as the start parameter for ordered
  2830. lists."
  2831. (pcase type
  2832. (`ordered
  2833. (format "<ol class=\"org-ol\"%s>"
  2834. (if arg1 (format " start=\"%d\"" arg1) "")))
  2835. (`unordered "<ul class=\"org-ul\">")
  2836. (`descriptive "<dl class=\"org-dl\">")))
  2837. (defun org-html-end-plain-list (type)
  2838. "Insert the end of the HTML list depending on TYPE."
  2839. (pcase type
  2840. (`ordered "</ol>")
  2841. (`unordered "</ul>")
  2842. (`descriptive "</dl>")))
  2843. (defun org-html-plain-list (plain-list contents _info)
  2844. "Transcode a PLAIN-LIST element from Org to HTML.
  2845. CONTENTS is the contents of the list. INFO is a plist holding
  2846. contextual information."
  2847. (let ((type (org-element-property :type plain-list)))
  2848. (format "%s\n%s%s"
  2849. (org-html-begin-plain-list type)
  2850. contents (org-html-end-plain-list type))))
  2851. ;;;; Plain Text
  2852. (defun org-html-convert-special-strings (string)
  2853. "Convert special characters in STRING to HTML."
  2854. (dolist (a org-html-special-string-regexps string)
  2855. (let ((re (car a))
  2856. (rpl (cdr a)))
  2857. (setq string (replace-regexp-in-string re rpl string t)))))
  2858. (defun org-html-encode-plain-text (text)
  2859. "Convert plain text characters from TEXT to HTML equivalent.
  2860. Possible conversions are set in `org-html-protect-char-alist'."
  2861. (dolist (pair org-html-protect-char-alist text)
  2862. (setq text (replace-regexp-in-string (car pair) (cdr pair) text t t))))
  2863. (defun org-html-plain-text (text info)
  2864. "Transcode a TEXT string from Org to HTML.
  2865. TEXT is the string to transcode. INFO is a plist holding
  2866. contextual information."
  2867. (let ((output text))
  2868. ;; Protect following characters: <, >, &.
  2869. (setq output (org-html-encode-plain-text output))
  2870. ;; Handle smart quotes. Be sure to provide original string since
  2871. ;; OUTPUT may have been modified.
  2872. (when (plist-get info :with-smart-quotes)
  2873. (setq output (org-export-activate-smart-quotes output :html info text)))
  2874. ;; Handle special strings.
  2875. (when (plist-get info :with-special-strings)
  2876. (setq output (org-html-convert-special-strings output)))
  2877. ;; Handle break preservation if required.
  2878. (when (plist-get info :preserve-breaks)
  2879. (setq output
  2880. (replace-regexp-in-string
  2881. "\\(\\\\\\\\\\)?[ \t]*\n"
  2882. (concat (org-html-close-tag "br" nil info) "\n") output)))
  2883. ;; Return value.
  2884. output))
  2885. ;; Planning
  2886. (defun org-html-planning (planning _contents info)
  2887. "Transcode a PLANNING element from Org to HTML.
  2888. CONTENTS is nil. INFO is a plist used as a communication
  2889. channel."
  2890. (format
  2891. "<p><span class=\"timestamp-wrapper\">%s</span></p>"
  2892. (org-trim
  2893. (mapconcat
  2894. (lambda (pair)
  2895. (let ((timestamp (cdr pair)))
  2896. (when timestamp
  2897. (let ((string (car pair)))
  2898. (format "<span class=\"timestamp-kwd\">%s</span> \
  2899. <span class=\"timestamp\">%s</span> "
  2900. string
  2901. (org-html-plain-text (org-timestamp-translate timestamp)
  2902. info))))))
  2903. `((,org-closed-string . ,(org-element-property :closed planning))
  2904. (,org-deadline-string . ,(org-element-property :deadline planning))
  2905. (,org-scheduled-string . ,(org-element-property :scheduled planning)))
  2906. ""))))
  2907. ;;;; Property Drawer
  2908. (defun org-html-property-drawer (_property-drawer contents _info)
  2909. "Transcode a PROPERTY-DRAWER element from Org to HTML.
  2910. CONTENTS holds the contents of the drawer. INFO is a plist
  2911. holding contextual information."
  2912. (and (org-string-nw-p contents)
  2913. (format "<pre class=\"example\">\n%s</pre>" contents)))
  2914. ;;;; Quote Block
  2915. (defun org-html-quote-block (quote-block contents _info)
  2916. "Transcode a QUOTE-BLOCK element from Org to HTML.
  2917. CONTENTS holds the contents of the block. INFO is a plist
  2918. holding contextual information."
  2919. (format "<blockquote%s>\n%s</blockquote>"
  2920. (let* ((name (org-element-property :name quote-block))
  2921. (attributes (org-export-read-attribute :attr_html quote-block))
  2922. (a (org-html--make-attribute-string
  2923. (if (or (not name) (plist-member attributes :id))
  2924. attributes
  2925. (plist-put attributes :id name)))))
  2926. (if (org-string-nw-p a) (concat " " a) ""))
  2927. contents))
  2928. ;;;; Section
  2929. (defun org-html-section (section contents info)
  2930. "Transcode a SECTION element from Org to HTML.
  2931. CONTENTS holds the contents of the section. INFO is a plist
  2932. holding contextual information."
  2933. (let ((parent (org-export-get-parent-headline section)))
  2934. ;; Before first headline: no container, just return CONTENTS.
  2935. (if (not parent) contents
  2936. ;; Get div's class and id references.
  2937. (let* ((class-num (+ (org-export-get-relative-level parent info)
  2938. (1- (plist-get info :html-toplevel-hlevel))))
  2939. (section-number
  2940. (and (org-export-numbered-headline-p parent info)
  2941. (mapconcat
  2942. #'number-to-string
  2943. (org-export-get-headline-number parent info) "-"))))
  2944. ;; Build return value.
  2945. (format "<div class=\"outline-text-%d\" id=\"text-%s\">\n%s</div>"
  2946. class-num
  2947. (or (org-element-property :CUSTOM_ID parent)
  2948. section-number
  2949. (org-export-get-reference parent info))
  2950. (or contents ""))))))
  2951. ;;;; Radio Target
  2952. (defun org-html-radio-target (radio-target text info)
  2953. "Transcode a RADIO-TARGET object from Org to HTML.
  2954. TEXT is the text of the target. INFO is a plist holding
  2955. contextual information."
  2956. (let ((ref (org-export-get-reference radio-target info)))
  2957. (org-html--anchor ref text nil info)))
  2958. ;;;; Special Block
  2959. (defun org-html-special-block (special-block contents info)
  2960. "Transcode a SPECIAL-BLOCK element from Org to HTML.
  2961. CONTENTS holds the contents of the block. INFO is a plist
  2962. holding contextual information."
  2963. (let* ((block-type (org-element-property :type special-block))
  2964. (html5-fancy (and (org-html--html5-fancy-p info)
  2965. (member block-type org-html-html5-elements)))
  2966. (attributes (org-export-read-attribute :attr_html special-block)))
  2967. (unless html5-fancy
  2968. (let ((class (plist-get attributes :class)))
  2969. (setq attributes (plist-put attributes :class
  2970. (if class (concat class " " block-type)
  2971. block-type)))))
  2972. (let* ((contents (or contents ""))
  2973. (name (org-element-property :name special-block))
  2974. (a (org-html--make-attribute-string
  2975. (if (or (not name) (plist-member attributes :id))
  2976. attributes
  2977. (plist-put attributes :id name))))
  2978. (str (if (org-string-nw-p a) (concat " " a) "")))
  2979. (if html5-fancy
  2980. (format "<%s%s>\n%s</%s>" block-type str contents block-type)
  2981. (format "<div%s>\n%s\n</div>" str contents)))))
  2982. ;;;; Src Block
  2983. (defun org-html-src-block (src-block _contents info)
  2984. "Transcode a SRC-BLOCK element from Org to HTML.
  2985. CONTENTS holds the contents of the item. INFO is a plist holding
  2986. contextual information."
  2987. (if (org-export-read-attribute :attr_html src-block :textarea)
  2988. (org-html--textarea-block src-block)
  2989. (let ((lang (org-element-property :language src-block))
  2990. (code (org-html-format-code src-block info))
  2991. (label (let ((lbl (and (org-element-property :name src-block)
  2992. (org-export-get-reference src-block info))))
  2993. (if lbl (format " id=\"%s\"" lbl) ""))))
  2994. (if (not lang) (format "<pre class=\"example\"%s>\n%s</pre>" label code)
  2995. (format "<div class=\"org-src-container\">\n%s%s\n</div>"
  2996. ;; Build caption.
  2997. (let ((caption (org-export-get-caption src-block)))
  2998. (if (not caption) ""
  2999. (let ((listing-number
  3000. (format
  3001. "<span class=\"listing-number\">%s </span>"
  3002. (format
  3003. (org-html--translate "Listing %d:" info)
  3004. (org-export-get-ordinal
  3005. src-block info nil #'org-html--has-caption-p)))))
  3006. (format "<label class=\"org-src-name\">%s%s</label>"
  3007. listing-number
  3008. (org-trim (org-export-data caption info))))))
  3009. ;; Contents.
  3010. (format "<pre class=\"src src-%s\"%s>%s</pre>"
  3011. lang label code))))))
  3012. ;;;; Statistics Cookie
  3013. (defun org-html-statistics-cookie (statistics-cookie _contents _info)
  3014. "Transcode a STATISTICS-COOKIE object from Org to HTML.
  3015. CONTENTS is nil. INFO is a plist holding contextual information."
  3016. (let ((cookie-value (org-element-property :value statistics-cookie)))
  3017. (format "<code>%s</code>" cookie-value)))
  3018. ;;;; Strike-Through
  3019. (defun org-html-strike-through (_strike-through contents info)
  3020. "Transcode STRIKE-THROUGH from Org to HTML.
  3021. CONTENTS is the text with strike-through markup. INFO is a plist
  3022. holding contextual information."
  3023. (format
  3024. (or (cdr (assq 'strike-through (plist-get info :html-text-markup-alist)))
  3025. "%s")
  3026. contents))
  3027. ;;;; Subscript
  3028. (defun org-html-subscript (_subscript contents _info)
  3029. "Transcode a SUBSCRIPT object from Org to HTML.
  3030. CONTENTS is the contents of the object. INFO is a plist holding
  3031. contextual information."
  3032. (format "<sub>%s</sub>" contents))
  3033. ;;;; Superscript
  3034. (defun org-html-superscript (_superscript contents _info)
  3035. "Transcode a SUPERSCRIPT object from Org to HTML.
  3036. CONTENTS is the contents of the object. INFO is a plist holding
  3037. contextual information."
  3038. (format "<sup>%s</sup>" contents))
  3039. ;;;; Table Cell
  3040. (defun org-html-table-cell (table-cell contents info)
  3041. "Transcode a TABLE-CELL element from Org to HTML.
  3042. CONTENTS is nil. INFO is a plist used as a communication
  3043. channel."
  3044. (let* ((table-row (org-export-get-parent table-cell))
  3045. (table (org-export-get-parent-table table-cell))
  3046. (cell-attrs
  3047. (if (not (plist-get info :html-table-align-individual-fields)) ""
  3048. (format (if (and (boundp 'org-html-format-table-no-css)
  3049. org-html-format-table-no-css)
  3050. " align=\"%s\"" " class=\"org-%s\"")
  3051. (org-export-table-cell-alignment table-cell info)))))
  3052. (when (or (not contents) (string= "" (org-trim contents)))
  3053. (setq contents "&#xa0;"))
  3054. (cond
  3055. ((and (org-export-table-has-header-p table info)
  3056. (= 1 (org-export-table-row-group table-row info)))
  3057. (let ((header-tags (plist-get info :html-table-header-tags)))
  3058. (concat "\n" (format (car header-tags) "col" cell-attrs)
  3059. contents
  3060. (cdr header-tags))))
  3061. ((and (plist-get info :html-table-use-header-tags-for-first-column)
  3062. (zerop (cdr (org-export-table-cell-address table-cell info))))
  3063. (let ((header-tags (plist-get info :html-table-header-tags)))
  3064. (concat "\n" (format (car header-tags) "row" cell-attrs)
  3065. contents
  3066. (cdr header-tags))))
  3067. (t (let ((data-tags (plist-get info :html-table-data-tags)))
  3068. (concat "\n" (format (car data-tags) cell-attrs)
  3069. contents
  3070. (cdr data-tags)))))))
  3071. ;;;; Table Row
  3072. (defun org-html-table-row (table-row contents info)
  3073. "Transcode a TABLE-ROW element from Org to HTML.
  3074. CONTENTS is the contents of the row. INFO is a plist used as a
  3075. communication channel."
  3076. ;; Rules are ignored since table separators are deduced from
  3077. ;; borders of the current row.
  3078. (when (eq (org-element-property :type table-row) 'standard)
  3079. (let* ((group (org-export-table-row-group table-row info))
  3080. (number (org-export-table-row-number table-row info))
  3081. (start-group-p
  3082. (org-export-table-row-starts-rowgroup-p table-row info))
  3083. (end-group-p
  3084. (org-export-table-row-ends-rowgroup-p table-row info))
  3085. (topp (and (equal start-group-p '(top))
  3086. (equal end-group-p '(below top))))
  3087. (bottomp (and (equal start-group-p '(above))
  3088. (equal end-group-p '(bottom above))))
  3089. (row-open-tag
  3090. (pcase (plist-get info :html-table-row-open-tag)
  3091. ((and accessor (pred functionp))
  3092. (funcall accessor
  3093. number group start-group-p end-group-p topp bottomp))
  3094. (accessor accessor)))
  3095. (row-close-tag
  3096. (pcase (plist-get info :html-table-row-close-tag)
  3097. ((and accessor (pred functionp))
  3098. (funcall accessor
  3099. number group start-group-p end-group-p topp bottomp))
  3100. (accessor accessor)))
  3101. (group-tags
  3102. (cond
  3103. ;; Row belongs to second or subsequent groups.
  3104. ((not (= 1 group)) '("<tbody>" . "\n</tbody>"))
  3105. ;; Row is from first group. Table has >=1 groups.
  3106. ((org-export-table-has-header-p
  3107. (org-export-get-parent-table table-row) info)
  3108. '("<thead>" . "\n</thead>"))
  3109. ;; Row is from first and only group.
  3110. (t '("<tbody>" . "\n</tbody>")))))
  3111. (concat (and start-group-p (car group-tags))
  3112. (concat "\n"
  3113. row-open-tag
  3114. contents
  3115. "\n"
  3116. row-close-tag)
  3117. (and end-group-p (cdr group-tags))))))
  3118. ;;;; Table
  3119. (defun org-html-table-first-row-data-cells (table info)
  3120. "Transcode the first row of TABLE.
  3121. INFO is a plist used as a communication channel."
  3122. (let ((table-row
  3123. (org-element-map table 'table-row
  3124. (lambda (row)
  3125. (unless (eq (org-element-property :type row) 'rule) row))
  3126. info 'first-match))
  3127. (special-column-p (org-export-table-has-special-column-p table)))
  3128. (if (not special-column-p) (org-element-contents table-row)
  3129. (cdr (org-element-contents table-row)))))
  3130. (defun org-html-table--table.el-table (table _info)
  3131. "Format table.el tables into HTML.
  3132. INFO is a plist used as a communication channel."
  3133. (when (eq (org-element-property :type table) 'table.el)
  3134. (require 'table)
  3135. (let ((outbuf (with-current-buffer
  3136. (get-buffer-create "*org-export-table*")
  3137. (erase-buffer) (current-buffer))))
  3138. (with-temp-buffer
  3139. (insert (org-element-property :value table))
  3140. (goto-char 1)
  3141. (re-search-forward "^[ \t]*|[^|]" nil t)
  3142. (table-generate-source 'html outbuf))
  3143. (with-current-buffer outbuf
  3144. (prog1 (org-trim (buffer-string))
  3145. (kill-buffer) )))))
  3146. (defun org-html-table (table contents info)
  3147. "Transcode a TABLE element from Org to HTML.
  3148. CONTENTS is the contents of the table. INFO is a plist holding
  3149. contextual information."
  3150. (if (eq (org-element-property :type table) 'table.el)
  3151. ;; "table.el" table. Convert it using appropriate tools.
  3152. (org-html-table--table.el-table table info)
  3153. ;; Standard table.
  3154. (let* ((caption (org-export-get-caption table))
  3155. (number (org-export-get-ordinal
  3156. table info nil #'org-html--has-caption-p))
  3157. (attributes
  3158. (org-html--make-attribute-string
  3159. (org-combine-plists
  3160. (and (org-element-property :name table)
  3161. (list :id (org-export-get-reference table info)))
  3162. (and (not (org-html-html5-p info))
  3163. (plist-get info :html-table-attributes))
  3164. (org-export-read-attribute :attr_html table))))
  3165. (alignspec
  3166. (if (bound-and-true-p org-html-format-table-no-css)
  3167. "align=\"%s\""
  3168. "class=\"org-%s\""))
  3169. (table-column-specs
  3170. (lambda (table info)
  3171. (mapconcat
  3172. (lambda (table-cell)
  3173. (let ((alignment (org-export-table-cell-alignment
  3174. table-cell info)))
  3175. (concat
  3176. ;; Begin a colgroup?
  3177. (when (org-export-table-cell-starts-colgroup-p
  3178. table-cell info)
  3179. "\n<colgroup>")
  3180. ;; Add a column. Also specify its alignment.
  3181. (format "\n%s"
  3182. (org-html-close-tag
  3183. "col" (concat " " (format alignspec alignment)) info))
  3184. ;; End a colgroup?
  3185. (when (org-export-table-cell-ends-colgroup-p
  3186. table-cell info)
  3187. "\n</colgroup>"))))
  3188. (org-html-table-first-row-data-cells table info) "\n"))))
  3189. (format "<table%s>\n%s\n%s\n%s</table>"
  3190. (if (equal attributes "") "" (concat " " attributes))
  3191. (if (not caption) ""
  3192. (format (if (plist-get info :html-table-caption-above)
  3193. "<caption class=\"t-above\">%s</caption>"
  3194. "<caption class=\"t-bottom\">%s</caption>")
  3195. (concat
  3196. "<span class=\"table-number\">"
  3197. (format (org-html--translate "Table %d:" info) number)
  3198. "</span> " (org-export-data caption info))))
  3199. (funcall table-column-specs table info)
  3200. contents))))
  3201. ;;;; Target
  3202. (defun org-html-target (target _contents info)
  3203. "Transcode a TARGET object from Org to HTML.
  3204. CONTENTS is nil. INFO is a plist holding contextual
  3205. information."
  3206. (let ((ref (org-export-get-reference target info)))
  3207. (org-html--anchor ref nil nil info)))
  3208. ;;;; Timestamp
  3209. (defun org-html-timestamp (timestamp _contents info)
  3210. "Transcode a TIMESTAMP object from Org to HTML.
  3211. CONTENTS is nil. INFO is a plist holding contextual
  3212. information."
  3213. (let ((value (org-html-plain-text (org-timestamp-translate timestamp) info)))
  3214. (format "<span class=\"timestamp-wrapper\"><span class=\"timestamp\">%s</span></span>"
  3215. (replace-regexp-in-string "--" "&#x2013;" value))))
  3216. ;;;; Underline
  3217. (defun org-html-underline (_underline contents info)
  3218. "Transcode UNDERLINE from Org to HTML.
  3219. CONTENTS is the text with underline markup. INFO is a plist
  3220. holding contextual information."
  3221. (format (or (cdr (assq 'underline (plist-get info :html-text-markup-alist)))
  3222. "%s")
  3223. contents))
  3224. ;;;; Verbatim
  3225. (defun org-html-verbatim (verbatim _contents info)
  3226. "Transcode VERBATIM from Org to HTML.
  3227. CONTENTS is nil. INFO is a plist holding contextual
  3228. information."
  3229. (format (or (cdr (assq 'verbatim (plist-get info :html-text-markup-alist))) "%s")
  3230. (org-html-encode-plain-text (org-element-property :value verbatim))))
  3231. ;;;; Verse Block
  3232. (defun org-html-verse-block (_verse-block contents info)
  3233. "Transcode a VERSE-BLOCK element from Org to HTML.
  3234. CONTENTS is verse block contents. INFO is a plist holding
  3235. contextual information."
  3236. ;; Replace each newline character with line break. Also replace
  3237. ;; each blank line with a line break.
  3238. (setq contents (replace-regexp-in-string
  3239. "^ *\\\\\\\\$" (format "%s\n" (org-html-close-tag "br" nil info))
  3240. (replace-regexp-in-string
  3241. "\\(\\\\\\\\\\)?[ \t]*\n"
  3242. (format "%s\n" (org-html-close-tag "br" nil info)) contents)))
  3243. ;; Replace each white space at beginning of a line with a
  3244. ;; non-breaking space.
  3245. (while (string-match "^[ \t]+" contents)
  3246. (let* ((num-ws (length (match-string 0 contents)))
  3247. (ws (org-html--make-string num-ws "&#xa0;")))
  3248. (setq contents (replace-match ws nil t contents))))
  3249. (format "<p class=\"verse\">\n%s</p>" 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