ox-texinfo.el 59 KB

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