ox-texinfo.el 59 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657
  1. ;;; ox-texinfo.el --- Texinfo Back-End for Org Export Engine -*- lexical-binding: t; -*-
  2. ;; Copyright (C) 2012-2015 Free Software Foundation, Inc.
  3. ;; Author: Jonathan Leech-Pepin <jonathan.leechpepin at gmail dot com>
  4. ;; Keywords: outlines, hypermedia, calendar, wp
  5. ;; This file is part of GNU Emacs.
  6. ;; GNU Emacs is free software: you can redistribute it and/or modify
  7. ;; it under the terms of the GNU General Public License as published by
  8. ;; the Free Software Foundation, either version 3 of the License, or
  9. ;; (at your option) any later version.
  10. ;; GNU Emacs is distributed in the hope that it will be useful,
  11. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ;; GNU General Public License for more details.
  14. ;; You should have received a copy of the GNU General Public License
  15. ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
  16. ;;; Commentary:
  17. ;;
  18. ;; See Org manual for details.
  19. ;;; Code:
  20. (eval-when-compile (require 'cl))
  21. (require 'ox)
  22. (defvar orgtbl-exp-regexp)
  23. ;;; Define Back-End
  24. (org-export-define-backend 'texinfo
  25. '((bold . org-texinfo-bold)
  26. (center-block . org-texinfo-center-block)
  27. (clock . org-texinfo-clock)
  28. (code . org-texinfo-code)
  29. (drawer . org-texinfo-drawer)
  30. (dynamic-block . org-texinfo-dynamic-block)
  31. (entity . org-texinfo-entity)
  32. (example-block . org-texinfo-example-block)
  33. (export-block . org-texinfo-export-block)
  34. (export-snippet . org-texinfo-export-snippet)
  35. (fixed-width . org-texinfo-fixed-width)
  36. (footnote-definition . org-texinfo-footnote-definition)
  37. (footnote-reference . org-texinfo-footnote-reference)
  38. (headline . org-texinfo-headline)
  39. (inline-src-block . org-texinfo-inline-src-block)
  40. (inlinetask . org-texinfo-inlinetask)
  41. (italic . org-texinfo-italic)
  42. (item . org-texinfo-item)
  43. (keyword . org-texinfo-keyword)
  44. (line-break . org-texinfo-line-break)
  45. (link . org-texinfo-link)
  46. (node-property . org-texinfo-node-property)
  47. (paragraph . org-texinfo-paragraph)
  48. (plain-list . org-texinfo-plain-list)
  49. (plain-text . org-texinfo-plain-text)
  50. (planning . org-texinfo-planning)
  51. (property-drawer . org-texinfo-property-drawer)
  52. (quote-block . org-texinfo-quote-block)
  53. (radio-target . org-texinfo-radio-target)
  54. (section . org-texinfo-section)
  55. (special-block . org-texinfo-special-block)
  56. (src-block . org-texinfo-src-block)
  57. (statistics-cookie . org-texinfo-statistics-cookie)
  58. (subscript . org-texinfo-subscript)
  59. (superscript . org-texinfo-superscript)
  60. (table . org-texinfo-table)
  61. (table-cell . org-texinfo-table-cell)
  62. (table-row . org-texinfo-table-row)
  63. (target . org-texinfo-target)
  64. (template . org-texinfo-template)
  65. (timestamp . org-texinfo-timestamp)
  66. (verbatim . org-texinfo-verbatim)
  67. (verse-block . org-texinfo-verse-block))
  68. :export-block "TEXINFO"
  69. :filters-alist
  70. '((:filter-headline . org-texinfo--filter-section-blank-lines)
  71. (:filter-parse-tree . org-texinfo--normalize-headlines)
  72. (:filter-section . org-texinfo--filter-section-blank-lines))
  73. :menu-entry
  74. '(?i "Export to Texinfo"
  75. ((?t "As TEXI file" org-texinfo-export-to-texinfo)
  76. (?i "As INFO file" org-texinfo-export-to-info)
  77. (?o "As INFO file and open"
  78. (lambda (a s v b)
  79. (if a (org-texinfo-export-to-info t s v b)
  80. (org-open-file (org-texinfo-export-to-info nil s v b)))))))
  81. :options-alist
  82. '((:texinfo-filename "TEXINFO_FILENAME" nil nil t)
  83. (:texinfo-class "TEXINFO_CLASS" nil org-texinfo-default-class t)
  84. (:texinfo-header "TEXINFO_HEADER" nil nil newline)
  85. (:texinfo-post-header "TEXINFO_POST_HEADER" nil nil newline)
  86. (:subtitle "SUBTITLE" nil nil parse)
  87. (:subauthor "SUBAUTHOR" nil nil newline)
  88. (:texinfo-dircat "TEXINFO_DIR_CATEGORY" nil nil t)
  89. (:texinfo-dirtitle "TEXINFO_DIR_TITLE" nil nil t)
  90. (:texinfo-dirdesc "TEXINFO_DIR_DESC" nil nil t)
  91. (:texinfo-printed-title "TEXINFO_PRINTED_TITLE" nil nil t)
  92. ;; Other variables.
  93. (:texinfo-classes nil nil org-texinfo-classes)
  94. (:texinfo-format-headline-function nil nil org-texinfo-format-headline-function)
  95. (:texinfo-node-description-column nil nil org-texinfo-node-description-column)
  96. (:texinfo-active-timestamp-format nil nil org-texinfo-active-timestamp-format)
  97. (:texinfo-inactive-timestamp-format nil nil org-texinfo-inactive-timestamp-format)
  98. (:texinfo-diary-timestamp-format nil nil org-texinfo-diary-timestamp-format)
  99. (:texinfo-link-with-unknown-path-format nil nil org-texinfo-link-with-unknown-path-format)
  100. (:texinfo-tables-verbatim nil nil org-texinfo-tables-verbatim)
  101. (:texinfo-table-scientific-notation nil nil org-texinfo-table-scientific-notation)
  102. (:texinfo-def-table-markup nil nil org-texinfo-def-table-markup)
  103. (:texinfo-text-markup-alist nil nil org-texinfo-text-markup-alist)
  104. (:texinfo-format-drawer-function nil nil org-texinfo-format-drawer-function)
  105. (:texinfo-format-inlinetask-function nil nil org-texinfo-format-inlinetask-function)))
  106. ;;; User Configurable Variables
  107. (defgroup org-export-texinfo nil
  108. "Options for exporting Org mode files to Texinfo."
  109. :tag "Org Export Texinfo"
  110. :version "24.4"
  111. :package-version '(Org . "8.0")
  112. :group 'org-export)
  113. ;;;; Preamble
  114. (defcustom org-texinfo-coding-system nil
  115. "Default document encoding for Texinfo output.
  116. If nil it will default to `buffer-file-coding-system'."
  117. :group 'org-export-texinfo
  118. :type 'coding-system)
  119. (defcustom org-texinfo-default-class "info"
  120. "The default Texinfo class."
  121. :group 'org-export-texinfo
  122. :type '(string :tag "Texinfo class"))
  123. (defcustom org-texinfo-classes
  124. '(("info"
  125. "@documentencoding AUTO\n@documentlanguage AUTO"
  126. ("@chapter %s" . "@unnumbered %s")
  127. ("@section %s" . "@unnumberedsec %s")
  128. ("@subsection %s" . "@unnumberedsubsec %s")
  129. ("@subsubsection %s" . "@unnumberedsubsubsec %s")))
  130. "Alist of Texinfo classes and associated header and structure.
  131. If #+TEXINFO_CLASS is set in the buffer, use its value and the
  132. associated information. Here is the structure of each cell:
  133. (class-name
  134. header-string
  135. (numbered-section . unnumbered-section)
  136. ...)
  137. The header string
  138. -----------------
  139. The header string is inserted in the header of the generated
  140. document, right after \"@setfilename\" and \"@settitle\"
  141. commands.
  142. If it contains the special string
  143. \"@documentencoding AUTO\"
  144. \"AUTO\" will be replaced with an appropriate coding system. See
  145. `org-texinfo-coding-system' for more information. Likewise, if
  146. the string contains the special string
  147. \"@documentlanguage AUTO\"
  148. \"AUTO\" will be replaced with the language defined in the
  149. buffer, through #+LANGUAGE keyword, or globally, with
  150. `org-export-default-language', which see.
  151. The sectioning structure
  152. ------------------------
  153. The sectioning structure of the class is given by the elements
  154. following the header string. For each sectioning level, a number
  155. of strings is specified. A %s formatter is mandatory in each
  156. section string and will be replaced by the title of the section.
  157. Instead of a list of sectioning commands, you can also specify
  158. a function name. That function will be called with two
  159. parameters, the reduced) level of the headline, and a predicate
  160. non-nil when the headline should be numbered. It must return
  161. a format string in which the section title will be added."
  162. :group 'org-export-texinfo
  163. :version "24.4"
  164. :package-version '(Org . "8.2")
  165. :type '(repeat
  166. (list (string :tag "Texinfo class")
  167. (string :tag "Texinfo header")
  168. (repeat :tag "Levels" :inline t
  169. (choice
  170. (cons :tag "Heading"
  171. (string :tag " numbered")
  172. (string :tag "unnumbered"))
  173. (function :tag "Hook computing sectioning"))))))
  174. ;;;; Headline
  175. (defcustom org-texinfo-format-headline-function
  176. 'org-texinfo-format-headline-default-function
  177. "Function to format headline text.
  178. This function will be called with 5 arguments:
  179. TODO the todo keyword (string or nil).
  180. TODO-TYPE the type of todo (symbol: `todo', `done', nil)
  181. PRIORITY the priority of the headline (integer or nil)
  182. TEXT the main headline text (string).
  183. TAGS the tags as a list of strings (list of strings or nil).
  184. The function result will be used in the section format string."
  185. :group 'org-export-texinfo
  186. :type 'function
  187. :version "25.1"
  188. :package-version '(Org . "8.3"))
  189. ;;;; Node listing (menu)
  190. (defcustom org-texinfo-node-description-column 32
  191. "Column at which to start the description in the node listings.
  192. If a node title is greater than this length, the description will
  193. be placed after the end of the title."
  194. :group 'org-export-texinfo
  195. :type 'integer)
  196. ;;;; Timestamps
  197. (defcustom org-texinfo-active-timestamp-format "@emph{%s}"
  198. "A printf format string to be applied to active timestamps."
  199. :group 'org-export-texinfo
  200. :type 'string)
  201. (defcustom org-texinfo-inactive-timestamp-format "@emph{%s}"
  202. "A printf format string to be applied to inactive timestamps."
  203. :group 'org-export-texinfo
  204. :type 'string)
  205. (defcustom org-texinfo-diary-timestamp-format "@emph{%s}"
  206. "A printf format string to be applied to diary timestamps."
  207. :group 'org-export-texinfo
  208. :type 'string)
  209. ;;;; Links
  210. (defcustom org-texinfo-link-with-unknown-path-format "@indicateurl{%s}"
  211. "Format string for links with unknown path type."
  212. :group 'org-export-texinfo
  213. :type 'string)
  214. ;;;; Tables
  215. (defcustom org-texinfo-tables-verbatim nil
  216. "When non-nil, tables are exported verbatim."
  217. :group 'org-export-texinfo
  218. :type 'boolean)
  219. (defcustom org-texinfo-table-scientific-notation "%s\\,(%s)"
  220. "Format string to display numbers in scientific notation.
  221. The format should have \"%s\" twice, for mantissa and exponent
  222. \(i.e. \"%s\\\\times10^{%s}\").
  223. When nil, no transformation is made."
  224. :group 'org-export-texinfo
  225. :type '(choice
  226. (string :tag "Format string")
  227. (const :tag "No formatting" nil)))
  228. (defcustom org-texinfo-def-table-markup "@samp"
  229. "Default setting for @table environments."
  230. :group 'org-export-texinfo
  231. :type 'string)
  232. ;;;; Text markup
  233. (defcustom org-texinfo-text-markup-alist '((bold . "@strong{%s}")
  234. (code . code)
  235. (italic . "@emph{%s}")
  236. (verbatim . verb)
  237. (comment . "@c %s"))
  238. "Alist of Texinfo expressions to convert text markup.
  239. The key must be a symbol among `bold', `italic' and `comment'.
  240. The value is a formatting string to wrap fontified text with.
  241. Value can also be set to the following symbols: `verb' and
  242. `code'. For the former, Org will use \"@verb\" to
  243. create a format string and select a delimiter character that
  244. isn't in the string. For the latter, Org will use \"@code\"
  245. to typeset and try to protect special characters.
  246. If no association can be found for a given markup, text will be
  247. returned as-is."
  248. :group 'org-export-texinfo
  249. :type 'alist
  250. :options '(bold code italic verbatim comment))
  251. ;;;; Drawers
  252. (defcustom org-texinfo-format-drawer-function (lambda (_name contents) contents)
  253. "Function called to format a drawer in Texinfo code.
  254. The function must accept two parameters:
  255. NAME the drawer name, like \"LOGBOOK\"
  256. CONTENTS the contents of the drawer.
  257. The function should return the string to be exported.
  258. The default function simply returns the value of CONTENTS."
  259. :group 'org-export-texinfo
  260. :version "24.4"
  261. :package-version '(Org . "8.2")
  262. :type 'function)
  263. ;;;; Inlinetasks
  264. (defcustom org-texinfo-format-inlinetask-function
  265. 'org-texinfo-format-inlinetask-default-function
  266. "Function called to format an inlinetask in Texinfo code.
  267. The function must accept six parameters:
  268. TODO the todo keyword, as a string
  269. TODO-TYPE the todo type, a symbol among `todo', `done' and nil.
  270. PRIORITY the inlinetask priority, as a string
  271. NAME the inlinetask name, as a string.
  272. TAGS the inlinetask tags, as a list of strings.
  273. CONTENTS the contents of the inlinetask, as a string.
  274. The function should return the string to be exported."
  275. :group 'org-export-texinfo
  276. :type 'function)
  277. ;;;; Compilation
  278. (defcustom org-texinfo-info-process '("makeinfo %f")
  279. "Commands to process a Texinfo file to an INFO file.
  280. This is list of strings, each of them will be given to the shell
  281. as a command. %f in the command will be replaced by the full
  282. file name, %b by the file base name (i.e without extension) and
  283. %o by the base directory of the file."
  284. :group 'org-export-texinfo
  285. :type '(repeat :tag "Shell command sequence"
  286. (string :tag "Shell command")))
  287. (defcustom org-texinfo-logfiles-extensions
  288. '("aux" "toc" "cp" "fn" "ky" "pg" "tp" "vr")
  289. "The list of file extensions to consider as Texinfo logfiles.
  290. The logfiles will be remove if `org-texinfo-remove-logfiles' is
  291. non-nil."
  292. :group 'org-export-texinfo
  293. :type '(repeat (string :tag "Extension")))
  294. (defcustom org-texinfo-remove-logfiles t
  295. "Non-nil means remove the logfiles produced by compiling a Texinfo file.
  296. By default, logfiles are files with these extensions: .aux, .toc,
  297. .cp, .fn, .ky, .pg and .tp. To define the set of logfiles to remove,
  298. set `org-texinfo-logfiles-extensions'."
  299. :group 'org-export-latex
  300. :type 'boolean)
  301. ;;; Constants
  302. (defconst org-texinfo-max-toc-depth 4
  303. "Maximum depth for creation of detailed menu listings.
  304. Beyond this depth, Texinfo will not recognize the nodes and will
  305. cause errors. Left as a constant in case this value ever
  306. changes.")
  307. (defconst org-texinfo-supported-coding-systems
  308. '("US-ASCII" "UTF-8" "ISO-8859-15" "ISO-8859-1" "ISO-8859-2" "koi8-r" "koi8-u")
  309. "List of coding systems supported by Texinfo, as strings.
  310. Specified coding system will be matched against these strings.
  311. If two strings share the same prefix (e.g. \"ISO-8859-1\" and
  312. \"ISO-8859-15\"), the most specific one has to be listed first.")
  313. (defconst org-texinfo-inline-image-rules
  314. (list (cons "file"
  315. (regexp-opt '("eps" "pdf" "png" "jpg" "jpeg" "gif" "svg"))))
  316. "Rules characterizing image files that can be inlined.")
  317. ;;; Internal Functions
  318. (defun org-texinfo--filter-section-blank-lines (headline _backend _info)
  319. "Filter controlling number of blank lines after a section."
  320. (replace-regexp-in-string "\n\\(?:\n[ \t]*\\)*\\'" "\n\n" headline))
  321. (defun org-texinfo--normalize-headlines (tree _backend info)
  322. "Normalize headlines in TREE.
  323. BACK-END is the symbol specifying back-end used for export. INFO
  324. is a plist used as a communication channel.
  325. Make sure every headline in TREE contains a section, since those
  326. are required to install a menu. Also put exactly one blank line
  327. at the end of each section.
  328. Return new tree."
  329. (org-element-map tree 'headline
  330. (lambda (hl)
  331. (org-element-put-property hl :post-blank 1)
  332. (let ((contents (org-element-contents hl)))
  333. (when contents
  334. (let ((first (org-element-map contents '(headline section)
  335. #'identity info t)))
  336. (unless (eq (org-element-type first) 'section)
  337. (apply #'org-element-set-contents
  338. hl
  339. (cons `(section (:parent ,hl)) contents)))))))
  340. info)
  341. tree)
  342. (defun org-texinfo--find-verb-separator (s)
  343. "Return a character not used in string S.
  344. This is used to choose a separator for constructs like \\verb."
  345. (let ((ll "~,./?;':\"|!@#%^&-_=+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ<>()[]{}"))
  346. (loop for c across ll
  347. when (not (string-match (regexp-quote (char-to-string c)) s))
  348. return (char-to-string c))))
  349. (defun org-texinfo--text-markup (text markup _info)
  350. "Format TEXT depending on MARKUP text markup.
  351. INFO is a plist used as a communication channel. See
  352. `org-texinfo-text-markup-alist' for details."
  353. (pcase (cdr (assq markup org-texinfo-text-markup-alist))
  354. ;; No format string: Return raw text.
  355. (`nil text)
  356. (`verb
  357. (let ((separator (org-texinfo--find-verb-separator text)))
  358. (concat "@verb{" separator text separator "}")))
  359. (`code
  360. (format "@code{%s}" (replace-regexp-in-string "[@{}]" "@\\&" text)))
  361. ;; Else use format string.
  362. (fmt (format fmt text))))
  363. (defun org-texinfo--get-node (blob info)
  364. "Return node or anchor associated to BLOB.
  365. BLOB is an element or object. INFO is a plist used as
  366. a communication channel. The function guarantees the node or
  367. anchor name is unique."
  368. (let ((cache (plist-get info :texinfo-node-cache)))
  369. (or (cdr (assq blob cache))
  370. (let ((name
  371. (org-texinfo--sanitize-node
  372. (if (eq (org-element-type blob) 'headline)
  373. (org-export-data (org-export-get-alt-title blob info) info)
  374. (org-export-get-reference blob info)))))
  375. ;; Ensure NAME is unique.
  376. (while (rassoc name cache) (setq name (concat name "x")))
  377. (plist-put info :texinfo-node-cache (cons (cons blob name) cache))
  378. name))))
  379. (defun org-texinfo--sanitize-node (title)
  380. "Bend string TITLE to node line requirements.
  381. Trim string and collapse multiple whitespace characters as they
  382. are not significant. Also remove the following characters: @
  383. { } ( ) : . ,"
  384. (replace-regexp-in-string
  385. "[:,.]" ""
  386. (replace-regexp-in-string
  387. "\\`(\\(.*)\\)" "[\\1"
  388. (org-trim (replace-regexp-in-string "[ \t]\\{2,\\}" " " title)))))
  389. (defun org-texinfo--sanitize-content (text)
  390. "Escape special characters in string TEXT.
  391. Special characters are: @ { }"
  392. (replace-regexp-in-string "[@{}]" "@\\&" text))
  393. (defun org-texinfo--wrap-float (value info &optional type label caption short)
  394. "Wrap string VALUE within a @float command.
  395. INFO is the current export state, as a plist. TYPE is float
  396. type, as a string. LABEL is the cross reference label for the
  397. float, as a string. CAPTION and SHORT are, respectively, the
  398. caption and shortcaption used for the float, as secondary
  399. strings (e.g., returned by `org-export-get-caption')."
  400. (let* ((backend
  401. (org-export-create-backend
  402. :parent 'texinfo
  403. :transcoders '((link . (lambda (object c i) c))
  404. (radio-target . (lambda (object c i) c))
  405. (target . ignore))))
  406. (short-backend
  407. (org-export-create-backend
  408. :parent 'texinfo
  409. :transcoders '((footnote-reference . ignore)
  410. (inline-src-block . ignore)
  411. (link . (lambda (object c i) c))
  412. (radio-target . (lambda (object c i) c))
  413. (target . ignore)
  414. (verbatim . ignore))))
  415. (short-str
  416. (if (and short caption)
  417. (format "@shortcaption{%s}\n"
  418. (org-export-data-with-backend short short-backend info))
  419. ""))
  420. (caption-str
  421. (if (or short caption)
  422. (format "@caption{%s}\n"
  423. (org-export-data-with-backend
  424. (or caption short)
  425. (if (equal short-str "") short-backend backend)
  426. info))
  427. "")))
  428. (format "@float %s%s\n%s\n%s%s@end float"
  429. type (if label (concat "," label) "") value caption-str short-str)))
  430. ;;; Template
  431. (defun org-texinfo-template (contents info)
  432. "Return complete document string after Texinfo conversion.
  433. CONTENTS is the transcoded contents string. INFO is a plist
  434. holding export options."
  435. (let ((title (org-export-data (plist-get info :title) info))
  436. ;; Copying data is the contents of the first headline in
  437. ;; parse tree with a non-nil copying property.
  438. (copying (org-element-map (plist-get info :parse-tree) 'headline
  439. (lambda (hl)
  440. (and (org-not-nil (org-element-property :COPYING hl))
  441. (org-element-contents hl)))
  442. info t)))
  443. (concat
  444. "\\input texinfo @c -*- texinfo -*-\n"
  445. "@c %**start of header\n"
  446. (let ((file (or (plist-get info :texinfo-filename)
  447. (let ((f (plist-get info :output-file)))
  448. (and f (concat (file-name-sans-extension f) ".info"))))))
  449. (and file (format "@setfilename %s\n" file)))
  450. (format "@settitle %s\n" title)
  451. ;; Insert class-defined header.
  452. (org-element-normalize-string
  453. (let ((header (nth 1 (assoc (plist-get info :texinfo-class)
  454. org-texinfo-classes)))
  455. (coding
  456. (catch 'coding-system
  457. (let ((case-fold-search t)
  458. (name (symbol-name (or org-texinfo-coding-system
  459. buffer-file-coding-system))))
  460. (dolist (system org-texinfo-supported-coding-systems "UTF-8")
  461. (when (org-string-match-p (regexp-quote system) name)
  462. (throw 'coding-system system))))))
  463. (language (plist-get info :language))
  464. (case-fold-search nil))
  465. ;; Auto coding system.
  466. (replace-regexp-in-string
  467. "^@documentencoding \\(AUTO\\)$"
  468. coding
  469. (replace-regexp-in-string
  470. "^@documentlanguage \\(AUTO\\)$" language header t nil 1) t nil 1)))
  471. ;; Additional header options set by #+TEXINFO_HEADER.
  472. (let ((texinfo-header (plist-get info :texinfo-header)))
  473. (and texinfo-header (org-element-normalize-string texinfo-header)))
  474. "@c %**end of header\n\n"
  475. ;; Additional options set by #+TEXINFO_POST_HEADER.
  476. (let ((texinfo-post-header (plist-get info :texinfo-post-header)))
  477. (and texinfo-post-header
  478. (org-element-normalize-string texinfo-post-header)))
  479. ;; Copying.
  480. (and copying
  481. (format "@copying\n%s@end copying\n\n"
  482. (org-element-normalize-string
  483. (org-export-data copying info))))
  484. ;; Info directory information. Only supply if both title and
  485. ;; category are provided.
  486. (let ((dircat (plist-get info :texinfo-dircat))
  487. (dirtitle
  488. (let ((title (plist-get info :texinfo-dirtitle)))
  489. (and title
  490. (string-match "^\\(?:\\* \\)?\\(.*?\\)\\(\\.\\)?$" title)
  491. (format "* %s." (match-string 1 title))))))
  492. (when (and dircat dirtitle)
  493. (concat "@dircategory " dircat "\n"
  494. "@direntry\n"
  495. (let ((dirdesc
  496. (let ((desc (plist-get info :texinfo-dirdesc)))
  497. (cond ((not desc) nil)
  498. ((org-string-match-p "\\.$" desc) desc)
  499. (t (concat desc "."))))))
  500. (if dirdesc (format "%-23s %s" dirtitle dirdesc) dirtitle))
  501. "\n"
  502. "@end direntry\n\n")))
  503. ;; Title
  504. "@finalout\n"
  505. "@titlepage\n"
  506. (when (plist-get info :with-title)
  507. (concat
  508. (format "@title %s\n" (or (plist-get info :texinfo-printed-title) title ""))
  509. (let ((subtitle (plist-get info :subtitle)))
  510. (when subtitle
  511. (format "@subtitle %s\n"
  512. (org-export-data subtitle info))))))
  513. (when (plist-get info :with-author)
  514. (concat
  515. ;; Primary author.
  516. (let ((author (org-string-nw-p
  517. (org-export-data (plist-get info :author) info)))
  518. (email (and (plist-get info :with-email)
  519. (org-string-nw-p
  520. (org-export-data (plist-get info :email) info)))))
  521. (cond ((and author email)
  522. (format "@author %s (@email{%s})\n" author email))
  523. (author (format "@author %s\n" author))
  524. (email (format "@author @email{%s}\n" email))))
  525. ;; Other authors.
  526. (let ((subauthor (plist-get info :subauthor)))
  527. (and subauthor
  528. (org-element-normalize-string
  529. (replace-regexp-in-string "^" "@author " subauthor))))))
  530. (and copying "@page\n@vskip 0pt plus 1filll\n@insertcopying\n")
  531. "@end titlepage\n\n"
  532. ;; Table of contents.
  533. (and (plist-get info :with-toc) "@contents\n\n")
  534. ;; Configure Top Node when not for Tex
  535. "@ifnottex\n"
  536. "@node Top\n"
  537. (format "@top %s\n" title)
  538. (and copying "@insertcopying\n")
  539. "@end ifnottex\n\n"
  540. ;; Menu.
  541. (org-texinfo-make-menu (plist-get info :parse-tree) info 'master)
  542. "\n"
  543. ;; Document's body.
  544. contents "\n"
  545. ;; Creator.
  546. (and (plist-get info :with-creator)
  547. (concat (plist-get info :creator) "\n"))
  548. ;; Document end.
  549. "@bye")))
  550. ;;; Transcode Functions
  551. ;;;; Bold
  552. (defun org-texinfo-bold (_bold contents info)
  553. "Transcode BOLD from Org to Texinfo.
  554. CONTENTS is the text with bold markup. INFO is a plist holding
  555. contextual information."
  556. (org-texinfo--text-markup contents 'bold info))
  557. ;;;; Center Block
  558. (defun org-texinfo-center-block (_center-block contents _info)
  559. "Transcode a CENTER-BLOCK element from Org to Texinfo.
  560. CONTENTS holds the contents of the block. INFO is a plist used
  561. as a communication channel."
  562. contents)
  563. ;;;; Clock
  564. (defun org-texinfo-clock (clock _contents info)
  565. "Transcode a CLOCK element from Org to Texinfo.
  566. CONTENTS is nil. INFO is a plist holding contextual
  567. information."
  568. (concat
  569. "@noindent"
  570. (format "@strong{%s} " org-clock-string)
  571. (format (plist-get info :texinfo-inactive-timestamp-format)
  572. (concat (org-timestamp-translate (org-element-property :value clock))
  573. (let ((time (org-element-property :duration clock)))
  574. (and time (format " (%s)" time)))))
  575. "@*"))
  576. ;;;; Code
  577. (defun org-texinfo-code (code _contents info)
  578. "Transcode a CODE object from Org to Texinfo.
  579. CONTENTS is nil. INFO is a plist used as a communication
  580. channel."
  581. (org-texinfo--text-markup (org-element-property :value code) 'code info))
  582. ;;;; Drawer
  583. (defun org-texinfo-drawer (drawer contents info)
  584. "Transcode a DRAWER element from Org to Texinfo.
  585. CONTENTS holds the contents of the block. INFO is a plist
  586. holding contextual information."
  587. (let* ((name (org-element-property :drawer-name drawer))
  588. (output (funcall (plist-get info :texinfo-format-drawer-function)
  589. name contents)))
  590. output))
  591. ;;;; Dynamic Block
  592. (defun org-texinfo-dynamic-block (_dynamic-block contents _info)
  593. "Transcode a DYNAMIC-BLOCK element from Org to Texinfo.
  594. CONTENTS holds the contents of the block. INFO is a plist
  595. holding contextual information."
  596. contents)
  597. ;;;; Entity
  598. (defun org-texinfo-entity (entity _contents _info)
  599. "Transcode an ENTITY object from Org to Texinfo.
  600. CONTENTS are the definition itself. INFO is a plist holding
  601. contextual information."
  602. (let ((ent (org-element-property :latex entity)))
  603. (if (org-element-property :latex-math-p entity) (format "@math{%s}" ent) ent)))
  604. ;;;; Example Block
  605. (defun org-texinfo-example-block (example-block _contents info)
  606. "Transcode an EXAMPLE-BLOCK element from Org to Texinfo.
  607. CONTENTS is nil. INFO is a plist holding contextual
  608. information."
  609. (format "@verbatim\n%s@end verbatim"
  610. (org-export-format-code-default example-block info)))
  611. ;;; Export Block
  612. (defun org-texinfo-export-block (export-block _contents _info)
  613. "Transcode a EXPORT-BLOCK element from Org to Texinfo.
  614. CONTENTS is nil. INFO is a plist holding contextual information."
  615. (when (string= (org-element-property :type export-block) "TEXINFO")
  616. (org-remove-indentation (org-element-property :value export-block))))
  617. ;;; Export Snippet
  618. (defun org-texinfo-export-snippet (export-snippet _contents _info)
  619. "Transcode a EXPORT-SNIPPET object from Org to Texinfo.
  620. CONTENTS is nil. INFO is a plist holding contextual information."
  621. (when (eq (org-export-snippet-backend export-snippet) 'texinfo)
  622. (org-element-property :value export-snippet)))
  623. ;;;; Fixed Width
  624. (defun org-texinfo-fixed-width (fixed-width _contents _info)
  625. "Transcode a FIXED-WIDTH element from Org to Texinfo.
  626. CONTENTS is nil. INFO is a plist holding contextual information."
  627. (format "@example\n%s\n@end example"
  628. (org-remove-indentation
  629. (org-texinfo--sanitize-content
  630. (org-element-property :value fixed-width)))))
  631. ;;;; Footnote Reference
  632. (defun org-texinfo-footnote-reference (footnote _contents info)
  633. "Create a footnote reference for FOOTNOTE.
  634. FOOTNOTE is the footnote to define. CONTENTS is nil. INFO is a
  635. plist holding contextual information."
  636. (let ((def (org-export-get-footnote-definition footnote info)))
  637. (format "@footnote{%s}"
  638. (org-trim (org-export-data def info)))))
  639. ;;;; Headline
  640. (defun org-texinfo-headline (headline contents info)
  641. "Transcode a HEADLINE element from Org to Texinfo.
  642. CONTENTS holds the contents of the headline. INFO is a plist
  643. holding contextual information."
  644. (let* ((class (plist-get info :texinfo-class))
  645. (level (org-export-get-relative-level headline info))
  646. (numberedp (org-export-numbered-headline-p headline info))
  647. (class-sectioning (assoc class (plist-get info :texinfo-classes)))
  648. ;; Find the index type, if any.
  649. (index (org-element-property :INDEX headline))
  650. ;; Create node info, to insert it before section formatting.
  651. ;; Use custom menu title if present.
  652. (node (format "@node %s\n" (org-texinfo--get-node headline info)))
  653. ;; Section formatting will set two placeholders: one for the
  654. ;; title and the other for the contents.
  655. (section-fmt
  656. (if (org-not-nil (org-element-property :APPENDIX headline))
  657. "@appendix %s\n%s"
  658. (let ((sec (if (and (symbolp (nth 2 class-sectioning))
  659. (fboundp (nth 2 class-sectioning)))
  660. (funcall (nth 2 class-sectioning) level numberedp)
  661. (nth (1+ level) class-sectioning))))
  662. (cond
  663. ;; No section available for that LEVEL.
  664. ((not sec) nil)
  665. ;; Section format directly returned by a function.
  666. ((stringp sec) sec)
  667. ;; (numbered-section . unnumbered-section)
  668. ((not (consp (cdr sec)))
  669. (concat (if (or index (not numberedp)) (cdr sec) (car sec))
  670. "\n%s"))))))
  671. (todo
  672. (and (plist-get info :with-todo-keywords)
  673. (let ((todo (org-element-property :todo-keyword headline)))
  674. (and todo (org-export-data todo info)))))
  675. (todo-type (and todo (org-element-property :todo-type headline)))
  676. (tags (and (plist-get info :with-tags)
  677. (org-export-get-tags headline info)))
  678. (priority (and (plist-get info :with-priority)
  679. (org-element-property :priority headline)))
  680. (text (org-export-data (org-element-property :title headline) info))
  681. (full-text (funcall (plist-get info :texinfo-format-headline-function)
  682. todo todo-type priority text tags))
  683. (contents (if (org-string-nw-p contents) (concat "\n" contents) "")))
  684. (cond
  685. ;; Case 1: This is a footnote section: ignore it.
  686. ((org-element-property :footnote-section-p headline) nil)
  687. ;; Case 2: This is the `copying' section: ignore it
  688. ;; This is used elsewhere.
  689. ((org-not-nil (org-element-property :COPYING headline)) nil)
  690. ;; Case 3: An index. If it matches one of the known indexes,
  691. ;; print it as such following the contents, otherwise
  692. ;; print the contents and leave the index up to the user.
  693. (index
  694. (concat node
  695. (format
  696. section-fmt
  697. full-text
  698. (concat contents
  699. (and (member index '("cp" "fn" "ky" "pg" "tp" "vr"))
  700. (concat "\n@printindex " index))))))
  701. ;; Case 4: This is a deep sub-tree: export it as a list item.
  702. ;; Also export as items headlines for which no section
  703. ;; format has been found.
  704. ((or (not section-fmt) (org-export-low-level-p headline info))
  705. ;; Build the real contents of the sub-tree.
  706. (concat (and (org-export-first-sibling-p headline info)
  707. (format "@%s\n" (if numberedp 'enumerate 'itemize)))
  708. "@item\n" full-text "\n"
  709. contents
  710. (if (org-export-last-sibling-p headline info)
  711. (format "@end %s" (if numberedp 'enumerate 'itemize))
  712. "\n")))
  713. ;; Case 5: Standard headline. Export it as a section.
  714. (t (concat node (format section-fmt full-text contents))))))
  715. (defun org-texinfo-format-headline-default-function
  716. (todo _todo-type priority text tags)
  717. "Default format function for a headline.
  718. See `org-texinfo-format-headline-function' for details."
  719. (concat (when todo (format "@strong{%s} " todo))
  720. (when priority (format "@emph{#%s} " priority))
  721. text
  722. (when tags (format " :%s:" (mapconcat 'identity tags ":")))))
  723. ;;;; Inline Src Block
  724. (defun org-texinfo-inline-src-block (inline-src-block _contents _info)
  725. "Transcode an INLINE-SRC-BLOCK element from Org to Texinfo.
  726. CONTENTS holds the contents of the item. INFO is a plist holding
  727. contextual information."
  728. (let* ((code (org-element-property :value inline-src-block))
  729. (separator (org-texinfo--find-verb-separator code)))
  730. (concat "@verb{" separator code separator "}")))
  731. ;;;; Inlinetask
  732. (defun org-texinfo-inlinetask (inlinetask contents info)
  733. "Transcode an INLINETASK element from Org to Texinfo.
  734. CONTENTS holds the contents of the block. INFO is a plist
  735. holding contextual information."
  736. (let ((title (org-export-data (org-element-property :title inlinetask) info))
  737. (todo (and (plist-get info :with-todo-keywords)
  738. (let ((todo (org-element-property :todo-keyword inlinetask)))
  739. (and todo (org-export-data todo info)))))
  740. (todo-type (org-element-property :todo-type inlinetask))
  741. (tags (and (plist-get info :with-tags)
  742. (org-export-get-tags inlinetask info)))
  743. (priority (and (plist-get info :with-priority)
  744. (org-element-property :priority inlinetask))))
  745. (funcall (plist-get info :texinfo-format-inlinetask-function)
  746. todo todo-type priority title tags contents)))
  747. (defun org-texinfo-format-inlinetask-default-function
  748. (todo _todo-type priority title tags contents)
  749. "Default format function for a inlinetasks.
  750. See `org-texinfo-format-inlinetask-function' for details."
  751. (let ((full-title
  752. (concat (when todo (format "@strong{%s} " todo))
  753. (when priority (format "#%c " priority))
  754. title
  755. (when tags (format ":%s:" (mapconcat #'identity tags ":"))))))
  756. (format "@center %s\n\n%s\n" full-title contents)))
  757. ;;;; Italic
  758. (defun org-texinfo-italic (_italic contents info)
  759. "Transcode ITALIC from Org to Texinfo.
  760. CONTENTS is the text with italic markup. INFO is a plist holding
  761. contextual information."
  762. (org-texinfo--text-markup contents 'italic info))
  763. ;;;; Item
  764. (defun org-texinfo-item (item contents info)
  765. "Transcode an ITEM element from Org to Texinfo.
  766. CONTENTS holds the contents of the item. INFO is a plist holding
  767. contextual information."
  768. (format "@item%s\n%s"
  769. (let ((tag (org-element-property :tag item)))
  770. (if tag (concat " " (org-export-data tag info)) ""))
  771. (or contents "")))
  772. ;;;; Keyword
  773. (defun org-texinfo-keyword (keyword _contents info)
  774. "Transcode a KEYWORD element from Org to Texinfo.
  775. CONTENTS is nil. INFO is a plist holding contextual information."
  776. (let ((key (org-element-property :key keyword))
  777. (value (org-element-property :value keyword)))
  778. (cond
  779. ((string= key "TEXINFO") value)
  780. ((string= key "CINDEX") (format "@cindex %s" value))
  781. ((string= key "FINDEX") (format "@findex %s" value))
  782. ((string= key "KINDEX") (format "@kindex %s" value))
  783. ((string= key "PINDEX") (format "@pindex %s" value))
  784. ((string= key "TINDEX") (format "@tindex %s" value))
  785. ((string= key "VINDEX") (format "@vindex %s" value))
  786. ((string= key "TOC")
  787. (cond ((org-string-match-p "\\<tables\\>" value)
  788. (concat "@listoffloats "
  789. (org-export-translate "Table" :utf-8 info)))
  790. ((org-string-match-p "\\<listings\\>" value)
  791. (concat "@listoffloats "
  792. (org-export-translate "Listing" :utf-8 info))))))))
  793. ;;;; Line Break
  794. (defun org-texinfo-line-break (_line-break _contents _info)
  795. "Transcode a LINE-BREAK object from Org to Texinfo.
  796. CONTENTS is nil. INFO is a plist holding contextual information."
  797. "@*\n")
  798. ;;;; Link
  799. (defun org-texinfo-link (link desc info)
  800. "Transcode a LINK object from Org to Texinfo.
  801. DESC is the description part of the link, or the empty string.
  802. INFO is a plist holding contextual information. See
  803. `org-export-data'."
  804. (let* ((type (org-element-property :type link))
  805. (raw-path (org-element-property :path link))
  806. ;; Ensure DESC really exists, or set it to nil.
  807. (desc (and (not (string= desc "")) desc))
  808. (path (cond
  809. ((member type '("http" "https" "ftp"))
  810. (concat type ":" raw-path))
  811. ((string= type "file") (org-export-file-uri raw-path))
  812. (t raw-path))))
  813. (cond
  814. ((org-export-custom-protocol-maybe link desc 'texinfo))
  815. ((org-export-inline-image-p link org-texinfo-inline-image-rules)
  816. (org-texinfo--inline-image link info))
  817. ((equal type "radio")
  818. (let ((destination (org-export-resolve-radio-link link info)))
  819. (if (not destination) desc
  820. (format "@ref{%s,,%s}"
  821. (org-texinfo--get-node destination info)
  822. desc))))
  823. ((member type '("custom-id" "id" "fuzzy"))
  824. (let ((destination
  825. (if (equal type "fuzzy")
  826. (org-export-resolve-fuzzy-link link info)
  827. (org-export-resolve-id-link link info))))
  828. (case (org-element-type destination)
  829. ((nil)
  830. (format org-texinfo-link-with-unknown-path-format
  831. (org-texinfo--sanitize-content path)))
  832. ;; Id link points to an external file.
  833. (plain-text
  834. (if desc (format "@uref{file://%s,%s}" destination desc)
  835. (format "@uref{file://%s}" destination)))
  836. (headline
  837. (format "@ref{%s,%s}"
  838. (org-texinfo--get-node destination info)
  839. (cond
  840. (desc)
  841. ((org-export-numbered-headline-p destination info)
  842. (mapconcat
  843. #'number-to-string
  844. (org-export-get-headline-number destination info) "."))
  845. (t (org-export-data
  846. (org-element-property :title destination) info)))))
  847. (otherwise
  848. (format "@ref{%s,,%s}"
  849. (org-texinfo--get-node destination info)
  850. (cond
  851. (desc)
  852. ;; No description is provided: first try to
  853. ;; associate destination to a number.
  854. ((let ((n (org-export-get-ordinal destination info)))
  855. (cond ((not n) nil)
  856. ((integerp n) n)
  857. (t (mapconcat #'number-to-string n ".")))))
  858. ;; Then grab title of headline containing
  859. ;; DESTINATION.
  860. ((let ((h (org-element-lineage destination '(headline) t)))
  861. (and h
  862. (org-export-data
  863. (org-element-property :title destination) info))))
  864. ;; Eventually, just return "Top" to refer to the
  865. ;; beginning of the info file.
  866. (t "Top")))))))
  867. ((equal type "info")
  868. (let* ((info-path (split-string path "[:#]"))
  869. (info-manual (car info-path))
  870. (info-node (or (cadr info-path) "Top"))
  871. (title (or desc "")))
  872. (format "@ref{%s,%s,,%s,}" info-node title info-manual)))
  873. ((string= type "mailto")
  874. (format "@email{%s}"
  875. (concat (org-texinfo--sanitize-content path)
  876. (and desc (concat "," desc)))))
  877. ;; External link with a description part.
  878. ((and path desc) (format "@uref{%s,%s}" path desc))
  879. ;; External link without a description part.
  880. (path (format "@uref{%s}" path))
  881. ;; No path, only description. Try to do something useful.
  882. (t
  883. (format (plist-get info :texinfo-link-with-unknown-path-format) desc)))))
  884. (defun org-texinfo--inline-image (link info)
  885. "Return Texinfo code for an inline image.
  886. LINK is the link pointing to the inline image. INFO is the
  887. current state of the export, as a plist."
  888. (let* ((parent (org-export-get-parent-element link))
  889. (label (and (org-element-property :name parent)
  890. (org-texinfo--get-node parent info)))
  891. (caption (org-export-get-caption parent))
  892. (shortcaption (org-export-get-caption parent t))
  893. (path (org-element-property :path link))
  894. (filename
  895. (file-name-sans-extension
  896. (if (file-name-absolute-p path) (expand-file-name path) path)))
  897. (extension (file-name-extension path))
  898. (attributes (org-export-read-attribute :attr_texinfo parent))
  899. (height (or (plist-get attributes :height) ""))
  900. (width (or (plist-get attributes :width) ""))
  901. (alt (or (plist-get attributes :alt) ""))
  902. (image (format "@image{%s,%s,%s,%s,%s}"
  903. filename width height alt extension)))
  904. (cond ((or caption shortcaption)
  905. (org-texinfo--wrap-float image
  906. info
  907. (org-export-translate "Figure" :utf-8 info)
  908. label
  909. caption
  910. shortcaption))
  911. (label (concat "@anchor{" label "}\n" image))
  912. (t image))))
  913. ;;;; Menu
  914. (defun org-texinfo-make-menu (scope info &optional master)
  915. "Create the menu for inclusion in the Texinfo document.
  916. SCOPE is a headline or a full parse tree. INFO is the
  917. communication channel, as a plist.
  918. When optional argument MASTER is non-nil, generate a master menu,
  919. including detailed node listing."
  920. (let ((menu (org-texinfo--build-menu scope info)))
  921. (when (org-string-nw-p menu)
  922. (org-element-normalize-string
  923. (format
  924. "@menu\n%s@end menu"
  925. (concat menu
  926. (when master
  927. (let ((detailmenu
  928. (org-texinfo--build-menu
  929. scope info
  930. (let ((toc-depth (plist-get info :with-toc)))
  931. (if (wholenump toc-depth) toc-depth
  932. org-texinfo-max-toc-depth)))))
  933. (when (org-string-nw-p detailmenu)
  934. (concat "\n@detailmenu\n"
  935. "--- The Detailed Node Listing ---\n\n"
  936. detailmenu
  937. "@end detailmenu\n"))))))))))
  938. (defun org-texinfo--build-menu (scope info &optional level)
  939. "Build menu for entries within SCOPE.
  940. SCOPE is a headline or a full parse tree. INFO is a plist
  941. containing contextual information. When optional argument LEVEL
  942. is an integer, build the menu recursively, down to this depth."
  943. (cond
  944. ((not level)
  945. (org-texinfo--format-entries (org-texinfo--menu-entries scope info) info))
  946. ((zerop level) nil)
  947. (t
  948. (org-element-normalize-string
  949. (mapconcat
  950. (lambda (h)
  951. (let ((entries (org-texinfo--menu-entries h info)))
  952. (when entries
  953. (concat
  954. (format "%s\n\n%s\n"
  955. (org-export-data (org-export-get-alt-title h info) info)
  956. (org-texinfo--format-entries entries info))
  957. (org-texinfo--build-menu h info (1- level))))))
  958. (org-texinfo--menu-entries scope info) "")))))
  959. (defun org-texinfo--format-entries (entries info)
  960. "Format all direct menu entries in SCOPE, as a string.
  961. SCOPE is either a headline or a full Org document. INFO is
  962. a plist containing contextual information."
  963. (org-element-normalize-string
  964. (mapconcat
  965. (lambda (h)
  966. (let* ((title (org-export-data
  967. (org-export-get-alt-title h info) info))
  968. (node (org-texinfo--get-node h info))
  969. (entry (concat "* " title ":"
  970. (if (string= title node) ":"
  971. (concat " " node ". "))))
  972. (desc (org-element-property :DESCRIPTION h)))
  973. (if (not desc) entry
  974. (format (format "%%-%ds %%s" org-texinfo-node-description-column)
  975. entry desc))))
  976. entries "\n")))
  977. (defun org-texinfo--menu-entries (scope info)
  978. "List direct children in SCOPE needing a menu entry.
  979. SCOPE is a headline or a full parse tree. INFO is a plist
  980. holding contextual information."
  981. (let* ((cache (or (plist-get info :texinfo-entries-cache)
  982. (plist-get (plist-put info :texinfo-entries-cache
  983. (make-hash-table :test #'eq))
  984. :texinfo-entries-cache)))
  985. (cached-entries (gethash scope cache 'no-cache)))
  986. (if (not (eq cached-entries 'no-cache)) cached-entries
  987. (puthash scope
  988. (org-element-map (org-element-contents scope) 'headline
  989. (lambda (h)
  990. (and (not (org-not-nil (org-element-property :COPYING h)))
  991. (not (org-element-property :footnote-section-p h))
  992. (not (org-export-low-level-p h info))
  993. h))
  994. info nil 'headline)
  995. cache))))
  996. ;;;; Node Property
  997. (defun org-texinfo-node-property (node-property _contents _info)
  998. "Transcode a NODE-PROPERTY element from Org to Texinfo.
  999. CONTENTS is nil. INFO is a plist holding contextual
  1000. information."
  1001. (format "%s:%s"
  1002. (org-element-property :key node-property)
  1003. (let ((value (org-element-property :value node-property)))
  1004. (if value (concat " " value) ""))))
  1005. ;;;; Paragraph
  1006. (defun org-texinfo-paragraph (_paragraph contents _info)
  1007. "Transcode a PARAGRAPH element from Org to Texinfo.
  1008. CONTENTS is the contents of the paragraph, as a string. INFO is
  1009. the plist used as a communication channel."
  1010. contents)
  1011. ;;;; Plain List
  1012. (defun org-texinfo-plain-list (plain-list contents info)
  1013. "Transcode a PLAIN-LIST element from Org to Texinfo.
  1014. CONTENTS is the contents of the list. INFO is a plist holding
  1015. contextual information."
  1016. (let* ((attr (org-export-read-attribute :attr_texinfo plain-list))
  1017. (indic (or (plist-get attr :indic)
  1018. (plist-get info :texinfo-def-table-markup)))
  1019. (table-type (plist-get attr :table-type))
  1020. (type (org-element-property :type plain-list))
  1021. (list-type (cond
  1022. ((eq type 'ordered) "enumerate")
  1023. ((eq type 'unordered) "itemize")
  1024. ((member table-type '("ftable" "vtable")) table-type)
  1025. (t "table"))))
  1026. (format "@%s\n%s@end %s"
  1027. (if (eq type 'descriptive) (concat list-type " " indic) list-type)
  1028. contents
  1029. list-type)))
  1030. ;;;; Plain Text
  1031. (defun org-texinfo-plain-text (text info)
  1032. "Transcode a TEXT string from Org to Texinfo.
  1033. TEXT is the string to transcode. INFO is a plist holding
  1034. contextual information."
  1035. ;; First protect @, { and }.
  1036. (let ((output (org-texinfo--sanitize-content text)))
  1037. ;; Activate smart quotes. Be sure to provide original TEXT string
  1038. ;; since OUTPUT may have been modified.
  1039. (when (plist-get info :with-smart-quotes)
  1040. (setq output
  1041. (org-export-activate-smart-quotes output :texinfo info text)))
  1042. ;; LaTeX into @LaTeX{} and TeX into @TeX{}
  1043. (let ((case-fold-search nil)
  1044. (start 0))
  1045. (while (string-match "\\(\\(?:La\\)?TeX\\)" output start)
  1046. (setq output (replace-match
  1047. (format "@%s{}" (match-string 1 output)) nil t output)
  1048. start (match-end 0))))
  1049. ;; Convert special strings.
  1050. (when (plist-get info :with-special-strings)
  1051. (while (string-match (regexp-quote "...") output)
  1052. (setq output (replace-match "@dots{}" nil t output))))
  1053. ;; Handle break preservation if required.
  1054. (when (plist-get info :preserve-breaks)
  1055. (setq output (replace-regexp-in-string
  1056. "\\(\\\\\\\\\\)?[ \t]*\n" " @*\n" output)))
  1057. ;; Return value.
  1058. output))
  1059. ;;;; Planning
  1060. (defun org-texinfo-planning (planning _contents info)
  1061. "Transcode a PLANNING element from Org to Texinfo.
  1062. CONTENTS is nil. INFO is a plist holding contextual
  1063. information."
  1064. (concat
  1065. "@noindent"
  1066. (mapconcat
  1067. 'identity
  1068. (delq nil
  1069. (list
  1070. (let ((closed (org-element-property :closed planning)))
  1071. (when closed
  1072. (concat
  1073. (format "@strong{%s} " org-closed-string)
  1074. (format (plist-get info :texinfo-inactive-timestamp-format)
  1075. (org-timestamp-translate closed)))))
  1076. (let ((deadline (org-element-property :deadline planning)))
  1077. (when deadline
  1078. (concat
  1079. (format "@strong{%s} " org-deadline-string)
  1080. (format (plist-get info :texinfo-active-timestamp-format)
  1081. (org-timestamp-translate deadline)))))
  1082. (let ((scheduled (org-element-property :scheduled planning)))
  1083. (when scheduled
  1084. (concat
  1085. (format "@strong{%s} " org-scheduled-string)
  1086. (format (plist-get info :texinfo-active-timestamp-format)
  1087. (org-timestamp-translate scheduled)))))))
  1088. " ")
  1089. "@*"))
  1090. ;;;; Property Drawer
  1091. (defun org-texinfo-property-drawer (_property-drawer contents _info)
  1092. "Transcode a PROPERTY-DRAWER element from Org to Texinfo.
  1093. CONTENTS holds the contents of the drawer. INFO is a plist
  1094. holding contextual information."
  1095. (and (org-string-nw-p contents)
  1096. (format "@verbatim\n%s@end verbatim" contents)))
  1097. ;;;; Quote Block
  1098. (defun org-texinfo-quote-block (quote-block contents _info)
  1099. "Transcode a QUOTE-BLOCK element from Org to Texinfo.
  1100. CONTENTS holds the contents of the block. INFO is a plist
  1101. holding contextual information."
  1102. (let* ((title (org-element-property :name quote-block))
  1103. (start-quote (concat "@quotation"
  1104. (if title
  1105. (format " %s" title)))))
  1106. (format "%s\n%s@end quotation" start-quote contents)))
  1107. ;;;; Radio Target
  1108. (defun org-texinfo-radio-target (radio-target text info)
  1109. "Transcode a RADIO-TARGET object from Org to Texinfo.
  1110. TEXT is the text of the target. INFO is a plist holding
  1111. contextual information."
  1112. (format "@anchor{%s}%s"
  1113. (org-export-get-reference radio-target info)
  1114. text))
  1115. ;;;; Section
  1116. (defun org-texinfo-section (section contents info)
  1117. "Transcode a SECTION element from Org to Texinfo.
  1118. CONTENTS holds the contents of the section. INFO is a plist
  1119. holding contextual information."
  1120. (concat contents
  1121. (let ((parent (org-export-get-parent-headline section)))
  1122. (and parent (org-texinfo-make-menu parent info)))))
  1123. ;;;; Special Block
  1124. (defun org-texinfo-special-block (special-block contents _info)
  1125. "Transcode a SPECIAL-BLOCK element from Org to Texinfo.
  1126. CONTENTS holds the contents of the block. INFO is a plist used
  1127. as a communication channel."
  1128. (let ((type (org-element-property :type special-block)))
  1129. (format "@%s\n%s@end %s" type contents type)))
  1130. ;;;; Src Block
  1131. (defun org-texinfo-src-block (src-block _contents info)
  1132. "Transcode a SRC-BLOCK element from Org to Texinfo.
  1133. CONTENTS holds the contents of the item. INFO is a plist holding
  1134. contextual information."
  1135. (let* ((lisp (org-string-match-p "lisp"
  1136. (org-element-property :language src-block)))
  1137. (code (org-texinfo--sanitize-content
  1138. (org-export-format-code-default src-block info)))
  1139. (value (format
  1140. (if lisp "@lisp\n%s@end lisp" "@example\n%s@end example")
  1141. code))
  1142. (caption (org-export-get-caption src-block))
  1143. (shortcaption (org-export-get-caption src-block t)))
  1144. (if (not (or caption shortcaption)) value
  1145. (org-texinfo--wrap-float value
  1146. info
  1147. (org-export-translate "Listing" :utf-8 info)
  1148. (org-export-get-reference src-block info)
  1149. caption
  1150. shortcaption))))
  1151. ;;;; Statistics Cookie
  1152. (defun org-texinfo-statistics-cookie (statistics-cookie _contents _info)
  1153. "Transcode a STATISTICS-COOKIE object from Org to Texinfo.
  1154. CONTENTS is nil. INFO is a plist holding contextual information."
  1155. (org-element-property :value statistics-cookie))
  1156. ;;;; Subscript
  1157. (defun org-texinfo-subscript (_subscript contents _info)
  1158. "Transcode a SUBSCRIPT object from Org to Texinfo.
  1159. CONTENTS is the contents of the object. INFO is a plist holding
  1160. contextual information."
  1161. (format "@math{_%s}" contents))
  1162. ;;;; Superscript
  1163. (defun org-texinfo-superscript (_superscript contents _info)
  1164. "Transcode a SUPERSCRIPT object from Org to Texinfo.
  1165. CONTENTS is the contents of the object. INFO is a plist holding
  1166. contextual information."
  1167. (format "@math{^%s}" contents))
  1168. ;;;; Table
  1169. (defun org-texinfo-table (table contents info)
  1170. "Transcode a TABLE element from Org to Texinfo.
  1171. CONTENTS is the contents of the table. INFO is a plist holding
  1172. contextual information."
  1173. (if (eq (org-element-property :type table) 'table.el)
  1174. (format "@verbatim\n%s@end verbatim"
  1175. (org-element-normalize-string
  1176. (org-element-property :value table)))
  1177. (let* ((col-width (org-export-read-attribute :attr_texinfo table :columns))
  1178. (columns
  1179. (if col-width (format "@columnfractions %s" col-width)
  1180. (org-texinfo-table-column-widths table info)))
  1181. (caption (org-export-get-caption table))
  1182. (shortcaption (org-export-get-caption table t))
  1183. (table-str (format "@multitable %s\n%s@end multitable"
  1184. columns
  1185. contents)))
  1186. (if (not (or caption shortcaption)) table-str
  1187. (org-texinfo--wrap-float table-str
  1188. info
  1189. (org-export-translate "Table" :utf-8 info)
  1190. (org-export-get-reference table info)
  1191. caption
  1192. shortcaption)))))
  1193. (defun org-texinfo-table-column-widths (table info)
  1194. "Determine the largest table cell in each column to process alignment.
  1195. TABLE is the table element to transcode. INFO is a plist used as
  1196. a communication channel."
  1197. (let ((widths (make-vector (cdr (org-export-table-dimensions table info)) 0)))
  1198. (org-element-map table 'table-row
  1199. (lambda (row)
  1200. (let ((idx 0))
  1201. (org-element-map row 'table-cell
  1202. (lambda (cell)
  1203. ;; Length of the cell in the original buffer is only an
  1204. ;; approximation of the length of the cell in the
  1205. ;; output. It can sometimes fail (e.g. it considers
  1206. ;; "/a/" being larger than "ab").
  1207. (let ((w (- (org-element-property :contents-end cell)
  1208. (org-element-property :contents-begin cell))))
  1209. (aset widths idx (max w (aref widths idx))))
  1210. (incf idx))
  1211. info)))
  1212. info)
  1213. (format "{%s}" (mapconcat (lambda (w) (make-string w ?a)) widths "} {"))))
  1214. ;;;; Table Cell
  1215. (defun org-texinfo-table-cell (table-cell contents info)
  1216. "Transcode a TABLE-CELL element from Org to Texinfo.
  1217. CONTENTS is the cell contents. INFO is a plist used as
  1218. a communication channel."
  1219. (concat
  1220. (let ((scientific-notation
  1221. (plist-get info :texinfo-table-scientific-notation)))
  1222. (if (and contents
  1223. scientific-notation
  1224. (string-match orgtbl-exp-regexp contents))
  1225. ;; Use appropriate format string for scientific notation.
  1226. (format scientific-notation
  1227. (match-string 1 contents)
  1228. (match-string 2 contents))
  1229. contents))
  1230. (when (org-export-get-next-element table-cell info) "\n@tab ")))
  1231. ;;;; Table Row
  1232. (defun org-texinfo-table-row (table-row contents info)
  1233. "Transcode a TABLE-ROW element from Org to Texinfo.
  1234. CONTENTS is the contents of the row. INFO is a plist used as
  1235. a communication channel."
  1236. ;; Rules are ignored since table separators are deduced from
  1237. ;; borders of the current row.
  1238. (when (eq (org-element-property :type table-row) 'standard)
  1239. (let ((rowgroup-tag
  1240. (if (and (= 1 (org-export-table-row-group table-row info))
  1241. (org-export-table-has-header-p
  1242. (org-export-get-parent-table table-row) info))
  1243. "@headitem "
  1244. "@item ")))
  1245. (concat rowgroup-tag contents "\n"))))
  1246. ;;;; Target
  1247. (defun org-texinfo-target (target _contents info)
  1248. "Transcode a TARGET object from Org to Texinfo.
  1249. CONTENTS is nil. INFO is a plist holding contextual
  1250. information."
  1251. (format "@anchor{%s}" (org-export-get-reference target info)))
  1252. ;;;; Timestamp
  1253. (defun org-texinfo-timestamp (timestamp _contents info)
  1254. "Transcode a TIMESTAMP object from Org to Texinfo.
  1255. CONTENTS is nil. INFO is a plist holding contextual
  1256. information."
  1257. (let ((value (org-texinfo-plain-text
  1258. (org-timestamp-translate timestamp) info)))
  1259. (case (org-element-property :type timestamp)
  1260. ((active active-range)
  1261. (format (plist-get info :texinfo-active-timestamp-format) value))
  1262. ((inactive inactive-range)
  1263. (format (plist-get info :texinfo-inactive-timestamp-format) value))
  1264. (t (format (plist-get info :texinfo-diary-timestamp-format) value)))))
  1265. ;;;; Verbatim
  1266. (defun org-texinfo-verbatim (verbatim _contents info)
  1267. "Transcode a VERBATIM object from Org to Texinfo.
  1268. CONTENTS is nil. INFO is a plist used as a communication
  1269. channel."
  1270. (org-texinfo--text-markup
  1271. (org-element-property :value verbatim) 'verbatim info))
  1272. ;;;; Verse Block
  1273. (defun org-texinfo-verse-block (_verse-block contents _info)
  1274. "Transcode a VERSE-BLOCK element from Org to Texinfo.
  1275. CONTENTS is verse block contents. INFO is a plist holding
  1276. contextual information."
  1277. (format "@display\n%s@end display" contents))
  1278. ;;; Interactive functions
  1279. (defun org-texinfo-export-to-texinfo
  1280. (&optional async subtreep visible-only body-only ext-plist)
  1281. "Export current buffer to a Texinfo file.
  1282. If narrowing is active in the current buffer, only export its
  1283. narrowed part.
  1284. If a region is active, export that region.
  1285. A non-nil optional argument ASYNC means the process should happen
  1286. asynchronously. The resulting file should be accessible through
  1287. the `org-export-stack' interface.
  1288. When optional argument SUBTREEP is non-nil, export the sub-tree
  1289. at point, extracting information from the headline properties
  1290. first.
  1291. When optional argument VISIBLE-ONLY is non-nil, don't export
  1292. contents of hidden elements.
  1293. When optional argument BODY-ONLY is non-nil, only write code
  1294. between \"\\begin{document}\" and \"\\end{document}\".
  1295. EXT-PLIST, when provided, is a property list with external
  1296. parameters overriding Org default settings, but still inferior to
  1297. file-local settings.
  1298. Return output file's name."
  1299. (interactive)
  1300. (let ((outfile (org-export-output-file-name ".texi" subtreep))
  1301. (org-export-coding-system org-texinfo-coding-system))
  1302. (org-export-to-file 'texinfo outfile
  1303. async subtreep visible-only body-only ext-plist)))
  1304. (defun org-texinfo-export-to-info
  1305. (&optional async subtreep visible-only body-only ext-plist)
  1306. "Export current buffer to Texinfo then process through to INFO.
  1307. If narrowing is active in the current buffer, only export its
  1308. narrowed part.
  1309. If a region is active, export that region.
  1310. A non-nil optional argument ASYNC means the process should happen
  1311. asynchronously. The resulting file should be accessible through
  1312. the `org-export-stack' interface.
  1313. When optional argument SUBTREEP is non-nil, export the sub-tree
  1314. at point, extracting information from the headline properties
  1315. first.
  1316. When optional argument VISIBLE-ONLY is non-nil, don't export
  1317. contents of hidden elements.
  1318. When optional argument BODY-ONLY is non-nil, only write code
  1319. between \"\\begin{document}\" and \"\\end{document}\".
  1320. EXT-PLIST, when provided, is a property list with external
  1321. parameters overriding Org default settings, but still inferior to
  1322. file-local settings.
  1323. When optional argument PUB-DIR is set, use it as the publishing
  1324. directory.
  1325. Return INFO file's name."
  1326. (interactive)
  1327. (let ((outfile (org-export-output-file-name ".texi" subtreep))
  1328. (org-export-coding-system org-texinfo-coding-system))
  1329. (org-export-to-file 'texinfo outfile
  1330. async subtreep visible-only body-only ext-plist
  1331. (lambda (file) (org-texinfo-compile file)))))
  1332. ;;;###autoload
  1333. (defun org-texinfo-publish-to-texinfo (plist filename pub-dir)
  1334. "Publish an org file to Texinfo.
  1335. FILENAME is the filename of the Org file to be published. PLIST
  1336. is the property list for the given project. PUB-DIR is the
  1337. publishing directory.
  1338. Return output file name."
  1339. (org-publish-org-to 'texinfo filename ".texi" plist pub-dir))
  1340. ;;;###autoload
  1341. (defun org-texinfo-convert-region-to-texinfo ()
  1342. "Assume the current region has org-mode syntax, and convert it to Texinfo.
  1343. This can be used in any buffer. For example, you can write an
  1344. itemized list in org-mode syntax in an Texinfo buffer and use
  1345. this command to convert it."
  1346. (interactive)
  1347. (org-export-replace-region-by 'texinfo))
  1348. (defun org-texinfo-compile (file)
  1349. "Compile a texinfo file.
  1350. FILE is the name of the file being compiled. Processing is
  1351. done through the command specified in `org-texinfo-info-process'.
  1352. Return INFO file name or an error if it couldn't be produced."
  1353. (let* ((base-name (file-name-sans-extension (file-name-nondirectory file)))
  1354. (full-name (file-truename file))
  1355. (out-dir (file-name-directory file))
  1356. ;; Properly set working directory for compilation.
  1357. (default-directory (if (file-name-absolute-p file)
  1358. (file-name-directory full-name)
  1359. default-directory))
  1360. errors)
  1361. (message "Processing Texinfo file %s..." file)
  1362. (save-window-excursion
  1363. ;; Replace %b, %f and %o with appropriate values in each command
  1364. ;; before applying it. Output is redirected to "*Org INFO
  1365. ;; Texinfo Output*" buffer.
  1366. (let ((outbuf (get-buffer-create "*Org INFO Texinfo Output*")))
  1367. (with-current-buffer outbuf (compilation-mode))
  1368. (dolist (command org-texinfo-info-process)
  1369. (shell-command
  1370. (replace-regexp-in-string
  1371. "%b" (shell-quote-argument base-name)
  1372. (replace-regexp-in-string
  1373. "%f" (shell-quote-argument full-name)
  1374. (replace-regexp-in-string
  1375. "%o" (shell-quote-argument out-dir) command t t) t t) t t)
  1376. outbuf))
  1377. ;; Collect standard errors from output buffer.
  1378. (setq errors (org-texinfo-collect-errors outbuf)))
  1379. (let ((infofile (concat out-dir base-name ".info")))
  1380. ;; Check for process failure. Provide collected errors if
  1381. ;; possible.
  1382. (if (not (file-exists-p infofile))
  1383. (error "INFO file %s wasn't produced%s" infofile
  1384. (if errors (concat ": " errors) ""))
  1385. ;; Else remove log files, when specified, and signal end of
  1386. ;; process to user, along with any error encountered.
  1387. (when org-texinfo-remove-logfiles
  1388. (dolist (ext org-texinfo-logfiles-extensions)
  1389. (let ((file (concat out-dir base-name "." ext)))
  1390. (when (file-exists-p file) (delete-file file)))))
  1391. (message (concat "Process completed"
  1392. (if (not errors) "."
  1393. (concat " with errors: " errors)))))
  1394. ;; Return output file name.
  1395. infofile))))
  1396. (defun org-texinfo-collect-errors (buffer)
  1397. "Collect some kind of errors from \"makeinfo\" command output.
  1398. BUFFER is the buffer containing output.
  1399. Return collected error types as a string, or nil if there was
  1400. none."
  1401. (with-current-buffer buffer
  1402. (save-excursion
  1403. (goto-char (point-min))
  1404. ;; Find final "makeinfo" run.
  1405. (when t
  1406. (let ((case-fold-search t)
  1407. (errors ""))
  1408. (when (save-excursion
  1409. (re-search-forward "perhaps incorrect sectioning?" nil t))
  1410. (setq errors (concat errors " [incorrect sectioning]")))
  1411. (when (save-excursion
  1412. (re-search-forward "missing close brace" nil t))
  1413. (setq errors (concat errors " [syntax error]")))
  1414. (when (save-excursion
  1415. (re-search-forward "Unknown command" nil t))
  1416. (setq errors (concat errors " [undefined @command]")))
  1417. (when (save-excursion
  1418. (re-search-forward "No matching @end" nil t))
  1419. (setq errors (concat errors " [block incomplete]")))
  1420. (when (save-excursion
  1421. (re-search-forward "requires a sectioning" nil t))
  1422. (setq errors (concat errors " [invalid section command]")))
  1423. (when (save-excursion
  1424. (re-search-forward "\\[unexpected\ ]" nil t))
  1425. (setq errors (concat errors " [unexpected error]")))
  1426. (when (save-excursion
  1427. (re-search-forward "misplaced " nil t))
  1428. (setq errors (concat errors " [syntax error]")))
  1429. (and (org-string-nw-p errors) (org-trim errors)))))))
  1430. (provide 'ox-texinfo)
  1431. ;; Local variables:
  1432. ;; generated-autoload-file: "org-loaddefs.el"
  1433. ;; End:
  1434. ;;; ox-texinfo.el ends here