org-e-html.el 114 KB

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