ox-html.el 137 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725
  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?': non-nil means the row starts a group
  850. `end-group?': non-nil means the row ends a group
  851. `top?': non-nil means this is the top row
  852. `bottom?': non-nil means this is the bottom row
  853. For example:
  854. (setq org-html-table-row-open-tag
  855. (lambda (number group-number start-group? end-group-p top? bottom?)
  856. (cond (top? \"<tr class=\\\"tr-top\\\">\")
  857. (bottom? \"<tr class=\\\"tr-bottom\\\">\")
  858. (t (if (= (mod number 2) 1)
  859. \"<tr class=\\\"tr-odd\\\">\"
  860. \"<tr class=\\\"tr-even\\\">\")))))
  861. will use the \"tr-top\" and \"tr-bottom\" classes for the top row
  862. and the bottom row, and otherwise alternate between \"tr-odd\" and
  863. \"tr-even\" for odd and even rows."
  864. :group 'org-export-html
  865. :type '(choice :tag "Opening tag"
  866. (string :tag "Specify")
  867. (function)))
  868. (defcustom org-html-table-row-close-tag "</tr>"
  869. "The closing tag for table rows.
  870. This is customizable so that alignment options can be specified.
  871. Instead of strings, this can be a Lisp function that will be
  872. evaluated for each row in order to construct the table row tags.
  873. See documentation of `org-html-table-row-open-tag'."
  874. :group 'org-export-html
  875. :type '(choice :tag "Closing tag"
  876. (string :tag "Specify")
  877. (function)))
  878. (defcustom org-html-table-align-individual-fields t
  879. "Non-nil means attach style attributes for alignment to each table field.
  880. When nil, alignment will only be specified in the column tags, but this
  881. is ignored by some browsers (like Firefox, Safari). Opera does it right
  882. though."
  883. :group 'org-export-html
  884. :type 'boolean)
  885. (defcustom org-html-table-use-header-tags-for-first-column nil
  886. "Non-nil means format column one in tables with header tags.
  887. When nil, also column one will use data tags."
  888. :group 'org-export-html
  889. :type 'boolean)
  890. (defcustom org-html-table-caption-above t
  891. "When non-nil, place caption string at the beginning of the table.
  892. Otherwise, place it near the end."
  893. :group 'org-export-html
  894. :type 'boolean)
  895. ;;;; Tags
  896. (defcustom org-html-tag-class-prefix ""
  897. "Prefix to class names for TODO keywords.
  898. Each tag gets a class given by the tag itself, with this prefix.
  899. The default prefix is empty because it is nice to just use the keyword
  900. as a class name. But if you get into conflicts with other, existing
  901. CSS classes, then this prefix can be very useful."
  902. :group 'org-export-html
  903. :type 'string)
  904. ;;;; Template :: Generic
  905. (defcustom org-html-extension "html"
  906. "The extension for exported HTML files."
  907. :group 'org-export-html
  908. :type 'string)
  909. (defcustom org-html-xml-declaration
  910. '(("html" . "<?xml version=\"1.0\" encoding=\"%s\"?>")
  911. ("php" . "<?php echo \"<?xml version=\\\"1.0\\\" encoding=\\\"%s\\\" ?>\"; ?>"))
  912. "The extension for exported HTML files.
  913. %s will be replaced with the charset of the exported file.
  914. This may be a string, or an alist with export extensions
  915. and corresponding declarations.
  916. This declaration only applies when exporting to XHTML."
  917. :group 'org-export-html
  918. :type '(choice
  919. (string :tag "Single declaration")
  920. (repeat :tag "Dependent on extension"
  921. (cons (string :tag "Extension")
  922. (string :tag "Declaration")))))
  923. (defcustom org-html-coding-system 'utf-8
  924. "Coding system for HTML export.
  925. Use utf-8 as the default value."
  926. :group 'org-export-html
  927. :version "24.4"
  928. :package-version '(Org . "8.0")
  929. :type 'coding-system)
  930. (defcustom org-html-doctype "xhtml-strict"
  931. "Document type definition to use for exported HTML files.
  932. Can be set with the in-buffer HTML_DOCTYPE property or for
  933. publishing, with :html-doctype."
  934. :group 'org-export-html
  935. :version "24.4"
  936. :package-version '(Org . "8.0")
  937. :type (append
  938. '(choice)
  939. (mapcar (lambda (x) `(const ,(car x))) org-html-doctype-alist)
  940. '((string :tag "Custom doctype" ))))
  941. (defcustom org-html-html5-fancy nil
  942. "Non-nil means using new HTML5 elements.
  943. This variable is ignored for anything other than HTML5 export.
  944. For compatibility with Internet Explorer, it's probably a good
  945. idea to download some form of the html5shiv (for instance
  946. https://code.google.com/p/html5shiv/) and add it to your
  947. HTML_HEAD_EXTRA, so that your pages don't break for users of IE
  948. versions 8 and below."
  949. :group 'org-export-html
  950. :version "24.4"
  951. :package-version '(Org . "8.0")
  952. :type 'boolean)
  953. (defcustom org-html-container-element "div"
  954. "HTML element to use for wrapping top level sections.
  955. Can be set with the in-buffer HTML_CONTAINER property or for
  956. publishing, with :html-container.
  957. Note that changing the default will prevent you from using
  958. org-info.js for your website."
  959. :group 'org-export-html
  960. :version "24.4"
  961. :package-version '(Org . "8.0")
  962. :type 'string)
  963. (defcustom org-html-divs
  964. '((preamble "div" "preamble")
  965. (content "div" "content")
  966. (postamble "div" "postamble"))
  967. "Alist of the three section elements for HTML export.
  968. The car of each entry is one of `preamble', `content' or `postamble'.
  969. The cdrs of each entry are the ELEMENT_TYPE and ID for each
  970. section of the exported document.
  971. Note that changing the default will prevent you from using
  972. org-info.js for your website."
  973. :group 'org-export-html
  974. :version "24.4"
  975. :package-version '(Org . "8.0")
  976. :type '(list :greedy t
  977. (list :tag "Preamble"
  978. (const :format "" preamble)
  979. (string :tag "element") (string :tag " id"))
  980. (list :tag "Content"
  981. (const :format "" content)
  982. (string :tag "element") (string :tag " id"))
  983. (list :tag "Postamble" (const :format "" postamble)
  984. (string :tag " id") (string :tag "element"))))
  985. (defconst org-html-checkbox-types
  986. '((unicode .
  987. ((on . "&#x2611;") (off . "&#x2610;") (trans . "&#x2610;")))
  988. (ascii .
  989. ((on . "<code>[X]</code>")
  990. (off . "<code>[&#xa0;]</code>")
  991. (trans . "<code>[-]</code>")))
  992. (html .
  993. ((on . "<input type='checkbox' checked='checked' />")
  994. (off . "<input type='checkbox' />")
  995. (trans . "<input type='checkbox' />"))))
  996. "Alist of checkbox types.
  997. The cdr of each entry is an alist list three checkbox types for
  998. HTML export: `on', `off' and `trans'.
  999. The choices are:
  1000. `unicode' Unicode characters (HTML entities)
  1001. `ascii' ASCII characters
  1002. `html' HTML checkboxes
  1003. Note that only the ascii characters implement tri-state
  1004. checkboxes. The other two use the `off' checkbox for `trans'.")
  1005. (defcustom org-html-checkbox-type 'ascii
  1006. "The type of checkboxes to use for HTML export.
  1007. See `org-html-checkbox-types' for for the values used for each
  1008. option."
  1009. :group 'org-export-html
  1010. :version "24.4"
  1011. :package-version '(Org . "8.0")
  1012. :type '(choice
  1013. (const :tag "ASCII characters" ascii)
  1014. (const :tag "Unicode characters" unicode)
  1015. (const :tag "HTML checkboxes" html)))
  1016. (defcustom org-html-metadata-timestamp-format "%Y-%m-%d %a %H:%M"
  1017. "Format used for timestamps in preamble, postamble and metadata.
  1018. See `format-time-string' for more information on its components."
  1019. :group 'org-export-html
  1020. :version "24.4"
  1021. :package-version '(Org . "8.0")
  1022. :type 'string)
  1023. ;;;; Template :: Mathjax
  1024. (defcustom org-html-mathjax-options
  1025. '((path "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 preamble and postamble.
  1662. INFO is a plist used as a communication channel."
  1663. (let ((timestamp-format (plist-get info :html-metadata-timestamp-format)))
  1664. `((?t . ,(org-export-data (plist-get info :title) info))
  1665. (?s . ,(org-export-data (plist-get info :subtitle) info))
  1666. (?d . ,(org-export-data (org-export-get-date info timestamp-format)
  1667. info))
  1668. (?T . ,(format-time-string timestamp-format))
  1669. (?a . ,(org-export-data (plist-get info :author) info))
  1670. (?e . ,(mapconcat
  1671. (lambda (e) (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 timestamp-format
  1677. (and file (nth 5 (file-attributes file))))))
  1678. (?v . ,(or (plist-get info :html-validation-link) "")))))
  1679. (defun org-html--build-pre/postamble (type info)
  1680. "Return document preamble or postamble as a string, or nil.
  1681. TYPE is either `preamble' or `postamble', INFO is a plist used as a
  1682. communication channel."
  1683. (let ((section (plist-get info (intern (format ":html-%s" type))))
  1684. (spec (org-html-format-spec info)))
  1685. (when section
  1686. (let ((section-contents
  1687. (if (functionp section) (funcall section info)
  1688. (cond
  1689. ((stringp section) (format-spec section spec))
  1690. ((eq section 'auto)
  1691. (let ((date (cdr (assq ?d spec)))
  1692. (author (cdr (assq ?a spec)))
  1693. (email (cdr (assq ?e spec)))
  1694. (creator (cdr (assq ?c spec)))
  1695. (validation-link (cdr (assq ?v spec))))
  1696. (concat
  1697. (when (and (plist-get info :with-date)
  1698. (org-string-nw-p date))
  1699. (format "<p class=\"date\">%s: %s</p>\n"
  1700. (org-html--translate "Date" info)
  1701. date))
  1702. (when (and (plist-get info :with-author)
  1703. (org-string-nw-p author))
  1704. (format "<p class=\"author\">%s: %s</p>\n"
  1705. (org-html--translate "Author" info)
  1706. author))
  1707. (when (and (plist-get info :with-email)
  1708. (org-string-nw-p email))
  1709. (format "<p class=\"email\">%s: %s</p>\n"
  1710. (org-html--translate "Email" info)
  1711. email))
  1712. (when (plist-get info :time-stamp-file)
  1713. (format
  1714. "<p class=\"date\">%s: %s</p>\n"
  1715. (org-html--translate "Created" info)
  1716. (format-time-string
  1717. (plist-get info :html-metadata-timestamp-format))))
  1718. (when (plist-get info :with-creator)
  1719. (format "<p class=\"creator\">%s</p>\n" creator))
  1720. (format "<p class=\"validation\">%s</p>\n"
  1721. validation-link))))
  1722. (t (format-spec
  1723. (or (cadr (assoc-string
  1724. (plist-get info :language)
  1725. (eval (intern
  1726. (format "org-html-%s-format" type)))
  1727. t))
  1728. (cadr
  1729. (assoc-string
  1730. "en"
  1731. (eval
  1732. (intern (format "org-html-%s-format" type)))
  1733. t)))
  1734. spec))))))
  1735. (let ((div (assq type (plist-get info :html-divs))))
  1736. (when (org-string-nw-p section-contents)
  1737. (concat
  1738. (format "<%s id=\"%s\" class=\"%s\">\n"
  1739. (nth 1 div)
  1740. (nth 2 div)
  1741. org-html--pre/postamble-class)
  1742. (org-element-normalize-string section-contents)
  1743. (format "</%s>\n" (nth 1 div)))))))))
  1744. (defun org-html-inner-template (contents info)
  1745. "Return body of document string after HTML conversion.
  1746. CONTENTS is the transcoded contents string. INFO is a plist
  1747. holding export options."
  1748. (concat
  1749. ;; Table of contents.
  1750. (let ((depth (plist-get info :with-toc)))
  1751. (when depth (org-html-toc depth info)))
  1752. ;; Document contents.
  1753. contents
  1754. ;; Footnotes section.
  1755. (org-html-footnote-section info)))
  1756. (defun org-html-template (contents info)
  1757. "Return complete document string after HTML conversion.
  1758. CONTENTS is the transcoded contents string. INFO is a plist
  1759. holding export options."
  1760. (concat
  1761. (when (and (not (org-html-html5-p info)) (org-html-xhtml-p info))
  1762. (let* ((xml-declaration (plist-get info :html-xml-declaration))
  1763. (decl (or (and (stringp xml-declaration) xml-declaration)
  1764. (cdr (assoc (plist-get info :html-extension)
  1765. xml-declaration))
  1766. (cdr (assoc "html" xml-declaration))
  1767. "")))
  1768. (when (not (or (not decl) (string= "" decl)))
  1769. (format "%s\n"
  1770. (format decl
  1771. (or (and org-html-coding-system
  1772. (fboundp 'coding-system-get)
  1773. (coding-system-get org-html-coding-system 'mime-charset))
  1774. "iso-8859-1"))))))
  1775. (org-html-doctype info)
  1776. "\n"
  1777. (concat "<html"
  1778. (cond ((org-html-xhtml-p info)
  1779. (format
  1780. " xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"%s\" xml:lang=\"%s\""
  1781. (plist-get info :language) (plist-get info :language)))
  1782. ((org-html-html5-p info)
  1783. (format " lang=\"%s\"" (plist-get info :language))))
  1784. ">\n")
  1785. "<head>\n"
  1786. (org-html--build-meta-info info)
  1787. (org-html--build-head info)
  1788. (org-html--build-mathjax-config info)
  1789. "</head>\n"
  1790. "<body>\n"
  1791. (let ((link-up (org-trim (plist-get info :html-link-up)))
  1792. (link-home (org-trim (plist-get info :html-link-home))))
  1793. (unless (and (string= link-up "") (string= link-home ""))
  1794. (format (plist-get info :html-home/up-format)
  1795. (or link-up link-home)
  1796. (or link-home link-up))))
  1797. ;; Preamble.
  1798. (org-html--build-pre/postamble 'preamble info)
  1799. ;; Document contents.
  1800. (let ((div (assq 'content (plist-get info :html-divs))))
  1801. (format "<%s id=\"%s\">\n" (nth 1 div) (nth 2 div)))
  1802. ;; Document title.
  1803. (when (plist-get info :with-title)
  1804. (let ((title (plist-get info :title))
  1805. (subtitle (plist-get info :subtitle))
  1806. (html5-fancy (org-html--html5-fancy-p info)))
  1807. (when title
  1808. (format
  1809. (if html5-fancy
  1810. "<header>\n<h1 class=\"title\">%s</h1>\n%s</header>"
  1811. "<h1 class=\"title\">%s%s</h1>\n")
  1812. (org-export-data title info)
  1813. (if subtitle
  1814. (format
  1815. (if html5-fancy
  1816. "<p class=\"subtitle\">%s</p>\n"
  1817. "\n<br>\n<span class=\"subtitle\">%s</span>\n")
  1818. (org-export-data subtitle info))
  1819. "")))))
  1820. contents
  1821. (format "</%s>\n" (nth 1 (assq 'content (plist-get info :html-divs))))
  1822. ;; Postamble.
  1823. (org-html--build-pre/postamble 'postamble info)
  1824. ;; Closing document.
  1825. "</body>\n</html>"))
  1826. (defun org-html--translate (s info)
  1827. "Translate string S according to specified language.
  1828. INFO is a plist used as a communication channel."
  1829. (org-export-translate s :html info))
  1830. ;;;; Anchor
  1831. (defun org-html--anchor (id desc attributes info)
  1832. "Format a HTML anchor."
  1833. (let* ((name (and (plist-get info :html-allow-name-attribute-in-anchors) id))
  1834. (attributes (concat (and id (format " id=\"%s\"" id))
  1835. (and name (format " name=\"%s\"" name))
  1836. attributes)))
  1837. (format "<a%s>%s</a>" attributes (or desc ""))))
  1838. ;;;; Todo
  1839. (defun org-html--todo (todo info)
  1840. "Format TODO keywords into HTML."
  1841. (when todo
  1842. (format "<span class=\"%s %s%s\">%s</span>"
  1843. (if (member todo org-done-keywords) "done" "todo")
  1844. (or (plist-get info :html-todo-kwd-class-prefix) "")
  1845. (org-html-fix-class-name todo)
  1846. todo)))
  1847. ;;;; Priority
  1848. (defun org-html--priority (priority _info)
  1849. "Format a priority into HTML.
  1850. PRIORITY is the character code of the priority or nil. INFO is
  1851. a plist containing export options."
  1852. (and priority (format "<span class=\"priority\">[%c]</span>" priority)))
  1853. ;;;; Tags
  1854. (defun org-html--tags (tags info)
  1855. "Format TAGS into HTML.
  1856. INFO is a plist containing export options."
  1857. (when tags
  1858. (format "<span class=\"tag\">%s</span>"
  1859. (mapconcat
  1860. (lambda (tag)
  1861. (format "<span class=\"%s\">%s</span>"
  1862. (concat (plist-get info :html-tag-class-prefix)
  1863. (org-html-fix-class-name tag))
  1864. tag))
  1865. tags "&#xa0;"))))
  1866. ;;;; Src Code
  1867. (defun org-html-fontify-code (code lang)
  1868. "Color CODE with htmlize library.
  1869. CODE is a string representing the source code to colorize. LANG
  1870. is the language used for CODE, as a string, or nil."
  1871. (when code
  1872. (cond
  1873. ;; Case 1: No lang. Possibly an example block.
  1874. ((not lang)
  1875. ;; Simple transcoding.
  1876. (org-html-encode-plain-text code))
  1877. ;; Case 2: No htmlize or an inferior version of htmlize
  1878. ((not (and (require 'htmlize nil t) (fboundp 'htmlize-region-for-paste)))
  1879. ;; Emit a warning.
  1880. (message "Cannot fontify src block (htmlize.el >= 1.34 required)")
  1881. ;; Simple transcoding.
  1882. (org-html-encode-plain-text code))
  1883. ;; Case 3: plain text explicitly set
  1884. ((not org-html-htmlize-output-type)
  1885. ;; Simple transcoding.
  1886. (org-html-encode-plain-text code))
  1887. (t
  1888. ;; Map language
  1889. (setq lang (or (assoc-default lang org-src-lang-modes) lang))
  1890. (let* ((lang-mode (and lang (intern (format "%s-mode" lang)))))
  1891. (cond
  1892. ;; Case 1: Language is not associated with any Emacs mode
  1893. ((not (functionp lang-mode))
  1894. ;; Simple transcoding.
  1895. (org-html-encode-plain-text code))
  1896. ;; Case 2: Default. Fontify code.
  1897. (t
  1898. ;; htmlize
  1899. (setq code
  1900. (let ((output-type org-html-htmlize-output-type)
  1901. (font-prefix org-html-htmlize-font-prefix))
  1902. (with-temp-buffer
  1903. ;; Switch to language-specific mode.
  1904. (funcall lang-mode)
  1905. (insert code)
  1906. ;; Fontify buffer.
  1907. (org-font-lock-ensure)
  1908. ;; Remove formatting on newline characters.
  1909. (save-excursion
  1910. (let ((beg (point-min))
  1911. (end (point-max)))
  1912. (goto-char beg)
  1913. (while (progn (end-of-line) (< (point) end))
  1914. (put-text-property (point) (1+ (point)) 'face nil)
  1915. (forward-char 1))))
  1916. (org-src-mode)
  1917. (set-buffer-modified-p nil)
  1918. ;; Htmlize region.
  1919. (let ((org-html-htmlize-output-type output-type)
  1920. (org-html-htmlize-font-prefix font-prefix))
  1921. (org-html-htmlize-region-for-paste
  1922. (point-min) (point-max))))))
  1923. ;; Strip any enclosing <pre></pre> tags.
  1924. (let* ((beg (and (string-match "\\`<pre[^>]*>\n*" code) (match-end 0)))
  1925. (end (and beg (string-match "</pre>\\'" code))))
  1926. (if (and beg end) (substring code beg end) code)))))))))
  1927. (defun org-html-do-format-code
  1928. (code &optional lang refs retain-labels num-start)
  1929. "Format CODE string as source code.
  1930. Optional arguments LANG, REFS, RETAIN-LABELS and NUM-START are,
  1931. respectively, the language of the source code, as a string, an
  1932. alist between line numbers and references (as returned by
  1933. `org-export-unravel-code'), a boolean specifying if labels should
  1934. appear in the source code, and the number associated to the first
  1935. line of code."
  1936. (let* ((code-lines (org-split-string code "\n"))
  1937. (code-length (length code-lines))
  1938. (num-fmt
  1939. (and num-start
  1940. (format "%%%ds: "
  1941. (length (number-to-string (+ code-length num-start))))))
  1942. (code (org-html-fontify-code code lang)))
  1943. (org-export-format-code
  1944. code
  1945. (lambda (loc line-num ref)
  1946. (setq loc
  1947. (concat
  1948. ;; Add line number, if needed.
  1949. (when num-start
  1950. (format "<span class=\"linenr\">%s</span>"
  1951. (format num-fmt line-num)))
  1952. ;; Transcoded src line.
  1953. loc
  1954. ;; Add label, if needed.
  1955. (when (and ref retain-labels) (format " (%s)" ref))))
  1956. ;; Mark transcoded line as an anchor, if needed.
  1957. (if (not ref) loc
  1958. (format "<span id=\"coderef-%s\" class=\"coderef-off\">%s</span>"
  1959. ref loc)))
  1960. num-start refs)))
  1961. (defun org-html-format-code (element info)
  1962. "Format contents of ELEMENT as source code.
  1963. ELEMENT is either an example block or a src block. INFO is
  1964. a plist used as a communication channel."
  1965. (let* ((lang (org-element-property :language element))
  1966. ;; Extract code and references.
  1967. (code-info (org-export-unravel-code element))
  1968. (code (car code-info))
  1969. (refs (cdr code-info))
  1970. ;; Does the src block contain labels?
  1971. (retain-labels (org-element-property :retain-labels element))
  1972. ;; Does it have line numbers?
  1973. (num-start (org-export-get-loc element info)))
  1974. (org-html-do-format-code code lang refs retain-labels num-start)))
  1975. ;;; Tables of Contents
  1976. (defun org-html-toc (depth info &optional scope)
  1977. "Build a table of contents.
  1978. DEPTH is an integer specifying the depth of the table. INFO is
  1979. a plist used as a communication channel. Optional argument SCOPE
  1980. is an element defining the scope of the table. Return the table
  1981. of contents as a string, or nil if it is empty."
  1982. (let ((toc-entries
  1983. (mapcar (lambda (headline)
  1984. (cons (org-html--format-toc-headline headline info)
  1985. (org-export-get-relative-level headline info)))
  1986. (org-export-collect-headlines info depth scope))))
  1987. (when toc-entries
  1988. (let ((toc (concat "<div id=\"text-table-of-contents\">"
  1989. (org-html--toc-text toc-entries)
  1990. "</div>\n")))
  1991. (if scope toc
  1992. (let ((outer-tag (if (org-html--html5-fancy-p info)
  1993. "nav"
  1994. "div")))
  1995. (concat (format "<%s id=\"table-of-contents\">\n" outer-tag)
  1996. (let ((top-level (plist-get info :html-toplevel-hlevel)))
  1997. (format "<h%d>%s</h%d>\n"
  1998. top-level
  1999. (org-html--translate "Table of Contents" info)
  2000. top-level))
  2001. toc
  2002. (format "</%s>\n" outer-tag))))))))
  2003. (defun org-html--toc-text (toc-entries)
  2004. "Return innards of a table of contents, as a string.
  2005. TOC-ENTRIES is an alist where key is an entry title, as a string,
  2006. and value is its relative level, as an integer."
  2007. (let* ((prev-level (1- (cdar toc-entries)))
  2008. (start-level prev-level))
  2009. (concat
  2010. (mapconcat
  2011. (lambda (entry)
  2012. (let ((headline (car entry))
  2013. (level (cdr entry)))
  2014. (concat
  2015. (let* ((cnt (- level prev-level))
  2016. (times (if (> cnt 0) (1- cnt) (- cnt))))
  2017. (setq prev-level level)
  2018. (concat
  2019. (org-html--make-string
  2020. times (cond ((> cnt 0) "\n<ul>\n<li>")
  2021. ((< cnt 0) "</li>\n</ul>\n")))
  2022. (if (> cnt 0) "\n<ul>\n<li>" "</li>\n<li>")))
  2023. headline)))
  2024. toc-entries "")
  2025. (org-html--make-string (- prev-level start-level) "</li>\n</ul>\n"))))
  2026. (defun org-html--format-toc-headline (headline info)
  2027. "Return an appropriate table of contents entry for HEADLINE.
  2028. INFO is a plist used as a communication channel."
  2029. (let* ((headline-number (org-export-get-headline-number headline info))
  2030. (todo (and (plist-get info :with-todo-keywords)
  2031. (let ((todo (org-element-property :todo-keyword headline)))
  2032. (and todo (org-export-data todo info)))))
  2033. (todo-type (and todo (org-element-property :todo-type headline)))
  2034. (priority (and (plist-get info :with-priority)
  2035. (org-element-property :priority headline)))
  2036. (text (org-export-data-with-backend
  2037. (org-export-get-alt-title headline info)
  2038. ;; Create an anonymous back-end that will ignore any
  2039. ;; footnote-reference, link, radio-target and target
  2040. ;; in table of contents.
  2041. (org-export-create-backend
  2042. :parent 'html
  2043. :transcoders '((footnote-reference . ignore)
  2044. (link . (lambda (object c i) c))
  2045. (radio-target . (lambda (object c i) c))
  2046. (target . ignore)))
  2047. info))
  2048. (tags (and (eq (plist-get info :with-tags) t)
  2049. (org-export-get-tags headline info))))
  2050. (format "<a href=\"#%s\">%s</a>"
  2051. ;; Label.
  2052. (or (org-element-property :CUSTOM_ID headline)
  2053. (org-export-get-reference headline info))
  2054. ;; Body.
  2055. (concat
  2056. (and (not (org-export-low-level-p headline info))
  2057. (org-export-numbered-headline-p headline info)
  2058. (concat (mapconcat #'number-to-string headline-number ".")
  2059. ". "))
  2060. (apply (plist-get info :html-format-headline-function)
  2061. todo todo-type priority text tags :section-number nil)))))
  2062. (defun org-html-list-of-listings (info)
  2063. "Build a list of listings.
  2064. INFO is a plist used as a communication channel. Return the list
  2065. of listings as a string, or nil if it is empty."
  2066. (let ((lol-entries (org-export-collect-listings info)))
  2067. (when lol-entries
  2068. (concat "<div id=\"list-of-listings\">\n"
  2069. (let ((top-level (plist-get info :html-toplevel-hlevel)))
  2070. (format "<h%d>%s</h%d>\n"
  2071. top-level
  2072. (org-html--translate "List of Listings" info)
  2073. top-level))
  2074. "<div id=\"text-list-of-listings\">\n<ul>\n"
  2075. (let ((count 0)
  2076. (initial-fmt (format "<span class=\"listing-number\">%s</span>"
  2077. (org-html--translate "Listing %d:" info))))
  2078. (mapconcat
  2079. (lambda (entry)
  2080. (let ((label (and (org-element-property :name entry)
  2081. (org-export-get-reference entry info)))
  2082. (title (org-trim
  2083. (org-export-data
  2084. (or (org-export-get-caption entry t)
  2085. (org-export-get-caption entry))
  2086. info))))
  2087. (concat
  2088. "<li>"
  2089. (if (not label)
  2090. (concat (format initial-fmt (cl-incf count))
  2091. " "
  2092. title)
  2093. (format "<a href=\"#%s\">%s %s</a>"
  2094. label
  2095. (format initial-fmt (cl-incf count))
  2096. title))
  2097. "</li>")))
  2098. lol-entries "\n"))
  2099. "\n</ul>\n</div>\n</div>"))))
  2100. (defun org-html-list-of-tables (info)
  2101. "Build a list of tables.
  2102. INFO is a plist used as a communication channel. Return the list
  2103. of tables as a string, or nil if it is empty."
  2104. (let ((lol-entries (org-export-collect-tables info)))
  2105. (when lol-entries
  2106. (concat "<div id=\"list-of-tables\">\n"
  2107. (let ((top-level (plist-get info :html-toplevel-hlevel)))
  2108. (format "<h%d>%s</h%d>\n"
  2109. top-level
  2110. (org-html--translate "List of Tables" info)
  2111. top-level))
  2112. "<div id=\"text-list-of-tables\">\n<ul>\n"
  2113. (let ((count 0)
  2114. (initial-fmt (format "<span class=\"table-number\">%s</span>"
  2115. (org-html--translate "Table %d:" info))))
  2116. (mapconcat
  2117. (lambda (entry)
  2118. (let ((label (and (org-element-property :name entry)
  2119. (org-export-get-reference entry info)))
  2120. (title (org-trim
  2121. (org-export-data
  2122. (or (org-export-get-caption entry t)
  2123. (org-export-get-caption entry))
  2124. info))))
  2125. (concat
  2126. "<li>"
  2127. (if (not label)
  2128. (concat (format initial-fmt (cl-incf count))
  2129. " "
  2130. title)
  2131. (format "<a href=\"#%s\">%s %s</a>"
  2132. label
  2133. (format initial-fmt (cl-incf count))
  2134. title))
  2135. "</li>")))
  2136. lol-entries "\n"))
  2137. "\n</ul>\n</div>\n</div>"))))
  2138. ;;; Transcode Functions
  2139. ;;;; Bold
  2140. (defun org-html-bold (_bold contents info)
  2141. "Transcode BOLD from Org to HTML.
  2142. CONTENTS is the text with bold markup. INFO is a plist holding
  2143. contextual information."
  2144. (format (or (cdr (assq 'bold (plist-get info :html-text-markup-alist))) "%s")
  2145. contents))
  2146. ;;;; Center Block
  2147. (defun org-html-center-block (_center-block contents _info)
  2148. "Transcode a CENTER-BLOCK element from Org to HTML.
  2149. CONTENTS holds the contents of the block. INFO is a plist
  2150. holding contextual information."
  2151. (format "<div class=\"org-center\">\n%s</div>" contents))
  2152. ;;;; Clock
  2153. (defun org-html-clock (clock _contents _info)
  2154. "Transcode a CLOCK element from Org to HTML.
  2155. CONTENTS is nil. INFO is a plist used as a communication
  2156. channel."
  2157. (format "<p>
  2158. <span class=\"timestamp-wrapper\">
  2159. <span class=\"timestamp-kwd\">%s</span> <span class=\"timestamp\">%s</span>%s
  2160. </span>
  2161. </p>"
  2162. org-clock-string
  2163. (org-timestamp-translate (org-element-property :value clock))
  2164. (let ((time (org-element-property :duration clock)))
  2165. (and time (format " <span class=\"timestamp\">(%s)</span>" time)))))
  2166. ;;;; Code
  2167. (defun org-html-code (code _contents info)
  2168. "Transcode CODE from Org to HTML.
  2169. CONTENTS is nil. INFO is a plist holding contextual
  2170. information."
  2171. (format (or (cdr (assq 'code (plist-get info :html-text-markup-alist))) "%s")
  2172. (org-html-encode-plain-text (org-element-property :value code))))
  2173. ;;;; Drawer
  2174. (defun org-html-drawer (drawer contents info)
  2175. "Transcode a DRAWER element from Org to HTML.
  2176. CONTENTS holds the contents of the block. INFO is a plist
  2177. holding contextual information."
  2178. (funcall (plist-get info :html-format-drawer-function)
  2179. (org-element-property :drawer-name drawer)
  2180. contents))
  2181. ;;;; Dynamic Block
  2182. (defun org-html-dynamic-block (_dynamic-block contents _info)
  2183. "Transcode a DYNAMIC-BLOCK element from Org to HTML.
  2184. CONTENTS holds the contents of the block. INFO is a plist
  2185. holding contextual information. See `org-export-data'."
  2186. contents)
  2187. ;;;; Entity
  2188. (defun org-html-entity (entity _contents _info)
  2189. "Transcode an ENTITY object from Org to HTML.
  2190. CONTENTS are the definition itself. INFO is a plist holding
  2191. contextual information."
  2192. (org-element-property :html entity))
  2193. ;;;; Example Block
  2194. (defun org-html-example-block (example-block _contents info)
  2195. "Transcode a EXAMPLE-BLOCK element from Org to HTML.
  2196. CONTENTS is nil. INFO is a plist holding contextual
  2197. information."
  2198. (let ((attributes (org-export-read-attribute :attr_html example-block)))
  2199. (if (plist-get attributes :textarea)
  2200. (org-html--textarea-block example-block)
  2201. (format "<pre class=\"example\"%s>\n%s</pre>"
  2202. (let* ((name (org-element-property :name example-block))
  2203. (a (org-html--make-attribute-string
  2204. (if (or (not name) (plist-member attributes :id))
  2205. attributes
  2206. (plist-put attributes :id name)))))
  2207. (if (org-string-nw-p a) (concat " " a) ""))
  2208. (org-html-format-code example-block info)))))
  2209. ;;;; Export Snippet
  2210. (defun org-html-export-snippet (export-snippet _contents _info)
  2211. "Transcode a EXPORT-SNIPPET object from Org to HTML.
  2212. CONTENTS is nil. INFO is a plist holding contextual
  2213. information."
  2214. (when (eq (org-export-snippet-backend export-snippet) 'html)
  2215. (org-element-property :value export-snippet)))
  2216. ;;;; Export Block
  2217. (defun org-html-export-block (export-block _contents _info)
  2218. "Transcode a EXPORT-BLOCK element from Org to HTML.
  2219. CONTENTS is nil. INFO is a plist holding contextual information."
  2220. (when (string= (org-element-property :type export-block) "HTML")
  2221. (org-remove-indentation (org-element-property :value export-block))))
  2222. ;;;; Fixed Width
  2223. (defun org-html-fixed-width (fixed-width _contents _info)
  2224. "Transcode a FIXED-WIDTH element from Org to HTML.
  2225. CONTENTS is nil. INFO is a plist holding contextual information."
  2226. (format "<pre class=\"example\">\n%s</pre>"
  2227. (org-html-do-format-code
  2228. (org-remove-indentation
  2229. (org-element-property :value fixed-width)))))
  2230. ;;;; Footnote Reference
  2231. (defun org-html-footnote-reference (footnote-reference _contents info)
  2232. "Transcode a FOOTNOTE-REFERENCE element from Org to HTML.
  2233. CONTENTS is nil. INFO is a plist holding contextual information."
  2234. (concat
  2235. ;; Insert separator between two footnotes in a row.
  2236. (let ((prev (org-export-get-previous-element footnote-reference info)))
  2237. (when (eq (org-element-type prev) 'footnote-reference)
  2238. (plist-get info :html-footnote-separator)))
  2239. (let* ((n (org-export-get-footnote-number footnote-reference info))
  2240. (id (format "fnr.%d%s"
  2241. n
  2242. (if (org-export-footnote-first-reference-p
  2243. footnote-reference info)
  2244. ""
  2245. ".100"))))
  2246. (format
  2247. (plist-get info :html-footnote-format)
  2248. (org-html--anchor
  2249. id n (format " class=\"footref\" href=\"#fn.%d\"" n) info)))))
  2250. ;;;; Headline
  2251. (defun org-html-headline (headline contents info)
  2252. "Transcode a HEADLINE element from Org to HTML.
  2253. CONTENTS holds the contents of the headline. INFO is a plist
  2254. holding contextual information."
  2255. (unless (org-element-property :footnote-section-p headline)
  2256. (let* ((numberedp (org-export-numbered-headline-p headline info))
  2257. (numbers (org-export-get-headline-number headline info))
  2258. (level (+ (org-export-get-relative-level headline info)
  2259. (1- (plist-get info :html-toplevel-hlevel))))
  2260. (todo (and (plist-get info :with-todo-keywords)
  2261. (let ((todo (org-element-property :todo-keyword headline)))
  2262. (and todo (org-export-data todo info)))))
  2263. (todo-type (and todo (org-element-property :todo-type headline)))
  2264. (priority (and (plist-get info :with-priority)
  2265. (org-element-property :priority headline)))
  2266. (text (org-export-data (org-element-property :title headline) info))
  2267. (tags (and (plist-get info :with-tags)
  2268. (org-export-get-tags headline info)))
  2269. (full-text (funcall (plist-get info :html-format-headline-function)
  2270. todo todo-type priority text tags info))
  2271. (contents (or contents ""))
  2272. (ids (delq nil
  2273. (list (org-element-property :CUSTOM_ID headline)
  2274. (org-export-get-reference headline info)
  2275. (org-element-property :ID headline))))
  2276. (preferred-id (car ids))
  2277. (extra-ids
  2278. (mapconcat
  2279. (lambda (id)
  2280. (org-html--anchor
  2281. (if (org-uuidgen-p id) (concat "ID-" id) id)
  2282. nil nil info))
  2283. (cdr ids) "")))
  2284. (if (org-export-low-level-p headline info)
  2285. ;; This is a deep sub-tree: export it as a list item.
  2286. (let* ((type (if numberedp 'ordered 'unordered))
  2287. (itemized-body
  2288. (org-html-format-list-item
  2289. contents type nil info nil
  2290. (concat (org-html--anchor preferred-id nil nil info)
  2291. extra-ids
  2292. full-text))))
  2293. (concat (and (org-export-first-sibling-p headline info)
  2294. (org-html-begin-plain-list type))
  2295. itemized-body
  2296. (and (org-export-last-sibling-p headline info)
  2297. (org-html-end-plain-list type))))
  2298. (let ((extra-class (org-element-property :HTML_CONTAINER_CLASS headline))
  2299. (first-content (car (org-element-contents headline))))
  2300. ;; Standard headline. Export it as a section.
  2301. (format "<%s id=\"%s\" class=\"%s\">%s%s</%s>\n"
  2302. (org-html--container headline info)
  2303. (concat "outline-container-"
  2304. (org-export-get-reference headline info))
  2305. (concat (format "outline-%d" level)
  2306. (and extra-class " ")
  2307. extra-class)
  2308. (format "\n<h%d id=\"%s\">%s%s</h%d>\n"
  2309. level
  2310. preferred-id
  2311. extra-ids
  2312. (concat
  2313. (and numberedp
  2314. (format
  2315. "<span class=\"section-number-%d\">%s</span> "
  2316. level
  2317. (mapconcat #'number-to-string numbers ".")))
  2318. full-text)
  2319. level)
  2320. ;; When there is no section, pretend there is an
  2321. ;; empty one to get the correct <div
  2322. ;; class="outline-...> which is needed by
  2323. ;; `org-info.js'.
  2324. (if (eq (org-element-type first-content) 'section) contents
  2325. (concat (org-html-section first-content "" info) contents))
  2326. (org-html--container headline info)))))))
  2327. (defun org-html-format-headline-default-function
  2328. (todo _todo-type priority text tags info)
  2329. "Default format function for a headline.
  2330. See `org-html-format-headline-function' for details."
  2331. (let ((todo (org-html--todo todo info))
  2332. (priority (org-html--priority priority info))
  2333. (tags (org-html--tags tags info)))
  2334. (concat todo (and todo " ")
  2335. priority (and priority " ")
  2336. text
  2337. (and tags "&#xa0;&#xa0;&#xa0;") tags)))
  2338. (defun org-html--container (headline info)
  2339. (or (org-element-property :HTML_CONTAINER headline)
  2340. (if (= 1 (org-export-get-relative-level headline info))
  2341. (plist-get info :html-container)
  2342. "div")))
  2343. ;;;; Horizontal Rule
  2344. (defun org-html-horizontal-rule (_horizontal-rule _contents info)
  2345. "Transcode an HORIZONTAL-RULE object from Org to HTML.
  2346. CONTENTS is nil. INFO is a plist holding contextual information."
  2347. (org-html-close-tag "hr" nil info))
  2348. ;;;; Inline Src Block
  2349. (defun org-html-inline-src-block (inline-src-block _contents info)
  2350. "Transcode an INLINE-SRC-BLOCK element from Org to HTML.
  2351. CONTENTS holds the contents of the item. INFO is a plist holding
  2352. contextual information."
  2353. (let ((lang (org-element-property :language inline-src-block))
  2354. (code (org-element-property :value inline-src-block))
  2355. (label
  2356. (let ((lbl (and (org-element-property :name inline-src-block)
  2357. (org-export-get-reference inline-src-block info))))
  2358. (if (not lbl) "" (format " id=\"%s\"" lbl)))))
  2359. (format "<code class=\"src src-%s\"%s>%s</code>" lang label code)))
  2360. ;;;; Inlinetask
  2361. (defun org-html-inlinetask (inlinetask contents info)
  2362. "Transcode an INLINETASK element from Org to HTML.
  2363. CONTENTS holds the contents of the block. INFO is a plist
  2364. holding contextual information."
  2365. (let* ((todo (and (plist-get info :with-todo-keywords)
  2366. (let ((todo (org-element-property :todo-keyword inlinetask)))
  2367. (and todo (org-export-data todo info)))))
  2368. (todo-type (and todo (org-element-property :todo-type inlinetask)))
  2369. (priority (and (plist-get info :with-priority)
  2370. (org-element-property :priority inlinetask)))
  2371. (text (org-export-data (org-element-property :title inlinetask) info))
  2372. (tags (and (plist-get info :with-tags)
  2373. (org-export-get-tags inlinetask info))))
  2374. (funcall (plist-get info :html-format-inlinetask-function)
  2375. todo todo-type priority text tags contents info)))
  2376. (defun org-html-format-inlinetask-default-function
  2377. (todo todo-type priority text tags contents info)
  2378. "Default format function for a inlinetasks.
  2379. See `org-html-format-inlinetask-function' for details."
  2380. (format "<div class=\"inlinetask\">\n<b>%s</b>%s\n%s</div>"
  2381. (org-html-format-headline-default-function
  2382. todo todo-type priority text tags info)
  2383. (org-html-close-tag "br" nil info)
  2384. contents))
  2385. ;;;; Italic
  2386. (defun org-html-italic (_italic contents info)
  2387. "Transcode ITALIC from Org to HTML.
  2388. CONTENTS is the text with italic markup. INFO is a plist holding
  2389. contextual information."
  2390. (format
  2391. (or (cdr (assq 'italic (plist-get info :html-text-markup-alist))) "%s")
  2392. contents))
  2393. ;;;; Item
  2394. (defun org-html-checkbox (checkbox info)
  2395. "Format CHECKBOX into HTML.
  2396. INFO is a plist holding contextual information. See
  2397. `org-html-checkbox-type' for customization options."
  2398. (cdr (assq checkbox
  2399. (cdr (assq (plist-get info :html-checkbox-type)
  2400. org-html-checkbox-types)))))
  2401. (defun org-html-format-list-item (contents type checkbox info
  2402. &optional term-counter-id
  2403. headline)
  2404. "Format a list item into HTML."
  2405. (let ((class (if checkbox
  2406. (format " class=\"%s\""
  2407. (symbol-name checkbox)) ""))
  2408. (checkbox (concat (org-html-checkbox checkbox info)
  2409. (and checkbox " ")))
  2410. (br (org-html-close-tag "br" nil info)))
  2411. (concat
  2412. (pcase type
  2413. (`ordered
  2414. (let* ((counter term-counter-id)
  2415. (extra (if counter (format " value=\"%s\"" counter) "")))
  2416. (concat
  2417. (format "<li%s%s>" class extra)
  2418. (when headline (concat headline br)))))
  2419. (`unordered
  2420. (let* ((id term-counter-id)
  2421. (extra (if id (format " id=\"%s\"" id) "")))
  2422. (concat
  2423. (format "<li%s%s>" class extra)
  2424. (when headline (concat headline br)))))
  2425. (`descriptive
  2426. (let* ((term term-counter-id))
  2427. (setq term (or term "(no term)"))
  2428. ;; Check-boxes in descriptive lists are associated to tag.
  2429. (concat (format "<dt%s>%s</dt>"
  2430. class (concat checkbox term))
  2431. "<dd>"))))
  2432. (unless (eq type 'descriptive) checkbox)
  2433. (and contents (org-trim contents))
  2434. (pcase type
  2435. (`ordered "</li>")
  2436. (`unordered "</li>")
  2437. (`descriptive "</dd>")))))
  2438. (defun org-html-item (item contents info)
  2439. "Transcode an ITEM element from Org to HTML.
  2440. CONTENTS holds the contents of the item. INFO is a plist holding
  2441. contextual information."
  2442. (let* ((plain-list (org-export-get-parent item))
  2443. (type (org-element-property :type plain-list))
  2444. (counter (org-element-property :counter item))
  2445. (checkbox (org-element-property :checkbox item))
  2446. (tag (let ((tag (org-element-property :tag item)))
  2447. (and tag (org-export-data tag info)))))
  2448. (org-html-format-list-item
  2449. contents type checkbox info (or tag counter))))
  2450. ;;;; Keyword
  2451. (defun org-html-keyword (keyword _contents info)
  2452. "Transcode a KEYWORD element from Org to HTML.
  2453. CONTENTS is nil. INFO is a plist holding contextual information."
  2454. (let ((key (org-element-property :key keyword))
  2455. (value (org-element-property :value keyword)))
  2456. (cond
  2457. ((string= key "HTML") value)
  2458. ((string= key "TOC")
  2459. (let ((case-fold-search t))
  2460. (cond
  2461. ((string-match "\\<headlines\\>" value)
  2462. (let ((depth (and (string-match "\\<[0-9]+\\>" value)
  2463. (string-to-number (match-string 0 value))))
  2464. (localp (string-match-p "\\<local\\>" value)))
  2465. (org-html-toc depth info (and localp keyword))))
  2466. ((string= "listings" value) (org-html-list-of-listings info))
  2467. ((string= "tables" value) (org-html-list-of-tables info))))))))
  2468. ;;;; Latex Environment
  2469. (defun org-html-format-latex (latex-frag processing-type info)
  2470. "Format a LaTeX fragment LATEX-FRAG into HTML.
  2471. PROCESSING-TYPE designates the tool used for conversion. It can
  2472. be `mathjax', `verbatim', nil, t or symbols in
  2473. `org-preview-latex-process-alist', e.g., `dvipng', `dvisvgm' or
  2474. `imagemagick'. See `org-html-with-latex' for more information.
  2475. INFO is a plist containing export properties."
  2476. (let ((cache-relpath "") (cache-dir ""))
  2477. (unless (eq processing-type 'mathjax)
  2478. (let ((bfn (or (buffer-file-name)
  2479. (make-temp-name
  2480. (expand-file-name "latex" temporary-file-directory))))
  2481. (latex-header
  2482. (let ((header (plist-get info :latex-header)))
  2483. (and header
  2484. (concat (mapconcat
  2485. (lambda (line) (concat "#+LATEX_HEADER: " line))
  2486. (org-split-string header "\n")
  2487. "\n")
  2488. "\n")))))
  2489. (setq cache-relpath
  2490. (concat (file-name-as-directory org-preview-latex-image-directory)
  2491. (file-name-sans-extension
  2492. (file-name-nondirectory bfn)))
  2493. cache-dir (file-name-directory bfn))
  2494. ;; Re-create LaTeX environment from original buffer in
  2495. ;; temporary buffer so that dvipng/imagemagick can properly
  2496. ;; turn the fragment into an image.
  2497. (setq latex-frag (concat latex-header latex-frag))))
  2498. (with-temp-buffer
  2499. (insert latex-frag)
  2500. (org-format-latex cache-relpath nil nil cache-dir nil
  2501. "Creating LaTeX Image..." nil processing-type)
  2502. (buffer-string))))
  2503. (defun org-html-latex-environment (latex-environment _contents info)
  2504. "Transcode a LATEX-ENVIRONMENT element from Org to HTML.
  2505. CONTENTS is nil. INFO is a plist holding contextual information."
  2506. (let ((processing-type (plist-get info :with-latex))
  2507. (latex-frag (org-remove-indentation
  2508. (org-element-property :value latex-environment)))
  2509. (attributes (org-export-read-attribute :attr_html latex-environment)))
  2510. (cond
  2511. ((memq processing-type '(t mathjax))
  2512. (org-html-format-latex latex-frag 'mathjax info))
  2513. ((assq processing-type org-preview-latex-process-alist)
  2514. (let ((formula-link
  2515. (org-html-format-latex latex-frag processing-type info)))
  2516. (when (and formula-link (string-match "file:\\([^]]*\\)" formula-link))
  2517. ;; Do not provide a caption or a name to be consistent with
  2518. ;; `mathjax' handling.
  2519. (org-html--wrap-image
  2520. (org-html--format-image
  2521. (match-string 1 formula-link) attributes info) info))))
  2522. (t latex-frag))))
  2523. ;;;; Latex Fragment
  2524. (defun org-html-latex-fragment (latex-fragment _contents info)
  2525. "Transcode a LATEX-FRAGMENT object from Org to HTML.
  2526. CONTENTS is nil. INFO is a plist holding contextual information."
  2527. (let ((latex-frag (org-element-property :value latex-fragment))
  2528. (processing-type (plist-get info :with-latex)))
  2529. (cond
  2530. ((memq processing-type '(t mathjax))
  2531. (org-html-format-latex latex-frag 'mathjax info))
  2532. ((assq processing-type org-preview-latex-process-alist)
  2533. (let ((formula-link
  2534. (org-html-format-latex latex-frag processing-type info)))
  2535. (when (and formula-link (string-match "file:\\([^]]*\\)" formula-link))
  2536. (org-html--format-image (match-string 1 formula-link) nil info))))
  2537. (t latex-frag))))
  2538. ;;;; Line Break
  2539. (defun org-html-line-break (_line-break _contents info)
  2540. "Transcode a LINE-BREAK object from Org to HTML.
  2541. CONTENTS is nil. INFO is a plist holding contextual information."
  2542. (concat (org-html-close-tag "br" nil info) "\n"))
  2543. ;;;; Link
  2544. (defun org-html-inline-image-p (link info)
  2545. "Non-nil when LINK is meant to appear as an image.
  2546. INFO is a plist used as a communication channel. LINK is an
  2547. inline image when it has no description and targets an image
  2548. file (see `org-html-inline-image-rules' for more information), or
  2549. if its description is a single link targeting an image file."
  2550. (if (not (org-element-contents link))
  2551. (org-export-inline-image-p
  2552. link (plist-get info :html-inline-image-rules))
  2553. (not
  2554. (let ((link-count 0))
  2555. (org-element-map (org-element-contents link)
  2556. (cons 'plain-text org-element-all-objects)
  2557. (lambda (obj)
  2558. (pcase (org-element-type obj)
  2559. (`plain-text (org-string-nw-p obj))
  2560. (`link (if (= link-count 1) t
  2561. (cl-incf link-count)
  2562. (not (org-export-inline-image-p
  2563. obj (plist-get info :html-inline-image-rules)))))
  2564. (_ t)))
  2565. info t)))))
  2566. (defvar org-html-standalone-image-predicate)
  2567. (defun org-html-standalone-image-p (element info)
  2568. "Non-nil if ELEMENT is a standalone image.
  2569. INFO is a plist holding contextual information.
  2570. An element or object is a standalone image when
  2571. - its type is `paragraph' and its sole content, save for white
  2572. spaces, is a link that qualifies as an inline image;
  2573. - its type is `link' and its containing paragraph has no other
  2574. content save white spaces.
  2575. Bind `org-html-standalone-image-predicate' to constrain paragraph
  2576. further. For example, to check for only captioned standalone
  2577. images, set it to:
  2578. (lambda (paragraph) (org-element-property :caption paragraph))"
  2579. (let ((paragraph (pcase (org-element-type element)
  2580. (`paragraph element)
  2581. (`link (org-export-get-parent element)))))
  2582. (and (eq (org-element-type paragraph) 'paragraph)
  2583. (or (not (fboundp 'org-html-standalone-image-predicate))
  2584. (funcall org-html-standalone-image-predicate paragraph))
  2585. (catch 'exit
  2586. (let ((link-count 0))
  2587. (org-element-map (org-element-contents paragraph)
  2588. (cons 'plain-text org-element-all-objects)
  2589. (lambda (obj)
  2590. (when (pcase (org-element-type obj)
  2591. (`plain-text (org-string-nw-p obj))
  2592. (`link (or (> (cl-incf link-count) 1)
  2593. (not (org-html-inline-image-p obj info))))
  2594. (_ t))
  2595. (throw 'exit nil)))
  2596. info nil 'link)
  2597. (= link-count 1))))))
  2598. (defun org-html-link (link desc info)
  2599. "Transcode a LINK object from Org to HTML.
  2600. DESC is the description part of the link, or the empty string.
  2601. INFO is a plist holding contextual information. See
  2602. `org-export-data'."
  2603. (let* ((home (when (plist-get info :html-link-home)
  2604. (org-trim (plist-get info :html-link-home))))
  2605. (use-abs-url (plist-get info :html-link-use-abs-url))
  2606. (link-org-files-as-html-maybe
  2607. (lambda (raw-path info)
  2608. ;; Treat links to `file.org' as links to `file.html', if
  2609. ;; needed. See `org-html-link-org-files-as-html'.
  2610. (cond
  2611. ((and (plist-get info :html-link-org-files-as-html)
  2612. (string= ".org"
  2613. (downcase (file-name-extension raw-path "."))))
  2614. (concat (file-name-sans-extension raw-path) "."
  2615. (plist-get info :html-extension)))
  2616. (t raw-path))))
  2617. (type (org-element-property :type link))
  2618. (raw-path (org-element-property :path link))
  2619. ;; Ensure DESC really exists, or set it to nil.
  2620. (desc (org-string-nw-p desc))
  2621. (path
  2622. (cond
  2623. ((member type '("http" "https" "ftp" "mailto" "news"))
  2624. (url-encode-url (org-link-unescape (concat type ":" raw-path))))
  2625. ((string= type "file")
  2626. ;; Treat links to ".org" files as ".html", if needed.
  2627. (setq raw-path
  2628. (funcall link-org-files-as-html-maybe raw-path info))
  2629. ;; If file path is absolute, prepend it with protocol
  2630. ;; component - "file://".
  2631. (cond
  2632. ((file-name-absolute-p raw-path)
  2633. (setq raw-path (org-export-file-uri raw-path)))
  2634. ((and home use-abs-url)
  2635. (setq raw-path (concat (file-name-as-directory home) raw-path))))
  2636. ;; Add search option, if any. A search option can be
  2637. ;; relative to a custom-id, a headline title, a name or
  2638. ;; a target.
  2639. (let ((option (org-element-property :search-option link)))
  2640. (cond ((not option) raw-path)
  2641. ;; Since HTML back-end use custom-id value as-is,
  2642. ;; resolving is them is trivial.
  2643. ((eq (string-to-char option) ?#) (concat raw-path option))
  2644. (t
  2645. (concat raw-path
  2646. "#"
  2647. (org-publish-resolve-external-link
  2648. option
  2649. (org-element-property :path link)))))))
  2650. (t raw-path)))
  2651. ;; Extract attributes from parent's paragraph. HACK: Only do
  2652. ;; this for the first link in parent (inner image link for
  2653. ;; inline images). This is needed as long as attributes
  2654. ;; cannot be set on a per link basis.
  2655. (attributes-plist
  2656. (let* ((parent (org-export-get-parent-element link))
  2657. (link (let ((container (org-export-get-parent link)))
  2658. (if (and (eq (org-element-type container) 'link)
  2659. (org-html-inline-image-p link info))
  2660. container
  2661. link))))
  2662. (and (eq (org-element-map parent 'link 'identity info t) link)
  2663. (org-export-read-attribute :attr_html parent))))
  2664. (attributes
  2665. (let ((attr (org-html--make-attribute-string attributes-plist)))
  2666. (if (org-string-nw-p attr) (concat " " attr) ""))))
  2667. (cond
  2668. ;; Link type is handled by a special function.
  2669. ((org-export-custom-protocol-maybe link desc 'html))
  2670. ;; Image file.
  2671. ((and (plist-get info :html-inline-images)
  2672. (org-export-inline-image-p
  2673. link (plist-get info :html-inline-image-rules)))
  2674. (org-html--format-image path attributes-plist info))
  2675. ;; Radio target: Transcode target's contents and use them as
  2676. ;; link's description.
  2677. ((string= type "radio")
  2678. (let ((destination (org-export-resolve-radio-link link info)))
  2679. (if (not destination) desc
  2680. (format "<a href=\"#%s\"%s>%s</a>"
  2681. (org-export-get-reference destination info)
  2682. attributes
  2683. desc))))
  2684. ;; Links pointing to a headline: Find destination and build
  2685. ;; appropriate referencing command.
  2686. ((member type '("custom-id" "fuzzy" "id"))
  2687. (let ((destination (if (string= type "fuzzy")
  2688. (org-export-resolve-fuzzy-link link info)
  2689. (org-export-resolve-id-link link info))))
  2690. (pcase (org-element-type destination)
  2691. ;; ID link points to an external file.
  2692. (`plain-text
  2693. (let ((fragment (concat "ID-" path))
  2694. ;; Treat links to ".org" files as ".html", if needed.
  2695. (path (funcall link-org-files-as-html-maybe
  2696. destination info)))
  2697. (format "<a href=\"%s#%s\"%s>%s</a>"
  2698. path fragment attributes (or desc destination))))
  2699. ;; Fuzzy link points nowhere.
  2700. (`nil
  2701. (format "<i>%s</i>"
  2702. (or desc
  2703. (org-export-data
  2704. (org-element-property :raw-link link) info))))
  2705. ;; Link points to a headline.
  2706. (`headline
  2707. (let ((href (or (org-element-property :CUSTOM_ID destination)
  2708. (org-export-get-reference destination info)))
  2709. ;; What description to use?
  2710. (desc
  2711. ;; Case 1: Headline is numbered and LINK has no
  2712. ;; description. Display section number.
  2713. (if (and (org-export-numbered-headline-p destination info)
  2714. (not desc))
  2715. (mapconcat #'number-to-string
  2716. (org-export-get-headline-number
  2717. destination info) ".")
  2718. ;; Case 2: Either the headline is un-numbered or
  2719. ;; LINK has a custom description. Display LINK's
  2720. ;; description or headline's title.
  2721. (or desc
  2722. (org-export-data
  2723. (org-element-property :title destination) info)))))
  2724. (format "<a href=\"#%s\"%s>%s</a>" href attributes desc)))
  2725. ;; Fuzzy link points to a target or an element.
  2726. (_
  2727. (let* ((ref (org-export-get-reference destination info))
  2728. (org-html-standalone-image-predicate
  2729. #'org-html--has-caption-p)
  2730. (number (cond
  2731. (desc nil)
  2732. ((org-html-standalone-image-p destination info)
  2733. (org-export-get-ordinal
  2734. (org-element-map destination 'link
  2735. #'identity info t)
  2736. info 'link 'org-html-standalone-image-p))
  2737. (t (org-export-get-ordinal
  2738. destination info nil 'org-html--has-caption-p))))
  2739. (desc (cond (desc)
  2740. ((not number) "No description for this link")
  2741. ((numberp number) (number-to-string number))
  2742. (t (mapconcat #'number-to-string number ".")))))
  2743. (format "<a href=\"#%s\"%s>%s</a>" ref attributes desc))))))
  2744. ;; Coderef: replace link with the reference name or the
  2745. ;; equivalent line number.
  2746. ((string= type "coderef")
  2747. (let ((fragment (concat "coderef-" (org-html-encode-plain-text path))))
  2748. (format "<a href=\"#%s\"%s%s>%s</a>"
  2749. fragment
  2750. (format "class=\"coderef\" onmouseover=\"CodeHighlightOn(this, \
  2751. '%s');\" onmouseout=\"CodeHighlightOff(this, '%s');\""
  2752. fragment fragment)
  2753. attributes
  2754. (format (org-export-get-coderef-format path desc)
  2755. (org-export-resolve-coderef path info)))))
  2756. ;; External link with a description part.
  2757. ((and path desc) (format "<a href=\"%s\"%s>%s</a>"
  2758. (org-html-encode-plain-text path)
  2759. attributes
  2760. desc))
  2761. ;; External link without a description part.
  2762. (path (let ((path (org-html-encode-plain-text path)))
  2763. (format "<a href=\"%s\"%s>%s</a>"
  2764. path
  2765. attributes
  2766. (org-link-unescape path))))
  2767. ;; No path, only description. Try to do something useful.
  2768. (t (format "<i>%s</i>" desc)))))
  2769. ;;;; Node Property
  2770. (defun org-html-node-property (node-property _contents _info)
  2771. "Transcode a NODE-PROPERTY element from Org to HTML.
  2772. CONTENTS is nil. INFO is a plist holding contextual
  2773. information."
  2774. (format "%s:%s"
  2775. (org-element-property :key node-property)
  2776. (let ((value (org-element-property :value node-property)))
  2777. (if value (concat " " value) ""))))
  2778. ;;;; Paragraph
  2779. (defun org-html-paragraph (paragraph contents info)
  2780. "Transcode a PARAGRAPH element from Org to HTML.
  2781. CONTENTS is the contents of the paragraph, as a string. INFO is
  2782. the plist used as a communication channel."
  2783. (let* ((parent (org-export-get-parent paragraph))
  2784. (parent-type (org-element-type parent))
  2785. (style '((footnote-definition " class=\"footpara\"")
  2786. (org-data " class=\"footpara\"")))
  2787. (attributes (org-html--make-attribute-string
  2788. (org-export-read-attribute :attr_html paragraph)))
  2789. (extra (or (cadr (assq parent-type style)) "")))
  2790. (cond
  2791. ((and (eq parent-type 'item)
  2792. (not (org-export-get-previous-element paragraph info))
  2793. (let ((followers (org-export-get-next-element paragraph info 2)))
  2794. (and (not (cdr followers))
  2795. (memq (org-element-type (car followers)) '(nil plain-list)))))
  2796. ;; First paragraph in an item has no tag if it is alone or
  2797. ;; followed, at most, by a sub-list.
  2798. contents)
  2799. ((org-html-standalone-image-p paragraph info)
  2800. ;; Standalone image.
  2801. (let ((caption
  2802. (let ((raw (org-export-data
  2803. (org-export-get-caption paragraph) info))
  2804. (org-html-standalone-image-predicate
  2805. #'org-html--has-caption-p))
  2806. (if (not (org-string-nw-p raw)) raw
  2807. (concat "<span class=\"figure-number\">"
  2808. (format (org-html--translate "Figure %d:" info)
  2809. (org-export-get-ordinal
  2810. (org-element-map paragraph 'link
  2811. #'identity info t)
  2812. info nil #'org-html-standalone-image-p))
  2813. " </span>"
  2814. raw))))
  2815. (label (and (org-element-property :name paragraph)
  2816. (org-export-get-reference paragraph info))))
  2817. (org-html--wrap-image contents info caption label)))
  2818. ;; Regular paragraph.
  2819. (t (format "<p%s%s>\n%s</p>"
  2820. (if (org-string-nw-p attributes)
  2821. (concat " " attributes) "")
  2822. extra contents)))))
  2823. ;;;; Plain List
  2824. ;; FIXME Maybe arg1 is not needed because <li value="20"> already sets
  2825. ;; the correct value for the item counter
  2826. (defun org-html-begin-plain-list (type &optional arg1)
  2827. "Insert the beginning of the HTML list depending on TYPE.
  2828. When ARG1 is a string, use it as the start parameter for ordered
  2829. lists."
  2830. (pcase type
  2831. (`ordered
  2832. (format "<ol class=\"org-ol\"%s>"
  2833. (if arg1 (format " start=\"%d\"" arg1) "")))
  2834. (`unordered "<ul class=\"org-ul\">")
  2835. (`descriptive "<dl class=\"org-dl\">")))
  2836. (defun org-html-end-plain-list (type)
  2837. "Insert the end of the HTML list depending on TYPE."
  2838. (pcase type
  2839. (`ordered "</ol>")
  2840. (`unordered "</ul>")
  2841. (`descriptive "</dl>")))
  2842. (defun org-html-plain-list (plain-list contents _info)
  2843. "Transcode a PLAIN-LIST element from Org to HTML.
  2844. CONTENTS is the contents of the list. INFO is a plist holding
  2845. contextual information."
  2846. (let ((type (org-element-property :type plain-list)))
  2847. (format "%s\n%s%s"
  2848. (org-html-begin-plain-list type)
  2849. contents (org-html-end-plain-list type))))
  2850. ;;;; Plain Text
  2851. (defun org-html-convert-special-strings (string)
  2852. "Convert special characters in STRING to HTML."
  2853. (dolist (a org-html-special-string-regexps string)
  2854. (let ((re (car a))
  2855. (rpl (cdr a)))
  2856. (setq string (replace-regexp-in-string re rpl string t)))))
  2857. (defun org-html-encode-plain-text (text)
  2858. "Convert plain text characters from TEXT to HTML equivalent.
  2859. Possible conversions are set in `org-html-protect-char-alist'."
  2860. (dolist (pair org-html-protect-char-alist text)
  2861. (setq text (replace-regexp-in-string (car pair) (cdr pair) text t t))))
  2862. (defun org-html-plain-text (text info)
  2863. "Transcode a TEXT string from Org to HTML.
  2864. TEXT is the string to transcode. INFO is a plist holding
  2865. contextual information."
  2866. (let ((output text))
  2867. ;; Protect following characters: <, >, &.
  2868. (setq output (org-html-encode-plain-text output))
  2869. ;; Handle smart quotes. Be sure to provide original string since
  2870. ;; OUTPUT may have been modified.
  2871. (when (plist-get info :with-smart-quotes)
  2872. (setq output (org-export-activate-smart-quotes output :html info text)))
  2873. ;; Handle special strings.
  2874. (when (plist-get info :with-special-strings)
  2875. (setq output (org-html-convert-special-strings output)))
  2876. ;; Handle break preservation if required.
  2877. (when (plist-get info :preserve-breaks)
  2878. (setq output
  2879. (replace-regexp-in-string
  2880. "\\(\\\\\\\\\\)?[ \t]*\n"
  2881. (concat (org-html-close-tag "br" nil info) "\n") output)))
  2882. ;; Return value.
  2883. output))
  2884. ;; Planning
  2885. (defun org-html-planning (planning _contents info)
  2886. "Transcode a PLANNING element from Org to HTML.
  2887. CONTENTS is nil. INFO is a plist used as a communication
  2888. channel."
  2889. (format
  2890. "<p><span class=\"timestamp-wrapper\">%s</span></p>"
  2891. (org-trim
  2892. (mapconcat
  2893. (lambda (pair)
  2894. (let ((timestamp (cdr pair)))
  2895. (when timestamp
  2896. (let ((string (car pair)))
  2897. (format "<span class=\"timestamp-kwd\">%s</span> \
  2898. <span class=\"timestamp\">%s</span> "
  2899. string
  2900. (org-html-plain-text (org-timestamp-translate timestamp)
  2901. info))))))
  2902. `((,org-closed-string . ,(org-element-property :closed planning))
  2903. (,org-deadline-string . ,(org-element-property :deadline planning))
  2904. (,org-scheduled-string . ,(org-element-property :scheduled planning)))
  2905. ""))))
  2906. ;;;; Property Drawer
  2907. (defun org-html-property-drawer (_property-drawer contents _info)
  2908. "Transcode a PROPERTY-DRAWER element from Org to HTML.
  2909. CONTENTS holds the contents of the drawer. INFO is a plist
  2910. holding contextual information."
  2911. (and (org-string-nw-p contents)
  2912. (format "<pre class=\"example\">\n%s</pre>" contents)))
  2913. ;;;; Quote Block
  2914. (defun org-html-quote-block (quote-block contents _info)
  2915. "Transcode a QUOTE-BLOCK element from Org to HTML.
  2916. CONTENTS holds the contents of the block. INFO is a plist
  2917. holding contextual information."
  2918. (format "<blockquote%s>\n%s</blockquote>"
  2919. (let* ((name (org-element-property :name quote-block))
  2920. (attributes (org-export-read-attribute :attr_html quote-block))
  2921. (a (org-html--make-attribute-string
  2922. (if (or (not name) (plist-member attributes :id))
  2923. attributes
  2924. (plist-put attributes :id name)))))
  2925. (if (org-string-nw-p a) (concat " " a) ""))
  2926. contents))
  2927. ;;;; Section
  2928. (defun org-html-section (section contents info)
  2929. "Transcode a SECTION element from Org to HTML.
  2930. CONTENTS holds the contents of the section. INFO is a plist
  2931. holding contextual information."
  2932. (let ((parent (org-export-get-parent-headline section)))
  2933. ;; Before first headline: no container, just return CONTENTS.
  2934. (if (not parent) contents
  2935. ;; Get div's class and id references.
  2936. (let* ((class-num (+ (org-export-get-relative-level parent info)
  2937. (1- (plist-get info :html-toplevel-hlevel))))
  2938. (section-number
  2939. (and (org-export-numbered-headline-p parent info)
  2940. (mapconcat
  2941. #'number-to-string
  2942. (org-export-get-headline-number parent info) "-"))))
  2943. ;; Build return value.
  2944. (format "<div class=\"outline-text-%d\" id=\"text-%s\">\n%s</div>"
  2945. class-num
  2946. (or (org-element-property :CUSTOM_ID parent)
  2947. section-number
  2948. (org-export-get-reference parent info))
  2949. (or contents ""))))))
  2950. ;;;; Radio Target
  2951. (defun org-html-radio-target (radio-target text info)
  2952. "Transcode a RADIO-TARGET object from Org to HTML.
  2953. TEXT is the text of the target. INFO is a plist holding
  2954. contextual information."
  2955. (let ((ref (org-export-get-reference radio-target info)))
  2956. (org-html--anchor ref text nil info)))
  2957. ;;;; Special Block
  2958. (defun org-html-special-block (special-block contents info)
  2959. "Transcode a SPECIAL-BLOCK element from Org to HTML.
  2960. CONTENTS holds the contents of the block. INFO is a plist
  2961. holding contextual information."
  2962. (let* ((block-type (org-element-property :type special-block))
  2963. (html5-fancy (and (org-html--html5-fancy-p info)
  2964. (member block-type org-html-html5-elements)))
  2965. (attributes (org-export-read-attribute :attr_html special-block)))
  2966. (unless html5-fancy
  2967. (let ((class (plist-get attributes :class)))
  2968. (setq attributes (plist-put attributes :class
  2969. (if class (concat class " " block-type)
  2970. block-type)))))
  2971. (let* ((contents (or contents ""))
  2972. (name (org-element-property :name special-block))
  2973. (a (org-html--make-attribute-string
  2974. (if (or (not name) (plist-member attributes :id))
  2975. attributes
  2976. (plist-put attributes :id name))))
  2977. (str (if (org-string-nw-p a) (concat " " a) "")))
  2978. (if html5-fancy
  2979. (format "<%s%s>\n%s</%s>" block-type str contents block-type)
  2980. (format "<div%s>\n%s\n</div>" str contents)))))
  2981. ;;;; Src Block
  2982. (defun org-html-src-block (src-block _contents info)
  2983. "Transcode a SRC-BLOCK element from Org to HTML.
  2984. CONTENTS holds the contents of the item. INFO is a plist holding
  2985. contextual information."
  2986. (if (org-export-read-attribute :attr_html src-block :textarea)
  2987. (org-html--textarea-block src-block)
  2988. (let ((lang (org-element-property :language src-block))
  2989. (code (org-html-format-code src-block info))
  2990. (label (let ((lbl (and (org-element-property :name src-block)
  2991. (org-export-get-reference src-block info))))
  2992. (if lbl (format " id=\"%s\"" lbl) ""))))
  2993. (if (not lang) (format "<pre class=\"example\"%s>\n%s</pre>" label code)
  2994. (format "<div class=\"org-src-container\">\n%s%s\n</div>"
  2995. ;; Build caption.
  2996. (let ((caption (org-export-get-caption src-block)))
  2997. (if (not caption) ""
  2998. (let ((listing-number
  2999. (format
  3000. "<span class=\"listing-number\">%s </span>"
  3001. (format
  3002. (org-html--translate "Listing %d:" info)
  3003. (org-export-get-ordinal
  3004. src-block info nil #'org-html--has-caption-p)))))
  3005. (format "<label class=\"org-src-name\">%s%s</label>"
  3006. listing-number
  3007. (org-trim (org-export-data caption info))))))
  3008. ;; Contents.
  3009. (format "<pre class=\"src src-%s\"%s>%s</pre>"
  3010. lang label code))))))
  3011. ;;;; Statistics Cookie
  3012. (defun org-html-statistics-cookie (statistics-cookie _contents _info)
  3013. "Transcode a STATISTICS-COOKIE object from Org to HTML.
  3014. CONTENTS is nil. INFO is a plist holding contextual information."
  3015. (let ((cookie-value (org-element-property :value statistics-cookie)))
  3016. (format "<code>%s</code>" cookie-value)))
  3017. ;;;; Strike-Through
  3018. (defun org-html-strike-through (_strike-through contents info)
  3019. "Transcode STRIKE-THROUGH from Org to HTML.
  3020. CONTENTS is the text with strike-through markup. INFO is a plist
  3021. holding contextual information."
  3022. (format
  3023. (or (cdr (assq 'strike-through (plist-get info :html-text-markup-alist)))
  3024. "%s")
  3025. contents))
  3026. ;;;; Subscript
  3027. (defun org-html-subscript (_subscript contents _info)
  3028. "Transcode a SUBSCRIPT object from Org to HTML.
  3029. CONTENTS is the contents of the object. INFO is a plist holding
  3030. contextual information."
  3031. (format "<sub>%s</sub>" contents))
  3032. ;;;; Superscript
  3033. (defun org-html-superscript (_superscript contents _info)
  3034. "Transcode a SUPERSCRIPT object from Org to HTML.
  3035. CONTENTS is the contents of the object. INFO is a plist holding
  3036. contextual information."
  3037. (format "<sup>%s</sup>" contents))
  3038. ;;;; Table Cell
  3039. (defun org-html-table-cell (table-cell contents info)
  3040. "Transcode a TABLE-CELL element from Org to HTML.
  3041. CONTENTS is nil. INFO is a plist used as a communication
  3042. channel."
  3043. (let* ((table-row (org-export-get-parent table-cell))
  3044. (table (org-export-get-parent-table table-cell))
  3045. (cell-attrs
  3046. (if (not (plist-get info :html-table-align-individual-fields)) ""
  3047. (format (if (and (boundp 'org-html-format-table-no-css)
  3048. org-html-format-table-no-css)
  3049. " align=\"%s\"" " class=\"org-%s\"")
  3050. (org-export-table-cell-alignment table-cell info)))))
  3051. (when (or (not contents) (string= "" (org-trim contents)))
  3052. (setq contents "&#xa0;"))
  3053. (cond
  3054. ((and (org-export-table-has-header-p table info)
  3055. (= 1 (org-export-table-row-group table-row info)))
  3056. (let ((header-tags (plist-get info :html-table-header-tags)))
  3057. (concat "\n" (format (car header-tags) "col" cell-attrs)
  3058. contents
  3059. (cdr header-tags))))
  3060. ((and (plist-get info :html-table-use-header-tags-for-first-column)
  3061. (zerop (cdr (org-export-table-cell-address table-cell info))))
  3062. (let ((header-tags (plist-get info :html-table-header-tags)))
  3063. (concat "\n" (format (car header-tags) "row" cell-attrs)
  3064. contents
  3065. (cdr header-tags))))
  3066. (t (let ((data-tags (plist-get info :html-table-data-tags)))
  3067. (concat "\n" (format (car data-tags) cell-attrs)
  3068. contents
  3069. (cdr data-tags)))))))
  3070. ;;;; Table Row
  3071. (defun org-html-table-row (table-row contents info)
  3072. "Transcode a TABLE-ROW element from Org to HTML.
  3073. CONTENTS is the contents of the row. INFO is a plist used as a
  3074. communication channel."
  3075. ;; Rules are ignored since table separators are deduced from
  3076. ;; borders of the current row.
  3077. (when (eq (org-element-property :type table-row) 'standard)
  3078. (let* ((group (org-export-table-row-group table-row info))
  3079. (number (org-export-table-row-number table-row info))
  3080. (start-group-p
  3081. (org-export-table-row-starts-rowgroup-p table-row info))
  3082. (end-group-p
  3083. (org-export-table-row-ends-rowgroup-p table-row info))
  3084. (topp (and (equal start-group-p '(top))
  3085. (equal end-group-p '(below top))))
  3086. (bottomp (and (equal start-group-p '(above))
  3087. (equal end-group-p '(bottom above))))
  3088. (row-open-tag
  3089. (pcase (plist-get info :html-table-row-open-tag)
  3090. ((and accessor (pred functionp))
  3091. (funcall accessor
  3092. number group start-group-p end-group-p topp bottomp))
  3093. (accessor accessor)))
  3094. (row-close-tag
  3095. (pcase (plist-get info :html-table-row-close-tag)
  3096. ((and accessor (pred functionp))
  3097. (funcall accessor
  3098. number group start-group-p end-group-p topp bottomp))
  3099. (accessor accessor)))
  3100. (group-tags
  3101. (cond
  3102. ;; Row belongs to second or subsequent groups.
  3103. ((not (= 1 group)) '("<tbody>" . "\n</tbody>"))
  3104. ;; Row is from first group. Table has >=1 groups.
  3105. ((org-export-table-has-header-p
  3106. (org-export-get-parent-table table-row) info)
  3107. '("<thead>" . "\n</thead>"))
  3108. ;; Row is from first and only group.
  3109. (t '("<tbody>" . "\n</tbody>")))))
  3110. (concat (and start-group-p (car group-tags))
  3111. (concat "\n"
  3112. row-open-tag
  3113. contents
  3114. "\n"
  3115. row-close-tag)
  3116. (and end-group-p (cdr group-tags))))))
  3117. ;;;; Table
  3118. (defun org-html-table-first-row-data-cells (table info)
  3119. "Transcode the first row of TABLE.
  3120. INFO is a plist used as a communication channel."
  3121. (let ((table-row
  3122. (org-element-map table 'table-row
  3123. (lambda (row)
  3124. (unless (eq (org-element-property :type row) 'rule) row))
  3125. info 'first-match))
  3126. (special-column-p (org-export-table-has-special-column-p table)))
  3127. (if (not special-column-p) (org-element-contents table-row)
  3128. (cdr (org-element-contents table-row)))))
  3129. (defun org-html-table--table.el-table (table _info)
  3130. "Format table.el tables into HTML.
  3131. INFO is a plist used as a communication channel."
  3132. (when (eq (org-element-property :type table) 'table.el)
  3133. (require 'table)
  3134. (let ((outbuf (with-current-buffer
  3135. (get-buffer-create "*org-export-table*")
  3136. (erase-buffer) (current-buffer))))
  3137. (with-temp-buffer
  3138. (insert (org-element-property :value table))
  3139. (goto-char 1)
  3140. (re-search-forward "^[ \t]*|[^|]" nil t)
  3141. (table-generate-source 'html outbuf))
  3142. (with-current-buffer outbuf
  3143. (prog1 (org-trim (buffer-string))
  3144. (kill-buffer) )))))
  3145. (defun org-html-table (table contents info)
  3146. "Transcode a TABLE element from Org to HTML.
  3147. CONTENTS is the contents of the table. INFO is a plist holding
  3148. contextual information."
  3149. (if (eq (org-element-property :type table) 'table.el)
  3150. ;; "table.el" table. Convert it using appropriate tools.
  3151. (org-html-table--table.el-table table info)
  3152. ;; Standard table.
  3153. (let* ((caption (org-export-get-caption table))
  3154. (number (org-export-get-ordinal
  3155. table info nil #'org-html--has-caption-p))
  3156. (attributes
  3157. (org-html--make-attribute-string
  3158. (org-combine-plists
  3159. (and (org-element-property :name table)
  3160. (list :id (org-export-get-reference table info)))
  3161. (and (not (org-html-html5-p info))
  3162. (plist-get info :html-table-attributes))
  3163. (org-export-read-attribute :attr_html table))))
  3164. (alignspec
  3165. (if (bound-and-true-p org-html-format-table-no-css)
  3166. "align=\"%s\""
  3167. "class=\"org-%s\""))
  3168. (table-column-specs
  3169. (lambda (table info)
  3170. (mapconcat
  3171. (lambda (table-cell)
  3172. (let ((alignment (org-export-table-cell-alignment
  3173. table-cell info)))
  3174. (concat
  3175. ;; Begin a colgroup?
  3176. (when (org-export-table-cell-starts-colgroup-p
  3177. table-cell info)
  3178. "\n<colgroup>")
  3179. ;; Add a column. Also specify its alignment.
  3180. (format "\n%s"
  3181. (org-html-close-tag
  3182. "col" (concat " " (format alignspec alignment)) info))
  3183. ;; End a colgroup?
  3184. (when (org-export-table-cell-ends-colgroup-p
  3185. table-cell info)
  3186. "\n</colgroup>"))))
  3187. (org-html-table-first-row-data-cells table info) "\n"))))
  3188. (format "<table%s>\n%s\n%s\n%s</table>"
  3189. (if (equal attributes "") "" (concat " " attributes))
  3190. (if (not caption) ""
  3191. (format (if (plist-get info :html-table-caption-above)
  3192. "<caption class=\"t-above\">%s</caption>"
  3193. "<caption class=\"t-bottom\">%s</caption>")
  3194. (concat
  3195. "<span class=\"table-number\">"
  3196. (format (org-html--translate "Table %d:" info) number)
  3197. "</span> " (org-export-data caption info))))
  3198. (funcall table-column-specs table info)
  3199. contents))))
  3200. ;;;; Target
  3201. (defun org-html-target (target _contents info)
  3202. "Transcode a TARGET object from Org to HTML.
  3203. CONTENTS is nil. INFO is a plist holding contextual
  3204. information."
  3205. (let ((ref (org-export-get-reference target info)))
  3206. (org-html--anchor ref nil nil info)))
  3207. ;;;; Timestamp
  3208. (defun org-html-timestamp (timestamp _contents info)
  3209. "Transcode a TIMESTAMP object from Org to HTML.
  3210. CONTENTS is nil. INFO is a plist holding contextual
  3211. information."
  3212. (let ((value (org-html-plain-text (org-timestamp-translate timestamp) info)))
  3213. (format "<span class=\"timestamp-wrapper\"><span class=\"timestamp\">%s</span></span>"
  3214. (replace-regexp-in-string "--" "&#x2013;" value))))
  3215. ;;;; Underline
  3216. (defun org-html-underline (_underline contents info)
  3217. "Transcode UNDERLINE from Org to HTML.
  3218. CONTENTS is the text with underline markup. INFO is a plist
  3219. holding contextual information."
  3220. (format (or (cdr (assq 'underline (plist-get info :html-text-markup-alist)))
  3221. "%s")
  3222. contents))
  3223. ;;;; Verbatim
  3224. (defun org-html-verbatim (verbatim _contents info)
  3225. "Transcode VERBATIM from Org to HTML.
  3226. CONTENTS is nil. INFO is a plist holding contextual
  3227. information."
  3228. (format (or (cdr (assq 'verbatim (plist-get info :html-text-markup-alist))) "%s")
  3229. (org-html-encode-plain-text (org-element-property :value verbatim))))
  3230. ;;;; Verse Block
  3231. (defun org-html-verse-block (_verse-block contents info)
  3232. "Transcode a VERSE-BLOCK element from Org to HTML.
  3233. CONTENTS is verse block contents. INFO is a plist holding
  3234. contextual information."
  3235. ;; Replace each newline character with line break. Also replace
  3236. ;; each blank line with a line break.
  3237. (setq contents (replace-regexp-in-string
  3238. "^ *\\\\\\\\$" (format "%s\n" (org-html-close-tag "br" nil info))
  3239. (replace-regexp-in-string
  3240. "\\(\\\\\\\\\\)?[ \t]*\n"
  3241. (format "%s\n" (org-html-close-tag "br" nil info)) contents)))
  3242. ;; Replace each white space at beginning of a line with a
  3243. ;; non-breaking space.
  3244. (while (string-match "^[ \t]+" contents)
  3245. (let* ((num-ws (length (match-string 0 contents)))
  3246. (ws (org-html--make-string num-ws "&#xa0;")))
  3247. (setq contents (replace-match ws nil t contents))))
  3248. (format "<p class=\"verse\">\n%s</p>" contents))
  3249. ;;; Filter Functions
  3250. (defun org-html-final-function (contents _backend info)
  3251. "Filter to indent the HTML and convert HTML entities."
  3252. (with-temp-buffer
  3253. (insert contents)
  3254. (set-auto-mode t)
  3255. (if (plist-get info :html-indent)
  3256. (indent-region (point-min) (point-max)))
  3257. (buffer-substring-no-properties (point-min) (point-max))))
  3258. ;;; End-user functions
  3259. ;;;###autoload
  3260. (defun org-html-export-as-html
  3261. (&optional async subtreep visible-only body-only ext-plist)
  3262. "Export current buffer to an HTML buffer.
  3263. If narrowing is active in the current buffer, only export its
  3264. narrowed part.
  3265. If a region is active, export that region.
  3266. A non-nil optional argument ASYNC means the process should happen
  3267. asynchronously. The resulting buffer should be accessible
  3268. through the `org-export-stack' interface.
  3269. When optional argument SUBTREEP is non-nil, export the sub-tree
  3270. at point, extracting information from the headline properties
  3271. first.
  3272. When optional argument VISIBLE-ONLY is non-nil, don't export
  3273. contents of hidden elements.
  3274. When optional argument BODY-ONLY is non-nil, only write code
  3275. between \"<body>\" and \"</body>\" tags.
  3276. EXT-PLIST, when provided, is a property list with external
  3277. parameters overriding Org default settings, but still inferior to
  3278. file-local settings.
  3279. Export is done in a buffer named \"*Org HTML Export*\", which
  3280. will be displayed when `org-export-show-temporary-export-buffer'
  3281. is non-nil."
  3282. (interactive)
  3283. (org-export-to-buffer 'html "*Org HTML Export*"
  3284. async subtreep visible-only body-only ext-plist
  3285. (lambda () (set-auto-mode t))))
  3286. ;;;###autoload
  3287. (defun org-html-convert-region-to-html ()
  3288. "Assume the current region has Org syntax, and convert it to HTML.
  3289. This can be used in any buffer. For example, you can write an
  3290. itemized list in Org syntax in an HTML buffer and use this command
  3291. to convert it."
  3292. (interactive)
  3293. (org-export-replace-region-by 'html))
  3294. ;;;###autoload
  3295. (defun org-html-export-to-html
  3296. (&optional async subtreep visible-only body-only ext-plist)
  3297. "Export current buffer to a HTML file.
  3298. If narrowing is active in the current buffer, only export its
  3299. narrowed part.
  3300. If a region is active, export that region.
  3301. A non-nil optional argument ASYNC means the process should happen
  3302. asynchronously. The resulting file should be accessible through
  3303. the `org-export-stack' interface.
  3304. When optional argument SUBTREEP is non-nil, export the sub-tree
  3305. at point, extracting information from the headline properties
  3306. first.
  3307. When optional argument VISIBLE-ONLY is non-nil, don't export
  3308. contents of hidden elements.
  3309. When optional argument BODY-ONLY is non-nil, only write code
  3310. between \"<body>\" and \"</body>\" tags.
  3311. EXT-PLIST, when provided, is a property list with external
  3312. parameters overriding Org default settings, but still inferior to
  3313. file-local settings.
  3314. Return output file's name."
  3315. (interactive)
  3316. (let* ((extension (concat "." (or (plist-get ext-plist :html-extension)
  3317. org-html-extension
  3318. "html")))
  3319. (file (org-export-output-file-name extension subtreep))
  3320. (org-export-coding-system org-html-coding-system))
  3321. (org-export-to-file 'html file
  3322. async subtreep visible-only body-only ext-plist)))
  3323. ;;;###autoload
  3324. (defun org-html-publish-to-html (plist filename pub-dir)
  3325. "Publish an org file to HTML.
  3326. FILENAME is the filename of the Org file to be published. PLIST
  3327. is the property list for the given project. PUB-DIR is the
  3328. publishing directory.
  3329. Return output file name."
  3330. (org-publish-org-to 'html filename
  3331. (concat "." (or (plist-get plist :html-extension)
  3332. org-html-extension
  3333. "html"))
  3334. plist pub-dir))
  3335. (provide 'ox-html)
  3336. ;; Local variables:
  3337. ;; generated-autoload-file: "org-loaddefs.el"
  3338. ;; End:
  3339. ;;; ox-html.el ends here