2013-01-27 17:11:34 -05:00
|
|
|
|
;;; ox-texinfo.el --- Texinfo Back-End for Org Export Engine
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2014-01-04 12:56:11 -05:00
|
|
|
|
;; Copyright (C) 2012-2014 Free Software Foundation, Inc.
|
2012-08-15 16:00:20 -04:00
|
|
|
|
;; Author: Jonathan Leech-Pepin <jonathan.leechpepin at gmail dot com>
|
|
|
|
|
;; Keywords: outlines, hypermedia, calendar, wp
|
2013-02-23 03:56:24 -05:00
|
|
|
|
|
2013-02-23 02:59:23 -05:00
|
|
|
|
;; This file is part of GNU Emacs.
|
2013-02-23 03:56:24 -05:00
|
|
|
|
|
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
2012-08-15 16:00:20 -04:00
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
;; (at your option) any later version.
|
|
|
|
|
|
2013-02-23 03:56:24 -05:00
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
2012-08-15 16:00:20 -04:00
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2013-02-23 03:56:24 -05:00
|
|
|
|
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
;;
|
|
|
|
|
;; This library implements a Texinfo back-end for Org generic
|
|
|
|
|
;; exporter.
|
|
|
|
|
;;
|
|
|
|
|
;; To test it, run
|
|
|
|
|
;;
|
2013-01-27 17:11:34 -05:00
|
|
|
|
;; M-: (org-export-to-buffer 'texinfo "*Test Texinfo*") RET
|
2012-08-15 16:00:20 -04:00
|
|
|
|
;;
|
2013-01-27 17:11:34 -05:00
|
|
|
|
;; in an Org mode buffer then switch to the buffer to see the Texinfo
|
|
|
|
|
;; export. See ox.el for more details on how this exporter works.
|
2012-08-15 16:00:20 -04:00
|
|
|
|
;;
|
2012-12-04 11:39:13 -05:00
|
|
|
|
|
|
|
|
|
;; It introduces nine new buffer keywords: "TEXINFO_CLASS",
|
|
|
|
|
;; "TEXINFO_FILENAME", "TEXINFO_HEADER", "TEXINFO_POST_HEADER",
|
|
|
|
|
;; "TEXINFO_DIR_CATEGORY", "TEXINFO_DIR_TITLE", "TEXINFO_DIR_DESC"
|
|
|
|
|
;; "SUBTITLE" and "SUBAUTHOR".
|
|
|
|
|
|
2012-08-15 16:00:20 -04:00
|
|
|
|
;;
|
2012-11-21 11:15:33 -05:00
|
|
|
|
;; It introduces 1 new headline property keywords:
|
2012-12-04 09:19:43 -05:00
|
|
|
|
;; "TEXINFO_MENU_TITLE" for optional menu titles.
|
2012-11-21 11:15:33 -05:00
|
|
|
|
;;
|
2012-08-15 16:00:20 -04:00
|
|
|
|
;; To include inline code snippets (for example for generating @kbd{}
|
|
|
|
|
;; and @key{} commands), the following export-snippet keys are
|
|
|
|
|
;; accepted:
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;
|
2013-01-27 17:11:34 -05:00
|
|
|
|
;; texinfo
|
2012-08-15 16:00:20 -04:00
|
|
|
|
;; info
|
|
|
|
|
;;
|
|
|
|
|
;; You can add them for export snippets via any of the below:
|
|
|
|
|
;;
|
|
|
|
|
;; (add-to-list 'org-export-snippet-translation-alist
|
2013-01-27 17:11:34 -05:00
|
|
|
|
;; '("info" . "texinfo"))
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
|
|
(eval-when-compile (require 'cl))
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(require 'ox)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
|
|
|
|
(defvar orgtbl-exp-regexp)
|
|
|
|
|
|
2012-09-09 07:08:52 -04:00
|
|
|
|
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
|
|
|
|
;;; Define Back-End
|
|
|
|
|
|
2013-03-19 11:24:40 -04:00
|
|
|
|
(org-export-define-backend 'texinfo
|
|
|
|
|
'((bold . org-texinfo-bold)
|
|
|
|
|
(center-block . org-texinfo-center-block)
|
|
|
|
|
(clock . org-texinfo-clock)
|
|
|
|
|
(code . org-texinfo-code)
|
|
|
|
|
(comment . org-texinfo-comment)
|
|
|
|
|
(comment-block . org-texinfo-comment-block)
|
|
|
|
|
(drawer . org-texinfo-drawer)
|
|
|
|
|
(dynamic-block . org-texinfo-dynamic-block)
|
|
|
|
|
(entity . org-texinfo-entity)
|
|
|
|
|
(example-block . org-texinfo-example-block)
|
|
|
|
|
(export-block . org-texinfo-export-block)
|
|
|
|
|
(export-snippet . org-texinfo-export-snippet)
|
|
|
|
|
(fixed-width . org-texinfo-fixed-width)
|
|
|
|
|
(footnote-definition . org-texinfo-footnote-definition)
|
|
|
|
|
(footnote-reference . org-texinfo-footnote-reference)
|
|
|
|
|
(headline . org-texinfo-headline)
|
|
|
|
|
(inline-src-block . org-texinfo-inline-src-block)
|
|
|
|
|
(inlinetask . org-texinfo-inlinetask)
|
|
|
|
|
(italic . org-texinfo-italic)
|
|
|
|
|
(item . org-texinfo-item)
|
|
|
|
|
(keyword . org-texinfo-keyword)
|
|
|
|
|
(line-break . org-texinfo-line-break)
|
|
|
|
|
(link . org-texinfo-link)
|
2013-09-25 15:27:29 -04:00
|
|
|
|
(node-property . org-texinfo-node-property)
|
2013-03-19 11:24:40 -04:00
|
|
|
|
(paragraph . org-texinfo-paragraph)
|
|
|
|
|
(plain-list . org-texinfo-plain-list)
|
|
|
|
|
(plain-text . org-texinfo-plain-text)
|
|
|
|
|
(planning . org-texinfo-planning)
|
|
|
|
|
(property-drawer . org-texinfo-property-drawer)
|
|
|
|
|
(quote-block . org-texinfo-quote-block)
|
|
|
|
|
(quote-section . org-texinfo-quote-section)
|
|
|
|
|
(radio-target . org-texinfo-radio-target)
|
|
|
|
|
(section . org-texinfo-section)
|
|
|
|
|
(special-block . org-texinfo-special-block)
|
|
|
|
|
(src-block . org-texinfo-src-block)
|
|
|
|
|
(statistics-cookie . org-texinfo-statistics-cookie)
|
|
|
|
|
(subscript . org-texinfo-subscript)
|
|
|
|
|
(superscript . org-texinfo-superscript)
|
|
|
|
|
(table . org-texinfo-table)
|
|
|
|
|
(table-cell . org-texinfo-table-cell)
|
|
|
|
|
(table-row . org-texinfo-table-row)
|
|
|
|
|
(target . org-texinfo-target)
|
|
|
|
|
(template . org-texinfo-template)
|
|
|
|
|
(timestamp . org-texinfo-timestamp)
|
|
|
|
|
(verbatim . org-texinfo-verbatim)
|
|
|
|
|
(verse-block . org-texinfo-verse-block))
|
2012-09-09 07:08:52 -04:00
|
|
|
|
:export-block "TEXINFO"
|
|
|
|
|
:filters-alist
|
2013-03-19 11:24:40 -04:00
|
|
|
|
'((:filter-headline . org-texinfo-filter-section-blank-lines)
|
|
|
|
|
(:filter-section . org-texinfo-filter-section-blank-lines))
|
2012-09-09 07:08:52 -04:00
|
|
|
|
:menu-entry
|
2013-03-19 11:24:40 -04:00
|
|
|
|
'(?i "Export to Texinfo"
|
|
|
|
|
((?t "As TEXI file" org-texinfo-export-to-texinfo)
|
|
|
|
|
(?i "As INFO file" org-texinfo-export-to-info)))
|
2012-09-09 07:08:52 -04:00
|
|
|
|
:options-alist
|
2013-03-19 11:24:40 -04:00
|
|
|
|
'((:texinfo-filename "TEXINFO_FILENAME" nil org-texinfo-filename t)
|
|
|
|
|
(:texinfo-class "TEXINFO_CLASS" nil org-texinfo-default-class t)
|
|
|
|
|
(:texinfo-header "TEXINFO_HEADER" nil nil newline)
|
|
|
|
|
(:texinfo-post-header "TEXINFO_POST_HEADER" nil nil newline)
|
|
|
|
|
(:subtitle "SUBTITLE" nil nil newline)
|
|
|
|
|
(:subauthor "SUBAUTHOR" nil nil newline)
|
|
|
|
|
(:texinfo-dircat "TEXINFO_DIR_CATEGORY" nil nil t)
|
|
|
|
|
(:texinfo-dirtitle "TEXINFO_DIR_TITLE" nil nil t)
|
|
|
|
|
(:texinfo-dirdesc "TEXINFO_DIR_DESC" nil nil t)))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; User Configurable Variables
|
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defgroup org-export-texinfo nil
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Options for exporting Org mode files to Texinfo."
|
|
|
|
|
:tag "Org Export Texinfo"
|
2013-03-06 11:31:28 -05:00
|
|
|
|
:version "24.4"
|
|
|
|
|
:package-version '(Org . "8.0")
|
2012-08-15 16:00:20 -04:00
|
|
|
|
:group 'org-export)
|
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Preamble
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-11-14 08:05:18 -05:00
|
|
|
|
(defcustom org-texinfo-filename ""
|
2013-03-19 05:01:42 -04:00
|
|
|
|
"Default filename for Texinfo output."
|
2013-01-27 17:11:34 -05:00
|
|
|
|
:group 'org-export-texinfo
|
2012-08-15 16:00:20 -04:00
|
|
|
|
:type '(string :tag "Export Filename"))
|
|
|
|
|
|
2013-03-19 05:24:30 -04:00
|
|
|
|
(defcustom org-texinfo-coding-system nil
|
2013-04-23 09:25:46 -04:00
|
|
|
|
"Default document encoding for Texinfo output.
|
|
|
|
|
|
|
|
|
|
If `nil' it will default to `buffer-file-coding-system'."
|
2013-03-19 05:24:30 -04:00
|
|
|
|
:group 'org-export-texinfo
|
|
|
|
|
:type 'coding-system)
|
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defcustom org-texinfo-default-class "info"
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"The default Texinfo class."
|
2013-01-27 17:11:34 -05:00
|
|
|
|
:group 'org-export-texinfo
|
2012-08-15 16:00:20 -04:00
|
|
|
|
:type '(string :tag "Texinfo class"))
|
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defcustom org-texinfo-classes
|
2012-08-15 16:00:20 -04:00
|
|
|
|
'(("info"
|
|
|
|
|
"\\input texinfo @c -*- texinfo -*-"
|
|
|
|
|
("@chapter %s" . "@unnumbered %s")
|
|
|
|
|
("@section %s" . "@unnumberedsec %s")
|
|
|
|
|
("@subsection %s" . "@unnumberedsubsec %s")
|
|
|
|
|
("@subsubsection %s" . "@unnumberedsubsubsec %s")))
|
|
|
|
|
"Alist of Texinfo classes and associated header and structure.
|
|
|
|
|
If #+Texinfo_CLASS is set in the buffer, use its value and the
|
|
|
|
|
associated information. Here is the structure of each cell:
|
|
|
|
|
|
|
|
|
|
\(class-name
|
|
|
|
|
header-string
|
|
|
|
|
\(numbered-section . unnumbered-section\)
|
|
|
|
|
...\)
|
|
|
|
|
|
|
|
|
|
The sectioning structure
|
|
|
|
|
------------------------
|
|
|
|
|
|
|
|
|
|
The sectioning structure of the class is given by the elements
|
|
|
|
|
following the header string. For each sectioning level, a number
|
|
|
|
|
of strings is specified. A %s formatter is mandatory in each
|
|
|
|
|
section string and will be replaced by the title of the section.
|
|
|
|
|
|
|
|
|
|
Instead of a list of sectioning commands, you can also specify
|
|
|
|
|
a function name. That function will be called with two
|
|
|
|
|
parameters, the \(reduced) level of the headline, and a predicate
|
|
|
|
|
non-nil when the headline should be numbered. It must return
|
|
|
|
|
a format string in which the section title will be added."
|
2013-01-27 17:11:34 -05:00
|
|
|
|
:group 'org-export-texinfo
|
2012-08-15 16:00:20 -04:00
|
|
|
|
:type '(repeat
|
|
|
|
|
(list (string :tag "Texinfo class")
|
|
|
|
|
(string :tag "Texinfo header")
|
|
|
|
|
(repeat :tag "Levels" :inline t
|
|
|
|
|
(choice
|
|
|
|
|
(cons :tag "Heading"
|
|
|
|
|
(string :tag " numbered")
|
|
|
|
|
(string :tag "unnumbered"))
|
|
|
|
|
(function :tag "Hook computing sectioning"))))))
|
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Headline
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-11-14 08:05:18 -05:00
|
|
|
|
(defcustom org-texinfo-format-headline-function 'ignore
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Function to format headline text.
|
|
|
|
|
|
|
|
|
|
This function will be called with 5 arguments:
|
|
|
|
|
TODO the todo keyword (string or nil).
|
|
|
|
|
TODO-TYPE the type of todo (symbol: `todo', `done', nil)
|
|
|
|
|
PRIORITY the priority of the headline (integer or nil)
|
|
|
|
|
TEXT the main headline text (string).
|
|
|
|
|
TAGS the tags as a list of strings (list of strings or nil).
|
|
|
|
|
|
|
|
|
|
The function result will be used in the section format string.
|
|
|
|
|
|
|
|
|
|
As an example, one could set the variable to the following, in
|
|
|
|
|
order to reproduce the default set-up:
|
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
\(defun org-texinfo-format-headline (todo todo-type priority text tags)
|
2013-02-23 07:47:44 -05:00
|
|
|
|
\"Default format function for a headline.\"
|
2012-08-15 16:00:20 -04:00
|
|
|
|
\(concat (when todo
|
|
|
|
|
\(format \"\\\\textbf{\\\\textsc{\\\\textsf{%s}}} \" todo))
|
|
|
|
|
\(when priority
|
|
|
|
|
\(format \"\\\\framebox{\\\\#%c} \" priority))
|
|
|
|
|
text
|
|
|
|
|
\(when tags
|
|
|
|
|
\(format \"\\\\hfill{}\\\\textsc{%s}\"
|
|
|
|
|
\(mapconcat 'identity tags \":\"))))"
|
2013-01-27 17:11:34 -05:00
|
|
|
|
:group 'org-export-texinfo
|
2012-08-15 16:00:20 -04:00
|
|
|
|
:type 'function)
|
|
|
|
|
|
2013-02-25 10:44:18 -05:00
|
|
|
|
;;; Node listing (menu)
|
|
|
|
|
|
|
|
|
|
(defcustom org-texinfo-node-description-column 32
|
|
|
|
|
"Column at which to start the description in the node
|
|
|
|
|
listings.
|
|
|
|
|
|
|
|
|
|
If a node title is greater than this length, the description will
|
|
|
|
|
be placed after the end of the title."
|
|
|
|
|
:group 'org-export-texinfo
|
|
|
|
|
:type 'integer)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Footnotes
|
2012-08-15 16:00:20 -04:00
|
|
|
|
;;
|
|
|
|
|
;; Footnotes are inserted directly
|
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Timestamps
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defcustom org-texinfo-active-timestamp-format "@emph{%s}"
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"A printf format string to be applied to active timestamps."
|
2013-01-27 17:11:34 -05:00
|
|
|
|
:group 'org-export-texinfo
|
2012-08-15 16:00:20 -04:00
|
|
|
|
:type 'string)
|
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defcustom org-texinfo-inactive-timestamp-format "@emph{%s}"
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"A printf format string to be applied to inactive timestamps."
|
2013-01-27 17:11:34 -05:00
|
|
|
|
:group 'org-export-texinfo
|
2012-08-15 16:00:20 -04:00
|
|
|
|
:type 'string)
|
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defcustom org-texinfo-diary-timestamp-format "@emph{%s}"
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"A printf format string to be applied to diary timestamps."
|
2013-01-27 17:11:34 -05:00
|
|
|
|
:group 'org-export-texinfo
|
2012-08-15 16:00:20 -04:00
|
|
|
|
:type 'string)
|
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Links
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defcustom org-texinfo-link-with-unknown-path-format "@indicateurl{%s}"
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Format string for links with unknown path type."
|
2013-01-27 17:11:34 -05:00
|
|
|
|
:group 'org-export-texinfo
|
2012-08-15 16:00:20 -04:00
|
|
|
|
:type 'string)
|
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Tables
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defcustom org-texinfo-tables-verbatim nil
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"When non-nil, tables are exported verbatim."
|
2013-01-27 17:11:34 -05:00
|
|
|
|
:group 'org-export-texinfo
|
2012-08-15 16:00:20 -04:00
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defcustom org-texinfo-table-scientific-notation "%s\\,(%s)"
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Format string to display numbers in scientific notation.
|
|
|
|
|
The format should have \"%s\" twice, for mantissa and exponent
|
|
|
|
|
\(i.e. \"%s\\\\times10^{%s}\").
|
|
|
|
|
|
|
|
|
|
When nil, no transformation is made."
|
2013-01-27 17:11:34 -05:00
|
|
|
|
:group 'org-export-texinfo
|
2012-08-15 16:00:20 -04:00
|
|
|
|
:type '(choice
|
|
|
|
|
(string :tag "Format string")
|
|
|
|
|
(const :tag "No formatting")))
|
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defcustom org-texinfo-def-table-markup "@samp"
|
2013-12-30 04:13:57 -05:00
|
|
|
|
"Default setting for @table environments."
|
|
|
|
|
:group 'org-export-texinfo
|
|
|
|
|
:type 'string)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Text markup
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defcustom org-texinfo-text-markup-alist '((bold . "@strong{%s}")
|
|
|
|
|
(code . code)
|
|
|
|
|
(italic . "@emph{%s}")
|
|
|
|
|
(verbatim . verb)
|
|
|
|
|
(comment . "@c %s"))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Alist of Texinfo expressions to convert text markup.
|
|
|
|
|
|
|
|
|
|
The key must be a symbol among `bold', `italic' and `comment'.
|
|
|
|
|
The value is a formatting string to wrap fontified text with.
|
|
|
|
|
|
|
|
|
|
Value can also be set to the following symbols: `verb' and
|
|
|
|
|
`code'. For the former, Org will use \"@verb\" to
|
|
|
|
|
create a format string and select a delimiter character that
|
|
|
|
|
isn't in the string. For the latter, Org will use \"@code\"
|
|
|
|
|
to typeset and try to protect special characters.
|
|
|
|
|
|
|
|
|
|
If no association can be found for a given markup, text will be
|
|
|
|
|
returned as-is."
|
2013-01-27 17:11:34 -05:00
|
|
|
|
:group 'org-export-texinfo
|
2012-08-15 16:00:20 -04:00
|
|
|
|
:type 'alist
|
|
|
|
|
:options '(bold code italic verbatim comment))
|
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Drawers
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-11-14 08:05:18 -05:00
|
|
|
|
(defcustom org-texinfo-format-drawer-function
|
|
|
|
|
(lambda (name contents) contents)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Function called to format a drawer in Texinfo code.
|
|
|
|
|
|
|
|
|
|
The function must accept two parameters:
|
|
|
|
|
NAME the drawer name, like \"LOGBOOK\"
|
|
|
|
|
CONTENTS the contents of the drawer.
|
|
|
|
|
|
|
|
|
|
The function should return the string to be exported.
|
|
|
|
|
|
2013-11-14 08:05:18 -05:00
|
|
|
|
The default function simply returns the value of CONTENTS."
|
2013-01-27 17:11:34 -05:00
|
|
|
|
:group 'org-export-texinfo
|
2013-11-14 08:05:18 -05:00
|
|
|
|
:version "24.4"
|
|
|
|
|
:package-version '(Org . "8.3")
|
2012-08-15 16:00:20 -04:00
|
|
|
|
:type 'function)
|
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Inlinetasks
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-11-14 08:05:18 -05:00
|
|
|
|
(defcustom org-texinfo-format-inlinetask-function 'ignore
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Function called to format an inlinetask in Texinfo code.
|
|
|
|
|
|
|
|
|
|
The function must accept six parameters:
|
|
|
|
|
TODO the todo keyword, as a string
|
|
|
|
|
TODO-TYPE the todo type, a symbol among `todo', `done' and nil.
|
|
|
|
|
PRIORITY the inlinetask priority, as a string
|
|
|
|
|
NAME the inlinetask name, as a string.
|
|
|
|
|
TAGS the inlinetask tags, as a list of strings.
|
|
|
|
|
CONTENTS the contents of the inlinetask, as a string.
|
|
|
|
|
|
|
|
|
|
The function should return the string to be exported.
|
|
|
|
|
|
|
|
|
|
For example, the variable could be set to the following function
|
|
|
|
|
in order to mimic default behaviour:
|
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
\(defun org-texinfo-format-inlinetask \(todo type priority name tags contents\)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
\"Format an inline task element for Texinfo export.\"
|
|
|
|
|
\(let ((full-title
|
|
|
|
|
\(concat
|
|
|
|
|
\(when todo
|
|
|
|
|
\(format \"@strong{%s} \" todo))
|
|
|
|
|
\(when priority (format \"#%c \" priority))
|
|
|
|
|
title
|
|
|
|
|
\(when tags
|
|
|
|
|
\(format \":%s:\"
|
|
|
|
|
\(mapconcat 'identity tags \":\")))))
|
|
|
|
|
\(format (concat \"@center %s\n\n\"
|
|
|
|
|
\"%s\"
|
|
|
|
|
\"\n\"))
|
|
|
|
|
full-title contents))"
|
2013-01-27 17:11:34 -05:00
|
|
|
|
:group 'org-export-texinfo
|
2012-08-15 16:00:20 -04:00
|
|
|
|
:type 'function)
|
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Src blocks
|
2012-08-15 16:00:20 -04:00
|
|
|
|
;;
|
|
|
|
|
;; Src Blocks are example blocks, except for LISP
|
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Compilation
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defcustom org-texinfo-info-process
|
2012-08-15 16:00:20 -04:00
|
|
|
|
'("makeinfo %f")
|
2013-03-19 05:01:42 -04:00
|
|
|
|
"Commands to process a Texinfo file to an INFO file.
|
2012-08-15 16:00:20 -04:00
|
|
|
|
This is list of strings, each of them will be given to the shell
|
|
|
|
|
as a command. %f in the command will be replaced by the full
|
|
|
|
|
file name, %b by the file base name \(i.e without extension) and
|
|
|
|
|
%o by the base directory of the file."
|
|
|
|
|
:group 'org-export-texinfo
|
|
|
|
|
:type '(repeat :tag "Shell command sequence"
|
|
|
|
|
(string :tag "Shell command")))
|
|
|
|
|
|
2013-03-19 05:31:23 -04:00
|
|
|
|
(defcustom org-texinfo-logfiles-extensions
|
|
|
|
|
'("aux" "toc" "cp" "fn" "ky" "pg" "tp" "vr")
|
|
|
|
|
"The list of file extensions to consider as Texinfo logfiles.
|
|
|
|
|
The logfiles will be remove if `org-texinfo-remove-logfiles' is
|
|
|
|
|
non-nil."
|
|
|
|
|
:group 'org-export-texinfo
|
|
|
|
|
:type '(repeat (string :tag "Extension")))
|
|
|
|
|
|
|
|
|
|
(defcustom org-texinfo-remove-logfiles t
|
|
|
|
|
"Non-nil means remove the logfiles produced by compiling a Texinfo file.
|
|
|
|
|
By default, logfiles are files with these extensions: .aux, .toc,
|
|
|
|
|
.cp, .fn, .ky, .pg and .tp. To define the set of logfiles to remove,
|
|
|
|
|
set `org-texinfo-logfiles-extensions'."
|
|
|
|
|
:group 'org-export-latex
|
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
|
|
|
|
|
2013-02-14 11:59:03 -05:00
|
|
|
|
;;; Constants
|
|
|
|
|
(defconst org-texinfo-max-toc-depth 4
|
|
|
|
|
"Maximum depth for creation of detailed menu listings. Beyond
|
2013-03-19 05:01:42 -04:00
|
|
|
|
this depth Texinfo will not recognize the nodes and will cause
|
2013-02-14 11:59:03 -05:00
|
|
|
|
errors. Left as a constant in case this value ever changes.")
|
|
|
|
|
|
2013-11-11 04:09:21 -05:00
|
|
|
|
(defconst org-texinfo-supported-coding-systems
|
|
|
|
|
'("US-ASCII" "UTF-8" "ISO-8859-15" "ISO-8859-1" "ISO-8859-2" "koi8-r" "koi8-u")
|
|
|
|
|
"List of coding systems supported by Texinfo, as strings.
|
|
|
|
|
Specified coding system will be matched against these strings.
|
|
|
|
|
If two strings share the same prefix (e.g. \"ISO-8859-1\" and
|
|
|
|
|
\"ISO-8859-15\"), the most specific one has to be listed first.")
|
|
|
|
|
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
|
|
|
|
;;; Internal Functions
|
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-filter-section-blank-lines (headline back-end info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Filter controlling number of blank lines after a section."
|
2012-08-24 04:41:41 -04:00
|
|
|
|
(let ((blanks (make-string 2 ?\n)))
|
|
|
|
|
(replace-regexp-in-string "\n\\(?:\n[ \t]*\\)*\\'" blanks headline)))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo--find-verb-separator (s)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Return a character not used in string S.
|
|
|
|
|
This is used to choose a separator for constructs like \\verb."
|
|
|
|
|
(let ((ll "~,./?;':\"|!@#%^&-_=+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ<>()[]{}"))
|
|
|
|
|
(loop for c across ll
|
|
|
|
|
when (not (string-match (regexp-quote (char-to-string c)) s))
|
|
|
|
|
return (char-to-string c))))
|
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo--make-option-string (options)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Return a comma separated string of keywords and values.
|
|
|
|
|
OPTIONS is an alist where the key is the options keyword as
|
|
|
|
|
a string, and the value a list containing the keyword value, or
|
|
|
|
|
nil."
|
|
|
|
|
(mapconcat (lambda (pair)
|
|
|
|
|
(concat (first pair)
|
|
|
|
|
(when (> (length (second pair)) 0)
|
|
|
|
|
(concat "=" (second pair)))))
|
|
|
|
|
options
|
|
|
|
|
","))
|
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo--text-markup (text markup)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Format TEXT depending on MARKUP text markup.
|
2013-01-27 17:11:34 -05:00
|
|
|
|
See `org-texinfo-text-markup-alist' for details."
|
|
|
|
|
(let ((fmt (cdr (assq markup org-texinfo-text-markup-alist))))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
(cond
|
|
|
|
|
;; No format string: Return raw text.
|
|
|
|
|
((not fmt) text)
|
|
|
|
|
((eq 'verb fmt)
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(let ((separator (org-texinfo--find-verb-separator text)))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
(concat "@verb{" separator text separator "}")))
|
|
|
|
|
((eq 'code fmt)
|
|
|
|
|
(let ((start 0)
|
|
|
|
|
(rtn "")
|
|
|
|
|
char)
|
|
|
|
|
(while (string-match "[@{}]" text)
|
|
|
|
|
(setq char (match-string 0 text))
|
|
|
|
|
(if (> (match-beginning 0) 0)
|
|
|
|
|
(setq rtn (concat rtn (substring text 0 (match-beginning 0)))))
|
|
|
|
|
(setq text (substring text (1+ (match-beginning 0))))
|
|
|
|
|
(setq char (concat "@" char)
|
|
|
|
|
rtn (concat rtn char)))
|
|
|
|
|
(setq text (concat rtn text)
|
|
|
|
|
fmt "@code{%s}")
|
|
|
|
|
(format fmt text)))
|
|
|
|
|
;; Else use format string.
|
|
|
|
|
(t (format fmt text)))))
|
|
|
|
|
|
2013-02-20 11:05:35 -05:00
|
|
|
|
(defun org-texinfo--get-node (headline info)
|
|
|
|
|
"Return node entry associated to HEADLINE.
|
|
|
|
|
INFO is a plist used as a communication channel."
|
2013-02-26 18:00:33 -05:00
|
|
|
|
(let ((menu-title (org-export-get-alt-title headline info)))
|
2013-02-20 11:05:35 -05:00
|
|
|
|
(org-texinfo--sanitize-menu
|
|
|
|
|
(replace-regexp-in-string
|
|
|
|
|
"%" "%%"
|
|
|
|
|
(if menu-title (org-export-data menu-title info)
|
|
|
|
|
(org-texinfo--sanitize-headline
|
|
|
|
|
(org-element-property :title headline) info))))))
|
|
|
|
|
|
2012-08-23 09:20:02 -04:00
|
|
|
|
;;; Headline sanitizing
|
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo--sanitize-headline (headline info)
|
2012-08-23 09:20:02 -04:00
|
|
|
|
"Remove all formatting from the text of a headline for use in
|
|
|
|
|
node and menu listing."
|
|
|
|
|
(mapconcat 'identity
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(org-texinfo--sanitize-headline-contents headline info) " "))
|
2012-08-23 09:20:02 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo--sanitize-headline-contents (headline info)
|
2012-08-23 09:20:02 -04:00
|
|
|
|
"Retrieve the content of the headline.
|
|
|
|
|
|
|
|
|
|
Any content that can contain further formatting is checked
|
|
|
|
|
recursively, to ensure that nested content is also properly
|
|
|
|
|
retrieved."
|
|
|
|
|
(loop for contents in headline append
|
|
|
|
|
(cond
|
|
|
|
|
;; already a string
|
|
|
|
|
((stringp contents)
|
|
|
|
|
(list (replace-regexp-in-string " $" "" contents)))
|
|
|
|
|
;; Is exported as-is (value)
|
|
|
|
|
((org-element-map contents '(verbatim code)
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(lambda (value) (org-element-property :value value)) info))
|
2012-08-23 09:20:02 -04:00
|
|
|
|
;; Has content and recurse into the content
|
|
|
|
|
((org-element-contents contents)
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(org-texinfo--sanitize-headline-contents
|
2012-08-23 09:20:02 -04:00
|
|
|
|
(org-element-contents contents) info)))))
|
|
|
|
|
|
2012-08-23 10:50:24 -04:00
|
|
|
|
;;; Menu sanitizing
|
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo--sanitize-menu (title)
|
2012-08-23 10:50:24 -04:00
|
|
|
|
"Remove invalid characters from TITLE for use in menus and
|
|
|
|
|
nodes.
|
|
|
|
|
|
2013-03-19 05:01:42 -04:00
|
|
|
|
Based on Texinfo specifications, the following must be removed:
|
2012-08-23 10:50:24 -04:00
|
|
|
|
@ { } ( ) : . ,"
|
|
|
|
|
(replace-regexp-in-string "[@{}():,.]" "" title))
|
|
|
|
|
|
|
|
|
|
;;; Content sanitizing
|
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo--sanitize-content (text)
|
2012-08-23 10:50:24 -04:00
|
|
|
|
"Ensure characters are properly escaped when used in headlines or blocks.
|
|
|
|
|
|
|
|
|
|
Escape characters are: @ { }"
|
|
|
|
|
(replace-regexp-in-string "\\\([@{}]\\\)" "@\\1" text))
|
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Menu creation
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo--build-menu (tree level info &optional detailed)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Create the @menu/@end menu information from TREE at headline
|
|
|
|
|
level LEVEL.
|
|
|
|
|
|
|
|
|
|
TREE contains the parse-tree to work with, either of the entire
|
|
|
|
|
document or of a specific parent headline. LEVEL indicates what
|
|
|
|
|
level of headlines to look at when generating the menu. INFO is
|
|
|
|
|
a plist containing contextual information.
|
|
|
|
|
|
|
|
|
|
Detailed determines whether to build a single level of menu, or
|
|
|
|
|
recurse into all children as well."
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(let ((menu (org-texinfo--generate-menu-list tree level info))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
output text-menu)
|
|
|
|
|
(cond
|
|
|
|
|
(detailed
|
|
|
|
|
;; Looping is done within the menu generation.
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(setq text-menu (org-texinfo--generate-detailed menu level info)))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
(t
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(setq text-menu (org-texinfo--generate-menu-items menu info))))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
(when text-menu
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(setq output (org-texinfo--format-menu text-menu))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
(mapconcat 'identity output "\n"))))
|
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo--generate-detailed (menu level info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Generate a detailed listing of all subheadings within MENU starting at LEVEL.
|
|
|
|
|
|
|
|
|
|
MENU is the parse-tree to work with. LEVEL is the starting level
|
|
|
|
|
for the menu headlines and from which recursion occurs. INFO is
|
|
|
|
|
a plist containing contextual information."
|
2012-08-22 11:06:07 -04:00
|
|
|
|
(when level
|
2013-02-14 11:59:03 -05:00
|
|
|
|
(let ((max-depth (min org-texinfo-max-toc-depth
|
|
|
|
|
(plist-get info :headline-levels))))
|
2012-08-22 11:06:07 -04:00
|
|
|
|
(when (> max-depth level)
|
|
|
|
|
(loop for headline in menu append
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(let* ((title (org-texinfo--menu-headlines headline info))
|
2012-08-22 11:06:07 -04:00
|
|
|
|
;; Create list of menu entries for the next level
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(sublist (org-texinfo--generate-menu-list
|
2012-08-22 11:06:07 -04:00
|
|
|
|
headline (1+ level) info))
|
|
|
|
|
;; Generate the menu items for that level. If
|
|
|
|
|
;; there are none omit that heading completely,
|
|
|
|
|
;; otherwise join the title to it's related entries.
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(submenu (if (org-texinfo--generate-menu-items sublist info)
|
2012-08-22 11:06:07 -04:00
|
|
|
|
(append (list title)
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(org-texinfo--generate-menu-items sublist info))
|
2012-08-22 11:06:07 -04:00
|
|
|
|
'nil))
|
|
|
|
|
;; Start the process over the next level down.
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(recursion (org-texinfo--generate-detailed sublist (1+ level) info)))
|
2012-08-22 11:06:07 -04:00
|
|
|
|
(setq recursion (append submenu recursion))
|
|
|
|
|
recursion))))))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo--generate-menu-list (tree level info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Generate the list of headlines that are within a given level
|
|
|
|
|
of the tree for further formatting.
|
|
|
|
|
|
|
|
|
|
TREE is the parse-tree containing the headlines. LEVEL is the
|
|
|
|
|
headline level to generate a list of. INFO is a plist holding
|
|
|
|
|
contextual information."
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(org-element-map tree 'headline
|
|
|
|
|
(lambda (head)
|
|
|
|
|
(and (= (org-export-get-relative-level head info) level)
|
|
|
|
|
;; Do not take note of footnotes or copying headlines.
|
export-back-ends: Apply changes from b692064e621acbc93876670585f8a4b0fd6a7ffa
* lisp/ox-beamer.el (org-beamer--get-label, org-beamer--frame-level,
org-beamer--format-section, org-beamer--format-frame,
org-beamer--format-block, org-beamer-headline): Apply changes to
properties.
* lisp/ox-html.el (org-html-headline, org-html-link,
org-html-section): Apply changes to properties.
* lisp/ox-icalendar.el (org-icalendar-create-uid,
org-icalendar-blocked-headline-p, org-icalendar-entry,
org-icalendar--valarm): Apply changes to properties.
* lisp/ox-odt.el (org-odt-headline): Apply changes
* lisp/ox-publish.el (org-publish-collect-index): Apply changes to
properties.
* lisp/ox-texinfo.el (org-texinfo--generate-menu-list,
org-texinfo--generate-menu-items, org-texinfo-template,
org-texinfo-headline, org-texinfo-link): Apply changes to
properties.
* lisp/ox.el (org-export-resolve-id-link, org-export-get-category):
Apply changes to properties.
(org-export-get-node-property): Update docstring.
* testing/lisp/test-ox.el: Update tests.
2013-02-17 18:01:21 -05:00
|
|
|
|
(not (org-element-property :COPYING head))
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(not (org-element-property :footnote-section-p head))
|
|
|
|
|
;; Collect headline.
|
|
|
|
|
head))
|
|
|
|
|
info))
|
|
|
|
|
|
|
|
|
|
(defun org-texinfo--generate-menu-items (items info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Generate a list of headline information from the listing ITEMS.
|
|
|
|
|
|
|
|
|
|
ITEMS is a list of the headlines to be converted into entries.
|
|
|
|
|
INFO is a plist containing contextual information.
|
|
|
|
|
|
|
|
|
|
Returns a list containing the following information from each
|
|
|
|
|
headline: length, title, description. This is used to format the
|
2013-01-27 17:11:34 -05:00
|
|
|
|
menu using `org-texinfo--format-menu'."
|
2012-08-15 16:00:20 -04:00
|
|
|
|
(loop for headline in items collect
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(let* ((menu-title (org-texinfo--sanitize-menu
|
2012-11-21 11:15:33 -05:00
|
|
|
|
(org-export-data
|
2013-02-26 18:00:33 -05:00
|
|
|
|
(org-export-get-alt-title headline info)
|
2012-11-21 11:15:33 -05:00
|
|
|
|
info)))
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(title (org-texinfo--sanitize-menu
|
|
|
|
|
(org-texinfo--sanitize-headline
|
2012-08-23 10:50:24 -04:00
|
|
|
|
(org-element-property :title headline) info)))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
(descr (org-export-data
|
export-back-ends: Apply changes from b692064e621acbc93876670585f8a4b0fd6a7ffa
* lisp/ox-beamer.el (org-beamer--get-label, org-beamer--frame-level,
org-beamer--format-section, org-beamer--format-frame,
org-beamer--format-block, org-beamer-headline): Apply changes to
properties.
* lisp/ox-html.el (org-html-headline, org-html-link,
org-html-section): Apply changes to properties.
* lisp/ox-icalendar.el (org-icalendar-create-uid,
org-icalendar-blocked-headline-p, org-icalendar-entry,
org-icalendar--valarm): Apply changes to properties.
* lisp/ox-odt.el (org-odt-headline): Apply changes
* lisp/ox-publish.el (org-publish-collect-index): Apply changes to
properties.
* lisp/ox-texinfo.el (org-texinfo--generate-menu-list,
org-texinfo--generate-menu-items, org-texinfo-template,
org-texinfo-headline, org-texinfo-link): Apply changes to
properties.
* lisp/ox.el (org-export-resolve-id-link, org-export-get-category):
Apply changes to properties.
(org-export-get-node-property): Update docstring.
* testing/lisp/test-ox.el: Update tests.
2013-02-17 18:01:21 -05:00
|
|
|
|
(org-element-property :DESCRIPTION headline)
|
2012-11-21 11:15:33 -05:00
|
|
|
|
info))
|
|
|
|
|
(menu-entry (if (string= "" menu-title) title menu-title))
|
|
|
|
|
(len (length menu-entry))
|
|
|
|
|
(output (list len menu-entry descr)))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
output)))
|
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo--menu-headlines (headline info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Retrieve the title from HEADLINE.
|
|
|
|
|
|
|
|
|
|
INFO is a plist holding contextual information.
|
|
|
|
|
|
|
|
|
|
Return the headline as a list of (length title description) with
|
|
|
|
|
length of -1 and nil description. This is used in
|
2013-01-27 17:11:34 -05:00
|
|
|
|
`org-texinfo--format-menu' to identify headlines as opposed to
|
2012-08-15 16:00:20 -04:00
|
|
|
|
entries."
|
|
|
|
|
(let ((title (org-export-data
|
|
|
|
|
(org-element-property :title headline) info)))
|
|
|
|
|
(list -1 title 'nil)))
|
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo--format-menu (text-menu)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Format the TEXT-MENU items to be properly printed in the menu.
|
|
|
|
|
|
|
|
|
|
Each entry in the menu should be provided as (length title
|
|
|
|
|
description).
|
|
|
|
|
|
|
|
|
|
Headlines in the detailed menu are given length -1 to ensure they
|
|
|
|
|
are never confused with other entries. They also have no
|
|
|
|
|
description.
|
|
|
|
|
|
|
|
|
|
Other menu items are output as:
|
|
|
|
|
Title:: description
|
|
|
|
|
|
|
|
|
|
With the spacing between :: and description based on the length
|
|
|
|
|
of the longest menu entry."
|
|
|
|
|
|
2013-02-25 10:44:18 -05:00
|
|
|
|
(let (output)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
(setq output
|
|
|
|
|
(mapcar (lambda (name)
|
2013-02-25 10:44:18 -05:00
|
|
|
|
(let* ((title (nth 1 name))
|
|
|
|
|
(desc (nth 2 name))
|
|
|
|
|
(length (nth 0 name))
|
|
|
|
|
(column (max
|
2013-02-25 12:25:45 -05:00
|
|
|
|
;;6 is "* " ":: " for inserted text
|
2013-02-25 10:44:18 -05:00
|
|
|
|
length
|
2013-02-25 12:25:45 -05:00
|
|
|
|
(-
|
|
|
|
|
org-texinfo-node-description-column
|
|
|
|
|
6)))
|
2013-02-25 10:44:18 -05:00
|
|
|
|
(spacing (- column length)
|
|
|
|
|
))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
(if (> length -1)
|
2013-02-25 12:25:45 -05:00
|
|
|
|
(concat "* " title ":: "
|
2013-02-25 10:44:18 -05:00
|
|
|
|
(make-string spacing ?\s)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
(if desc
|
|
|
|
|
(concat desc)))
|
|
|
|
|
(concat "\n" title "\n"))))
|
|
|
|
|
text-menu))
|
|
|
|
|
output))
|
|
|
|
|
|
|
|
|
|
;;; Template
|
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-template (contents info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Return complete document string after Texinfo conversion.
|
|
|
|
|
CONTENTS is the transcoded contents string. INFO is a plist
|
|
|
|
|
holding export options."
|
|
|
|
|
(let* ((title (org-export-data (plist-get info :title) info))
|
|
|
|
|
(info-filename (or (plist-get info :texinfo-filename)
|
|
|
|
|
(file-name-nondirectory
|
|
|
|
|
(org-export-output-file-name ".info"))))
|
|
|
|
|
(author (org-export-data (plist-get info :author) info))
|
2013-03-19 05:24:30 -04:00
|
|
|
|
(lang (org-export-data (plist-get info :language) info))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
(texinfo-header (plist-get info :texinfo-header))
|
2012-12-04 09:19:43 -05:00
|
|
|
|
(texinfo-post-header (plist-get info :texinfo-post-header))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
(subtitle (plist-get info :subtitle))
|
|
|
|
|
(subauthor (plist-get info :subauthor))
|
|
|
|
|
(class (plist-get info :texinfo-class))
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(header (nth 1 (assoc class org-texinfo-classes)))
|
|
|
|
|
(copying
|
|
|
|
|
(org-element-map (plist-get info :parse-tree) 'headline
|
export-back-ends: Apply changes from b692064e621acbc93876670585f8a4b0fd6a7ffa
* lisp/ox-beamer.el (org-beamer--get-label, org-beamer--frame-level,
org-beamer--format-section, org-beamer--format-frame,
org-beamer--format-block, org-beamer-headline): Apply changes to
properties.
* lisp/ox-html.el (org-html-headline, org-html-link,
org-html-section): Apply changes to properties.
* lisp/ox-icalendar.el (org-icalendar-create-uid,
org-icalendar-blocked-headline-p, org-icalendar-entry,
org-icalendar--valarm): Apply changes to properties.
* lisp/ox-odt.el (org-odt-headline): Apply changes
* lisp/ox-publish.el (org-publish-collect-index): Apply changes to
properties.
* lisp/ox-texinfo.el (org-texinfo--generate-menu-list,
org-texinfo--generate-menu-items, org-texinfo-template,
org-texinfo-headline, org-texinfo-link): Apply changes to
properties.
* lisp/ox.el (org-export-resolve-id-link, org-export-get-category):
Apply changes to properties.
(org-export-get-node-property): Update docstring.
* testing/lisp/test-ox.el: Update tests.
2013-02-17 18:01:21 -05:00
|
|
|
|
(lambda (hl) (and (org-element-property :COPYING hl) hl)) info t))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
(dircat (plist-get info :texinfo-dircat))
|
|
|
|
|
(dirtitle (plist-get info :texinfo-dirtitle))
|
|
|
|
|
(dirdesc (plist-get info :texinfo-dirdesc))
|
|
|
|
|
;; Spacing to align description (column 32 - 3 for `* ' and
|
|
|
|
|
;; `.' in text.
|
2012-08-22 11:06:07 -04:00
|
|
|
|
(dirspacing (- 29 (length dirtitle)))
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(menu (org-texinfo-make-menu info 'main))
|
2013-11-11 04:09:21 -05:00
|
|
|
|
(detail-menu (org-texinfo-make-menu info 'detailed)))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
(concat
|
|
|
|
|
;; Header
|
|
|
|
|
header "\n"
|
|
|
|
|
"@c %**start of header\n"
|
|
|
|
|
;; Filename and Title
|
|
|
|
|
"@setfilename " info-filename "\n"
|
|
|
|
|
"@settitle " title "\n"
|
2013-11-11 04:09:21 -05:00
|
|
|
|
;; Coding system.
|
|
|
|
|
(format
|
|
|
|
|
"@documentencoding %s\n"
|
|
|
|
|
(catch 'coding-system
|
|
|
|
|
(let ((case-fold-search t)
|
|
|
|
|
(name (symbol-name (or org-texinfo-coding-system
|
|
|
|
|
buffer-file-coding-system))))
|
|
|
|
|
(dolist (system org-texinfo-supported-coding-systems "UTF-8")
|
|
|
|
|
(when (org-string-match-p (regexp-quote system) name)
|
|
|
|
|
(throw 'coding-system system))))))
|
|
|
|
|
"\n"
|
2013-03-19 05:24:30 -04:00
|
|
|
|
(format "@documentlanguage %s\n" lang)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"\n\n"
|
|
|
|
|
"@c Version and Contact Info\n"
|
|
|
|
|
"@set AUTHOR " author "\n"
|
|
|
|
|
|
|
|
|
|
;; Additional Header Options set by `#+TEXINFO_HEADER
|
|
|
|
|
(if texinfo-header
|
|
|
|
|
(concat "\n"
|
|
|
|
|
texinfo-header
|
|
|
|
|
"\n"))
|
2012-08-15 18:00:51 -04:00
|
|
|
|
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"@c %**end of header\n"
|
|
|
|
|
"@finalout\n"
|
|
|
|
|
"\n\n"
|
|
|
|
|
|
2012-12-04 09:19:43 -05:00
|
|
|
|
;; Additional Header Options set by #+TEXINFO_POST_HEADER
|
|
|
|
|
(if texinfo-post-header
|
|
|
|
|
(concat "\n"
|
|
|
|
|
texinfo-post-header
|
|
|
|
|
"\n"))
|
|
|
|
|
|
2012-08-15 16:00:20 -04:00
|
|
|
|
;; Copying
|
|
|
|
|
"@copying\n"
|
|
|
|
|
;; Only export the content of the headline, do not need the
|
|
|
|
|
;; initial headline.
|
|
|
|
|
(org-export-data (nth 2 copying) info)
|
|
|
|
|
"@end copying\n"
|
|
|
|
|
"\n\n"
|
|
|
|
|
|
|
|
|
|
;; Info directory information
|
|
|
|
|
;; Only supply if both title and category are provided
|
|
|
|
|
(if (and dircat dirtitle)
|
|
|
|
|
(concat "@dircategory " dircat "\n"
|
|
|
|
|
"@direntry\n"
|
|
|
|
|
"* " dirtitle "."
|
|
|
|
|
(make-string dirspacing ?\s)
|
|
|
|
|
dirdesc "\n"
|
|
|
|
|
"@end direntry\n"))
|
|
|
|
|
"\n\n"
|
|
|
|
|
|
|
|
|
|
;; Title
|
|
|
|
|
"@titlepage\n"
|
|
|
|
|
"@title " title "\n\n"
|
|
|
|
|
(if subtitle
|
|
|
|
|
(concat "@subtitle " subtitle "\n"))
|
|
|
|
|
"@author " author "\n"
|
|
|
|
|
(if subauthor
|
|
|
|
|
(concat subauthor "\n"))
|
|
|
|
|
"\n"
|
|
|
|
|
"@c The following two commands start the copyright page.\n"
|
|
|
|
|
"@page\n"
|
|
|
|
|
"@vskip 0pt plus 1filll\n"
|
|
|
|
|
"@insertcopying\n"
|
|
|
|
|
"@end titlepage\n\n"
|
|
|
|
|
"@c Output the table of contents at the beginning.\n"
|
|
|
|
|
"@contents\n\n"
|
|
|
|
|
|
|
|
|
|
;; Configure Top Node when not for Tex
|
|
|
|
|
"@ifnottex\n"
|
|
|
|
|
"@node Top\n"
|
|
|
|
|
"@top " title " Manual\n"
|
|
|
|
|
"@insertcopying\n"
|
|
|
|
|
"@end ifnottex\n\n"
|
2012-08-15 18:00:51 -04:00
|
|
|
|
|
2012-08-22 11:06:07 -04:00
|
|
|
|
;; Do not output menus if they are empty
|
|
|
|
|
(if menu
|
|
|
|
|
;; Menu
|
|
|
|
|
(concat "@menu\n"
|
|
|
|
|
menu
|
|
|
|
|
"\n\n"
|
|
|
|
|
;; Detailed Menu
|
|
|
|
|
(if detail-menu
|
|
|
|
|
(concat "@detailmenu\n"
|
|
|
|
|
" --- The Detailed Node Listing ---\n"
|
|
|
|
|
detail-menu
|
|
|
|
|
"\n\n"
|
|
|
|
|
"@end detailmenu\n"))
|
2012-08-24 05:21:24 -04:00
|
|
|
|
"@end menu\n"))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"\n\n"
|
2012-08-15 18:00:51 -04:00
|
|
|
|
|
2012-08-15 16:00:20 -04:00
|
|
|
|
;; Document's body.
|
|
|
|
|
contents
|
|
|
|
|
"\n"
|
|
|
|
|
;; Creator.
|
|
|
|
|
(let ((creator-info (plist-get info :with-creator)))
|
|
|
|
|
(cond
|
|
|
|
|
((not creator-info) "")
|
|
|
|
|
((eq creator-info 'comment)
|
|
|
|
|
(format "@c %s\n" (plist-get info :creator)))
|
|
|
|
|
(t (concat (plist-get info :creator) "\n"))))
|
|
|
|
|
;; Document end.
|
|
|
|
|
"\n@bye")))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Transcode Functions
|
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Bold
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-bold (bold contents info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Transcode BOLD from Org to Texinfo.
|
|
|
|
|
CONTENTS is the text with bold markup. INFO is a plist holding
|
|
|
|
|
contextual information."
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(org-texinfo--text-markup contents 'bold))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Center Block
|
2012-10-26 18:36:00 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-center-block (center-block contents info)
|
2012-10-26 18:36:00 -04:00
|
|
|
|
"Transcode a CENTER-BLOCK element from Org to Texinfo.
|
|
|
|
|
CONTENTS holds the contents of the block. INFO is a plist used
|
|
|
|
|
as a communication channel."
|
|
|
|
|
contents)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Clock
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-clock (clock contents info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Transcode a CLOCK element from Org to Texinfo.
|
|
|
|
|
CONTENTS is nil. INFO is a plist holding contextual
|
|
|
|
|
information."
|
|
|
|
|
(concat
|
|
|
|
|
"@noindent"
|
|
|
|
|
(format "@strong{%s} " org-clock-string)
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(format org-texinfo-inactive-timestamp-format
|
2012-10-30 16:59:50 -04:00
|
|
|
|
(concat (org-translate-time
|
|
|
|
|
(org-element-property :raw-value
|
|
|
|
|
(org-element-property :value clock)))
|
|
|
|
|
(let ((time (org-element-property :duration clock)))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
(and time (format " (%s)" time)))))
|
|
|
|
|
"@*"))
|
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Code
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-code (code contents info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Transcode a CODE object from Org to Texinfo.
|
|
|
|
|
CONTENTS is nil. INFO is a plist used as a communication
|
|
|
|
|
channel."
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(org-texinfo--text-markup (org-element-property :value code) 'code))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Comment
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-comment (comment contents info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Transcode a COMMENT object from Org to Texinfo.
|
|
|
|
|
CONTENTS is the text in the comment. INFO is a plist holding
|
|
|
|
|
contextual information."
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(org-texinfo--text-markup (org-element-property :value comment) 'comment))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Comment Block
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-comment-block (comment-block contents info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Transcode a COMMENT-BLOCK object from Org to Texinfo.
|
|
|
|
|
CONTENTS is the text within the block. INFO is a plist holding
|
|
|
|
|
contextual information."
|
|
|
|
|
(format "@ignore\n%s@end ignore" (org-element-property :value comment-block)))
|
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Drawer
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-drawer (drawer contents info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Transcode a DRAWER element from Org to Texinfo.
|
|
|
|
|
CONTENTS holds the contents of the block. INFO is a plist
|
|
|
|
|
holding contextual information."
|
|
|
|
|
(let* ((name (org-element-property :drawer-name drawer))
|
2013-11-14 08:05:18 -05:00
|
|
|
|
(output (funcall org-texinfo-format-drawer-function
|
|
|
|
|
name contents)))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
output))
|
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Dynamic Block
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-dynamic-block (dynamic-block contents info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Transcode a DYNAMIC-BLOCK element from Org to Texinfo.
|
|
|
|
|
CONTENTS holds the contents of the block. INFO is a plist
|
|
|
|
|
holding contextual information. See `org-export-data'."
|
|
|
|
|
contents)
|
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Entity
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-entity (entity contents info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Transcode an ENTITY object from Org to Texinfo.
|
|
|
|
|
CONTENTS are the definition itself. INFO is a plist holding
|
|
|
|
|
contextual information."
|
|
|
|
|
(let ((ent (org-element-property :latex entity)))
|
|
|
|
|
(if (org-element-property :latex-math-p entity) (format "@math{%s}" ent) ent)))
|
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Example Block
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-example-block (example-block contents info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Transcode an EXAMPLE-BLOCK element from Org to Texinfo.
|
|
|
|
|
CONTENTS is nil. INFO is a plist holding contextual
|
|
|
|
|
information."
|
|
|
|
|
(format "@verbatim\n%s@end verbatim"
|
|
|
|
|
(org-export-format-code-default example-block info)))
|
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Export Block
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-export-block (export-block contents info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Transcode a EXPORT-BLOCK element from Org to Texinfo.
|
|
|
|
|
CONTENTS is nil. INFO is a plist holding contextual information."
|
|
|
|
|
(when (string= (org-element-property :type export-block) "TEXINFO")
|
|
|
|
|
(org-remove-indentation (org-element-property :value export-block))))
|
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Export Snippet
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-export-snippet (export-snippet contents info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Transcode a EXPORT-SNIPPET object from Org to Texinfo.
|
|
|
|
|
CONTENTS is nil. INFO is a plist holding contextual information."
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(when (eq (org-export-snippet-backend export-snippet) 'texinfo)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
(org-element-property :value export-snippet)))
|
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Fixed Width
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-fixed-width (fixed-width contents info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Transcode a FIXED-WIDTH element from Org to Texinfo.
|
|
|
|
|
CONTENTS is nil. INFO is a plist holding contextual information."
|
|
|
|
|
(format "@example\n%s\n@end example"
|
|
|
|
|
(org-remove-indentation
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(org-texinfo--sanitize-content
|
2012-08-23 10:50:24 -04:00
|
|
|
|
(org-element-property :value fixed-width)))))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Footnote Reference
|
2012-08-15 16:00:20 -04:00
|
|
|
|
;;
|
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-footnote-reference (footnote contents info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Create a footnote reference for FOOTNOTE.
|
|
|
|
|
|
|
|
|
|
FOOTNOTE is the footnote to define. CONTENTS is nil. INFO is a
|
|
|
|
|
plist holding contextual information."
|
|
|
|
|
(let ((def (org-export-get-footnote-definition footnote info)))
|
|
|
|
|
(format "@footnote{%s}"
|
|
|
|
|
(org-trim (org-export-data def info)))))
|
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Headline
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-headline (headline contents info)
|
2013-02-23 07:47:44 -05:00
|
|
|
|
"Transcode a HEADLINE element from Org to Texinfo.
|
2012-08-15 16:00:20 -04:00
|
|
|
|
CONTENTS holds the contents of the headline. INFO is a plist
|
|
|
|
|
holding contextual information."
|
|
|
|
|
(let* ((class (plist-get info :texinfo-class))
|
|
|
|
|
(level (org-export-get-relative-level headline info))
|
|
|
|
|
(numberedp (org-export-numbered-headline-p headline info))
|
2013-11-17 03:12:41 -05:00
|
|
|
|
(class-sectioning (assoc class org-texinfo-classes))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
;; Find the index type, if any
|
2013-02-25 10:04:37 -05:00
|
|
|
|
(index (org-element-property :INDEX headline))
|
2013-02-25 10:14:53 -05:00
|
|
|
|
;; Check if it is an appendix
|
|
|
|
|
(appendix (org-element-property :APPENDIX headline))
|
2012-08-23 09:20:02 -04:00
|
|
|
|
;; Retrieve headline text
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(text (org-texinfo--sanitize-headline
|
2012-08-23 09:20:02 -04:00
|
|
|
|
(org-element-property :title headline) info))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
;; Create node info, to insert it before section formatting.
|
2012-11-21 11:15:33 -05:00
|
|
|
|
;; Use custom menu title if present
|
2013-02-20 11:05:35 -05:00
|
|
|
|
(node (format "@node %s\n" (org-texinfo--get-node headline info)))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
;; Menus must be generated with first child, otherwise they
|
|
|
|
|
;; will not nest properly
|
|
|
|
|
(menu (let* ((first (org-export-first-sibling-p headline info))
|
|
|
|
|
(parent (org-export-get-parent-headline headline))
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(title (org-texinfo--sanitize-headline
|
2012-08-15 16:00:20 -04:00
|
|
|
|
(org-element-property :title parent) info))
|
|
|
|
|
heading listing
|
|
|
|
|
(tree (plist-get info :parse-tree)))
|
|
|
|
|
(if first
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(org-element-map (plist-get info :parse-tree) 'headline
|
|
|
|
|
(lambda (ref)
|
|
|
|
|
(if (member title (org-element-property :title ref))
|
|
|
|
|
(push ref heading)))
|
|
|
|
|
info t))
|
|
|
|
|
(setq listing (org-texinfo--build-menu
|
2012-08-15 16:00:20 -04:00
|
|
|
|
(car heading) level info))
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(if listing
|
|
|
|
|
(setq listing (replace-regexp-in-string
|
2012-08-23 09:20:02 -04:00
|
|
|
|
"%" "%%" listing)
|
|
|
|
|
listing (format
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"\n@menu\n%s\n@end menu\n\n" listing))
|
2013-01-27 17:11:34 -05:00
|
|
|
|
'nil)))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
;; Section formatting will set two placeholders: one for the
|
|
|
|
|
;; title and the other for the contents.
|
|
|
|
|
(section-fmt
|
2013-11-17 03:12:41 -05:00
|
|
|
|
(let ((sec (if (and (symbolp (nth 2 class-sectioning))
|
|
|
|
|
(fboundp (nth 2 class-sectioning)))
|
|
|
|
|
(funcall (nth 2 class-sectioning) level numberedp)
|
|
|
|
|
(nth (1+ level) class-sectioning))))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
(cond
|
|
|
|
|
;; No section available for that LEVEL.
|
|
|
|
|
((not sec) nil)
|
|
|
|
|
;; Section format directly returned by a function.
|
|
|
|
|
((stringp sec) sec)
|
|
|
|
|
;; (numbered-section . unnumbered-section)
|
|
|
|
|
((not (consp (cdr sec)))
|
2013-02-25 10:14:53 -05:00
|
|
|
|
(cond
|
|
|
|
|
;;If an index, always unnumbered
|
|
|
|
|
(index
|
|
|
|
|
(concat menu node (cdr sec) "\n%s"))
|
|
|
|
|
(appendix
|
|
|
|
|
(concat menu node (replace-regexp-in-string
|
|
|
|
|
"unnumbered"
|
|
|
|
|
"appendix"
|
|
|
|
|
(cdr sec)) "\n%s"))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
;; Otherwise number as needed.
|
2013-02-25 10:14:53 -05:00
|
|
|
|
(t
|
2012-08-15 16:00:20 -04:00
|
|
|
|
(concat menu node
|
|
|
|
|
(funcall
|
2013-02-25 10:14:53 -05:00
|
|
|
|
(if numberedp #'car #'cdr) sec) "\n%s")))))))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
(todo
|
|
|
|
|
(and (plist-get info :with-todo-keywords)
|
|
|
|
|
(let ((todo (org-element-property :todo-keyword headline)))
|
|
|
|
|
(and todo (org-export-data todo info)))))
|
|
|
|
|
(todo-type (and todo (org-element-property :todo-type headline)))
|
|
|
|
|
(tags (and (plist-get info :with-tags)
|
|
|
|
|
(org-export-get-tags headline info)))
|
|
|
|
|
(priority (and (plist-get info :with-priority)
|
|
|
|
|
(org-element-property :priority headline)))
|
|
|
|
|
;; Create the headline text along with a no-tag version. The
|
|
|
|
|
;; latter is required to remove tags from table of contents.
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(full-text (org-texinfo--sanitize-content
|
2013-11-14 08:05:18 -05:00
|
|
|
|
(if (not (eq org-texinfo-format-headline-function 'ignore))
|
2012-08-23 10:50:24 -04:00
|
|
|
|
;; User-defined formatting function.
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(funcall org-texinfo-format-headline-function
|
2012-08-23 10:50:24 -04:00
|
|
|
|
todo todo-type priority text tags)
|
|
|
|
|
;; Default formatting.
|
|
|
|
|
(concat
|
|
|
|
|
(when todo
|
|
|
|
|
(format "@strong{%s} " todo))
|
|
|
|
|
(when priority (format "@emph{#%s} " priority))
|
|
|
|
|
text
|
|
|
|
|
(when tags
|
2013-03-19 05:24:30 -04:00
|
|
|
|
(format " :%s:"
|
2012-08-23 10:50:24 -04:00
|
|
|
|
(mapconcat 'identity tags ":")))))))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
(full-text-no-tag
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(org-texinfo--sanitize-content
|
2013-11-14 08:05:18 -05:00
|
|
|
|
(if (not (eq org-texinfo-format-headline-function 'ignore))
|
2012-08-23 10:50:24 -04:00
|
|
|
|
;; User-defined formatting function.
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(funcall org-texinfo-format-headline-function
|
2012-08-23 10:50:24 -04:00
|
|
|
|
todo todo-type priority text nil)
|
|
|
|
|
;; Default formatting.
|
|
|
|
|
(concat
|
|
|
|
|
(when todo (format "@strong{%s} " todo))
|
|
|
|
|
(when priority (format "@emph{#%c} " priority))
|
|
|
|
|
text))))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
(pre-blanks
|
|
|
|
|
(make-string (org-element-property :pre-blank headline) 10)))
|
|
|
|
|
(cond
|
|
|
|
|
;; Case 1: This is a footnote section: ignore it.
|
|
|
|
|
((org-element-property :footnote-section-p headline) nil)
|
|
|
|
|
;; Case 2: This is the `copying' section: ignore it
|
|
|
|
|
;; This is used elsewhere.
|
export-back-ends: Apply changes from b692064e621acbc93876670585f8a4b0fd6a7ffa
* lisp/ox-beamer.el (org-beamer--get-label, org-beamer--frame-level,
org-beamer--format-section, org-beamer--format-frame,
org-beamer--format-block, org-beamer-headline): Apply changes to
properties.
* lisp/ox-html.el (org-html-headline, org-html-link,
org-html-section): Apply changes to properties.
* lisp/ox-icalendar.el (org-icalendar-create-uid,
org-icalendar-blocked-headline-p, org-icalendar-entry,
org-icalendar--valarm): Apply changes to properties.
* lisp/ox-odt.el (org-odt-headline): Apply changes
* lisp/ox-publish.el (org-publish-collect-index): Apply changes to
properties.
* lisp/ox-texinfo.el (org-texinfo--generate-menu-list,
org-texinfo--generate-menu-items, org-texinfo-template,
org-texinfo-headline, org-texinfo-link): Apply changes to
properties.
* lisp/ox.el (org-export-resolve-id-link, org-export-get-category):
Apply changes to properties.
(org-export-get-node-property): Update docstring.
* testing/lisp/test-ox.el: Update tests.
2013-02-17 18:01:21 -05:00
|
|
|
|
((org-element-property :COPYING headline) nil)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
;; Case 3: An index. If it matches one of the known indexes,
|
|
|
|
|
;; print it as such following the contents, otherwise
|
|
|
|
|
;; print the contents and leave the index up to the user.
|
|
|
|
|
(index
|
|
|
|
|
(format
|
|
|
|
|
section-fmt full-text
|
2012-08-15 18:00:51 -04:00
|
|
|
|
(concat pre-blanks contents "\n"
|
2012-08-15 16:00:20 -04:00
|
|
|
|
(if (member index '("cp" "fn" "ky" "pg" "tp" "vr"))
|
|
|
|
|
(concat "@printindex " index)))))
|
|
|
|
|
;; Case 4: This is a deep sub-tree: export it as a list item.
|
|
|
|
|
;; Also export as items headlines for which no section
|
|
|
|
|
;; format has been found.
|
|
|
|
|
((or (not section-fmt) (org-export-low-level-p headline info))
|
|
|
|
|
;; Build the real contents of the sub-tree.
|
|
|
|
|
(let ((low-level-body
|
|
|
|
|
(concat
|
|
|
|
|
;; If the headline is the first sibling, start a list.
|
|
|
|
|
(when (org-export-first-sibling-p headline info)
|
|
|
|
|
(format "@%s\n" (if numberedp 'enumerate 'itemize)))
|
|
|
|
|
;; Itemize headline
|
|
|
|
|
"@item\n" full-text "\n" pre-blanks contents)))
|
|
|
|
|
;; If headline is not the last sibling simply return
|
|
|
|
|
;; LOW-LEVEL-BODY. Otherwise, also close the list, before any
|
|
|
|
|
;; blank line.
|
|
|
|
|
(if (not (org-export-last-sibling-p headline info)) low-level-body
|
|
|
|
|
(replace-regexp-in-string
|
|
|
|
|
"[ \t\n]*\\'"
|
|
|
|
|
(format "\n@end %s" (if numberedp 'enumerate 'itemize))
|
|
|
|
|
low-level-body))))
|
|
|
|
|
;; Case 5: Standard headline. Export it as a section.
|
|
|
|
|
(t
|
|
|
|
|
(cond
|
|
|
|
|
((not (and tags (eq (plist-get info :with-tags) 'not-in-toc)))
|
|
|
|
|
;; Regular section. Use specified format string.
|
|
|
|
|
(format (replace-regexp-in-string "%]" "%%]" section-fmt) full-text
|
|
|
|
|
(concat pre-blanks contents)))
|
|
|
|
|
((string-match "\\`@\\(.*?\\){" section-fmt)
|
|
|
|
|
;; If tags should be removed from table of contents, insert
|
|
|
|
|
;; title without tags as an alternative heading in sectioning
|
|
|
|
|
;; command.
|
|
|
|
|
(format (replace-match (concat (match-string 1 section-fmt) "[%s]")
|
|
|
|
|
nil nil section-fmt 1)
|
|
|
|
|
;; Replace square brackets with parenthesis since
|
|
|
|
|
;; square brackets are not supported in optional
|
|
|
|
|
;; arguments.
|
|
|
|
|
(replace-regexp-in-string
|
|
|
|
|
"\\[" "("
|
|
|
|
|
(replace-regexp-in-string
|
|
|
|
|
"\\]" ")"
|
|
|
|
|
full-text-no-tag))
|
|
|
|
|
full-text
|
|
|
|
|
(concat pre-blanks contents)))
|
|
|
|
|
(t
|
|
|
|
|
;; Impossible to add an alternative heading. Fallback to
|
|
|
|
|
;; regular sectioning format string.
|
|
|
|
|
(format (replace-regexp-in-string "%]" "%%]" section-fmt) full-text
|
|
|
|
|
(concat pre-blanks contents))))))))
|
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Inline Src Block
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-inline-src-block (inline-src-block contents info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Transcode an INLINE-SRC-BLOCK element from Org to Texinfo.
|
|
|
|
|
CONTENTS holds the contents of the item. INFO is a plist holding
|
|
|
|
|
contextual information."
|
|
|
|
|
(let* ((code (org-element-property :value inline-src-block))
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(separator (org-texinfo--find-verb-separator code)))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
(concat "@verb{" separator code separator "}")))
|
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Inlinetask
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-inlinetask (inlinetask contents info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Transcode an INLINETASK element from Org to Texinfo.
|
|
|
|
|
CONTENTS holds the contents of the block. INFO is a plist
|
|
|
|
|
holding contextual information."
|
|
|
|
|
(let ((title (org-export-data (org-element-property :title inlinetask) info))
|
|
|
|
|
(todo (and (plist-get info :with-todo-keywords)
|
|
|
|
|
(let ((todo (org-element-property :todo-keyword inlinetask)))
|
|
|
|
|
(and todo (org-export-data todo info)))))
|
|
|
|
|
(todo-type (org-element-property :todo-type inlinetask))
|
|
|
|
|
(tags (and (plist-get info :with-tags)
|
|
|
|
|
(org-export-get-tags inlinetask info)))
|
|
|
|
|
(priority (and (plist-get info :with-priority)
|
|
|
|
|
(org-element-property :priority inlinetask))))
|
2013-01-27 17:11:34 -05:00
|
|
|
|
;; If `org-texinfo-format-inlinetask-function' is provided, call it
|
2012-08-15 16:00:20 -04:00
|
|
|
|
;; with appropriate arguments.
|
2013-11-14 08:05:18 -05:00
|
|
|
|
(if (not (eq org-texinfo-format-inlinetask-function 'ignore))
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(funcall org-texinfo-format-inlinetask-function
|
2012-08-15 16:00:20 -04:00
|
|
|
|
todo todo-type priority title tags contents)
|
|
|
|
|
;; Otherwise, use a default template.
|
|
|
|
|
(let ((full-title
|
|
|
|
|
(concat
|
|
|
|
|
(when todo (format "@strong{%s} " todo))
|
|
|
|
|
(when priority (format "#%c " priority))
|
|
|
|
|
title
|
|
|
|
|
(when tags (format ":%s:"
|
|
|
|
|
(mapconcat 'identity tags ":"))))))
|
|
|
|
|
(format (concat "@center %s\n\n"
|
|
|
|
|
"%s"
|
|
|
|
|
"\n")
|
|
|
|
|
full-title contents)))))
|
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Italic
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-italic (italic contents info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Transcode ITALIC from Org to Texinfo.
|
|
|
|
|
CONTENTS is the text with italic markup. INFO is a plist holding
|
|
|
|
|
contextual information."
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(org-texinfo--text-markup contents 'italic))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Item
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-item (item contents info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Transcode an ITEM element from Org to Texinfo.
|
|
|
|
|
CONTENTS holds the contents of the item. INFO is a plist holding
|
|
|
|
|
contextual information."
|
|
|
|
|
(let* ((tag (org-element-property :tag item))
|
|
|
|
|
(desc (org-export-data tag info)))
|
2012-08-15 18:00:51 -04:00
|
|
|
|
(concat "\n@item " (if tag desc) "\n"
|
2013-03-10 16:38:26 -04:00
|
|
|
|
(and contents (org-trim contents)) "\n")))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Keyword
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-keyword (keyword contents info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Transcode a KEYWORD element from Org to Texinfo.
|
|
|
|
|
CONTENTS is nil. INFO is a plist holding contextual information."
|
|
|
|
|
(let ((key (org-element-property :key keyword))
|
|
|
|
|
(value (org-element-property :value keyword)))
|
|
|
|
|
(cond
|
|
|
|
|
((string= key "TEXINFO") value)
|
|
|
|
|
((string= key "CINDEX") (format "@cindex %s" value))
|
|
|
|
|
((string= key "FINDEX") (format "@findex %s" value))
|
|
|
|
|
((string= key "KINDEX") (format "@kindex %s" value))
|
|
|
|
|
((string= key "PINDEX") (format "@pindex %s" value))
|
|
|
|
|
((string= key "TINDEX") (format "@tindex %s" value))
|
2012-08-15 18:00:51 -04:00
|
|
|
|
((string= key "VINDEX") (format "@vindex %s" value)))))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Line Break
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-line-break (line-break contents info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Transcode a LINE-BREAK object from Org to Texinfo.
|
|
|
|
|
CONTENTS is nil. INFO is a plist holding contextual information."
|
2012-12-12 16:48:06 -05:00
|
|
|
|
"@*\n")
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Link
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-link (link desc info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Transcode a LINK object from Org to Texinfo.
|
|
|
|
|
|
|
|
|
|
DESC is the description part of the link, or the empty string.
|
|
|
|
|
INFO is a plist holding contextual information. See
|
|
|
|
|
`org-export-data'."
|
|
|
|
|
(let* ((type (org-element-property :type link))
|
|
|
|
|
(raw-path (org-element-property :path link))
|
|
|
|
|
;; Ensure DESC really exists, or set it to nil.
|
|
|
|
|
(desc (and (not (string= desc "")) desc))
|
|
|
|
|
(path (cond
|
|
|
|
|
((member type '("http" "https" "ftp"))
|
|
|
|
|
(concat type ":" raw-path))
|
|
|
|
|
((string= type "file")
|
|
|
|
|
(if (file-name-absolute-p raw-path)
|
|
|
|
|
(concat "file://" (expand-file-name raw-path))
|
|
|
|
|
(concat "file://" raw-path)))
|
|
|
|
|
(t raw-path)))
|
|
|
|
|
(email (if (string= type "mailto")
|
|
|
|
|
(let ((text (replace-regexp-in-string
|
|
|
|
|
"@" "@@" raw-path)))
|
2012-08-15 18:00:51 -04:00
|
|
|
|
(concat text (if desc (concat "," desc))))))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
protocol)
|
|
|
|
|
(cond
|
2013-02-23 07:47:44 -05:00
|
|
|
|
;; Links pointing to a headline: Find destination and build
|
2012-08-15 16:00:20 -04:00
|
|
|
|
;; appropriate referencing command.
|
|
|
|
|
((member type '("custom-id" "id"))
|
|
|
|
|
(let ((destination (org-export-resolve-id-link link info)))
|
|
|
|
|
(case (org-element-type destination)
|
|
|
|
|
;; Id link points to an external file.
|
|
|
|
|
(plain-text
|
|
|
|
|
(if desc (format "@uref{file://%s,%s}" destination desc)
|
|
|
|
|
(format "@uref{file://%s}" destination)))
|
2013-02-23 07:47:44 -05:00
|
|
|
|
;; LINK points to a headline. Use the headline as the NODE target
|
2012-08-15 16:00:20 -04:00
|
|
|
|
(headline
|
2012-12-14 09:43:27 -05:00
|
|
|
|
(format "@ref{%s,%s}"
|
2013-02-20 11:05:35 -05:00
|
|
|
|
(org-texinfo--get-node destination info)
|
2012-12-14 09:43:27 -05:00
|
|
|
|
(or desc "")))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
(otherwise
|
|
|
|
|
(let ((path (org-export-solidify-link-text path)))
|
|
|
|
|
(if (not desc) (format "@ref{%s}" path)
|
|
|
|
|
(format "@ref{%s,,%s}" path desc)))))))
|
2012-12-13 08:38:31 -05:00
|
|
|
|
((member type '("info"))
|
2013-02-25 10:28:04 -05:00
|
|
|
|
(let* ((info-path (split-string path "[:#]"))
|
2012-12-13 08:38:31 -05:00
|
|
|
|
(info-manual (car info-path))
|
|
|
|
|
(info-node (or (cadr info-path) "top"))
|
|
|
|
|
(title (or desc "")))
|
|
|
|
|
(format "@ref{%s,%s,,%s,}" info-node title info-manual)))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
((member type '("fuzzy"))
|
|
|
|
|
(let ((destination (org-export-resolve-fuzzy-link link info)))
|
|
|
|
|
(case (org-element-type destination)
|
|
|
|
|
;; Id link points to an external file.
|
|
|
|
|
(plain-text
|
|
|
|
|
(if desc (format "@uref{file://%s,%s}" destination desc)
|
|
|
|
|
(format "@uref{file://%s}" destination)))
|
2013-02-23 07:47:44 -05:00
|
|
|
|
;; LINK points to a headline. Use the headline as the NODE target
|
2012-08-15 16:00:20 -04:00
|
|
|
|
(headline
|
2012-12-14 09:43:27 -05:00
|
|
|
|
(format "@ref{%s,%s}"
|
2013-02-20 11:05:35 -05:00
|
|
|
|
(org-texinfo--get-node destination info)
|
2012-12-14 09:43:27 -05:00
|
|
|
|
(or desc "")))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
(otherwise
|
|
|
|
|
(let ((path (org-export-solidify-link-text path)))
|
|
|
|
|
(if (not desc) (format "@ref{%s}" path)
|
|
|
|
|
(format "@ref{%s,,%s}" path desc)))))))
|
|
|
|
|
;; Special case for email addresses
|
|
|
|
|
(email
|
|
|
|
|
(format "@email{%s}" email))
|
|
|
|
|
;; External link with a description part.
|
|
|
|
|
((and path desc) (format "@uref{%s,%s}" path desc))
|
|
|
|
|
;; External link without a description part.
|
|
|
|
|
(path (format "@uref{%s}" path))
|
|
|
|
|
;; No path, only description. Try to do something useful.
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(t (format org-texinfo-link-with-unknown-path-format desc)))))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Menu
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-make-menu (info level)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Create the menu for inclusion in the texifo document.
|
|
|
|
|
|
|
|
|
|
INFO is the parsed buffer that contains the headlines. LEVEL
|
|
|
|
|
determines whether to make the main menu, or the detailed menu.
|
|
|
|
|
|
|
|
|
|
This is only used for generating the primary menu. In-Node menus
|
|
|
|
|
are generated directly."
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(let ((parse (plist-get info :parse-tree)))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
(cond
|
|
|
|
|
;; Generate the main menu
|
2013-01-27 17:11:34 -05:00
|
|
|
|
((eq level 'main) (org-texinfo--build-menu parse 1 info))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
;; Generate the detailed (recursive) menu
|
|
|
|
|
((eq level 'detailed)
|
|
|
|
|
;; Requires recursion
|
2013-01-27 17:11:34 -05:00
|
|
|
|
;;(org-texinfo--build-detailed-menu parse top info)
|
|
|
|
|
(org-texinfo--build-menu parse 1 info 'detailed)))))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-09-25 15:27:29 -04:00
|
|
|
|
;;;; Node Property
|
|
|
|
|
|
|
|
|
|
(defun org-texinfo-node-property (node-property contents info)
|
|
|
|
|
"Transcode a NODE-PROPERTY element from Org to Texinfo.
|
|
|
|
|
CONTENTS is nil. INFO is a plist holding contextual
|
|
|
|
|
information."
|
|
|
|
|
(format "%s:%s"
|
|
|
|
|
(org-element-property :key node-property)
|
|
|
|
|
(let ((value (org-element-property :value node-property)))
|
|
|
|
|
(if value (concat " " value) ""))))
|
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Paragraph
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-paragraph (paragraph contents info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Transcode a PARAGRAPH element from Org to Texinfo.
|
|
|
|
|
CONTENTS is the contents of the paragraph, as a string. INFO is
|
|
|
|
|
the plist used as a communication channel."
|
|
|
|
|
contents)
|
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Plain List
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-plain-list (plain-list contents info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Transcode a PLAIN-LIST element from Org to Texinfo.
|
|
|
|
|
CONTENTS is the contents of the list. INFO is a plist holding
|
|
|
|
|
contextual information."
|
|
|
|
|
(let* ((attr (org-export-read-attribute :attr_texinfo plain-list))
|
|
|
|
|
(indic (or (plist-get attr :indic)
|
2013-01-27 17:11:34 -05:00
|
|
|
|
org-texinfo-def-table-markup))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
(type (org-element-property :type plain-list))
|
2013-03-08 19:02:02 -05:00
|
|
|
|
(table-type (plist-get attr :table-type))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
;; Ensure valid texinfo table type.
|
2013-03-08 19:02:02 -05:00
|
|
|
|
(table-type (if (member table-type '("ftable" "vtable")) table-type
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"table"))
|
|
|
|
|
(list-type (cond
|
|
|
|
|
((eq type 'ordered) "enumerate")
|
|
|
|
|
((eq type 'unordered) "itemize")
|
|
|
|
|
((eq type 'descriptive) table-type))))
|
|
|
|
|
(format "@%s%s\n@end %s"
|
|
|
|
|
(if (eq type 'descriptive)
|
|
|
|
|
(concat list-type " " indic)
|
2012-08-15 18:00:51 -04:00
|
|
|
|
list-type)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
contents
|
|
|
|
|
list-type)))
|
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Plain Text
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-plain-text (text info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Transcode a TEXT string from Org to Texinfo.
|
|
|
|
|
TEXT is the string to transcode. INFO is a plist holding
|
|
|
|
|
contextual information."
|
2012-10-26 18:36:00 -04:00
|
|
|
|
;; First protect @, { and }.
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(let ((output (org-texinfo--sanitize-content text)))
|
2012-10-26 18:36:00 -04:00
|
|
|
|
;; Activate smart quotes. Be sure to provide original TEXT string
|
|
|
|
|
;; since OUTPUT may have been modified.
|
|
|
|
|
(when (plist-get info :with-smart-quotes)
|
|
|
|
|
(setq output
|
|
|
|
|
(org-export-activate-smart-quotes output :texinfo info text)))
|
|
|
|
|
;; LaTeX into @LaTeX{} and TeX into @TeX{}
|
|
|
|
|
(let ((case-fold-search nil)
|
|
|
|
|
(start 0))
|
|
|
|
|
(while (string-match "\\(\\(?:La\\)?TeX\\)" output start)
|
|
|
|
|
(setq output (replace-match
|
|
|
|
|
(format "@%s{}" (match-string 1 output)) nil t output)
|
|
|
|
|
start (match-end 0))))
|
|
|
|
|
;; Convert special strings.
|
|
|
|
|
(when (plist-get info :with-special-strings)
|
|
|
|
|
(while (string-match (regexp-quote "...") output)
|
|
|
|
|
(setq output (replace-match "@dots{}" nil t output))))
|
|
|
|
|
;; Handle break preservation if required.
|
|
|
|
|
(when (plist-get info :preserve-breaks)
|
|
|
|
|
(setq output (replace-regexp-in-string
|
|
|
|
|
"\\(\\\\\\\\\\)?[ \t]*\n" " @*\n" output)))
|
|
|
|
|
;; Return value.
|
|
|
|
|
output))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Planning
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-planning (planning contents info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Transcode a PLANNING element from Org to Texinfo.
|
|
|
|
|
CONTENTS is nil. INFO is a plist holding contextual
|
|
|
|
|
information."
|
|
|
|
|
(concat
|
|
|
|
|
"@noindent"
|
|
|
|
|
(mapconcat
|
|
|
|
|
'identity
|
|
|
|
|
(delq nil
|
|
|
|
|
(list
|
|
|
|
|
(let ((closed (org-element-property :closed planning)))
|
|
|
|
|
(when closed
|
|
|
|
|
(concat
|
2012-10-30 16:59:50 -04:00
|
|
|
|
(format "@strong{%s} " org-closed-string)
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(format org-texinfo-inactive-timestamp-format
|
2012-10-30 16:59:50 -04:00
|
|
|
|
(org-translate-time
|
|
|
|
|
(org-element-property :raw-value closed))))))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
(let ((deadline (org-element-property :deadline planning)))
|
|
|
|
|
(when deadline
|
|
|
|
|
(concat
|
|
|
|
|
(format "@strong{%s} " org-deadline-string)
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(format org-texinfo-active-timestamp-format
|
2012-10-30 16:59:50 -04:00
|
|
|
|
(org-translate-time
|
|
|
|
|
(org-element-property :raw-value deadline))))))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
(let ((scheduled (org-element-property :scheduled planning)))
|
|
|
|
|
(when scheduled
|
|
|
|
|
(concat
|
|
|
|
|
(format "@strong{%s} " org-scheduled-string)
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(format org-texinfo-active-timestamp-format
|
2012-10-30 16:59:50 -04:00
|
|
|
|
(org-translate-time
|
|
|
|
|
(org-element-property :raw-value scheduled))))))))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
" ")
|
|
|
|
|
"@*"))
|
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Property Drawer
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-property-drawer (property-drawer contents info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Transcode a PROPERTY-DRAWER element from Org to Texinfo.
|
2013-09-25 15:27:29 -04:00
|
|
|
|
CONTENTS holds the contents of the drawer. INFO is a plist
|
|
|
|
|
holding contextual information."
|
|
|
|
|
(and (org-string-nw-p contents)
|
|
|
|
|
(format "@verbatim\n%s@end verbatim" contents)))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Quote Block
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-quote-block (quote-block contents info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Transcode a QUOTE-BLOCK element from Org to Texinfo.
|
|
|
|
|
CONTENTS holds the contents of the block. INFO is a plist
|
|
|
|
|
holding contextual information."
|
|
|
|
|
(let* ((title (org-element-property :name quote-block))
|
|
|
|
|
(start-quote (concat "@quotation"
|
|
|
|
|
(if title
|
2012-08-15 18:00:51 -04:00
|
|
|
|
(format " %s" title)))))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
(format "%s\n%s@end quotation" start-quote contents)))
|
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Quote Section
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-quote-section (quote-section contents info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Transcode a QUOTE-SECTION element from Org to Texinfo.
|
|
|
|
|
CONTENTS is nil. INFO is a plist holding contextual information."
|
|
|
|
|
(let ((value (org-remove-indentation
|
|
|
|
|
(org-element-property :value quote-section))))
|
|
|
|
|
(when value (format "@verbatim\n%s@end verbatim" value))))
|
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Radio Target
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-radio-target (radio-target text info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Transcode a RADIO-TARGET object from Org to Texinfo.
|
|
|
|
|
TEXT is the text of the target. INFO is a plist holding
|
|
|
|
|
contextual information."
|
|
|
|
|
(format "@anchor{%s}%s"
|
|
|
|
|
(org-export-solidify-link-text
|
|
|
|
|
(org-element-property :value radio-target))
|
|
|
|
|
text))
|
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Section
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-section (section contents info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Transcode a SECTION element from Org to Texinfo.
|
|
|
|
|
CONTENTS holds the contents of the section. INFO is a plist
|
|
|
|
|
holding contextual information."
|
|
|
|
|
contents)
|
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Special Block
|
2012-10-26 18:36:00 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-special-block (special-block contents info)
|
2012-10-26 18:36:00 -04:00
|
|
|
|
"Transcode a SPECIAL-BLOCK element from Org to Texinfo.
|
|
|
|
|
CONTENTS holds the contents of the block. INFO is a plist used
|
|
|
|
|
as a communication channel."
|
|
|
|
|
contents)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Src Block
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-src-block (src-block contents info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Transcode a SRC-BLOCK element from Org to Texinfo.
|
|
|
|
|
CONTENTS holds the contents of the item. INFO is a plist holding
|
|
|
|
|
contextual information."
|
|
|
|
|
(let* ((lang (org-element-property :language src-block))
|
2013-03-10 15:32:46 -04:00
|
|
|
|
(lisp-p (string-match-p "lisp" lang))
|
|
|
|
|
(src-contents (org-texinfo--sanitize-content
|
|
|
|
|
(org-export-format-code-default src-block info))))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
(cond
|
|
|
|
|
;; Case 1. Lisp Block
|
|
|
|
|
(lisp-p
|
2013-02-10 14:50:38 -05:00
|
|
|
|
(format "@lisp\n%s@end lisp"
|
2013-03-10 15:32:46 -04:00
|
|
|
|
src-contents))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
;; Case 2. Other blocks
|
|
|
|
|
(t
|
2013-02-10 14:50:38 -05:00
|
|
|
|
(format "@example\n%s@end example"
|
2013-03-10 15:32:46 -04:00
|
|
|
|
src-contents)))))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Statistics Cookie
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-statistics-cookie (statistics-cookie contents info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Transcode a STATISTICS-COOKIE object from Org to Texinfo.
|
|
|
|
|
CONTENTS is nil. INFO is a plist holding contextual information."
|
|
|
|
|
(org-element-property :value statistics-cookie))
|
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Subscript
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-subscript (subscript contents info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Transcode a SUBSCRIPT object from Org to Texinfo.
|
|
|
|
|
CONTENTS is the contents of the object. INFO is a plist holding
|
|
|
|
|
contextual information."
|
|
|
|
|
(format "@math{_%s}" contents))
|
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Superscript
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-superscript (superscript contents info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Transcode a SUPERSCRIPT object from Org to Texinfo.
|
|
|
|
|
CONTENTS is the contents of the object. INFO is a plist holding
|
|
|
|
|
contextual information."
|
|
|
|
|
(format "@math{^%s}" contents))
|
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Table
|
2012-08-15 16:00:20 -04:00
|
|
|
|
;;
|
2013-01-27 17:11:34 -05:00
|
|
|
|
;; `org-texinfo-table' is the entry point for table transcoding. It
|
2012-08-15 16:00:20 -04:00
|
|
|
|
;; takes care of tables with a "verbatim" attribute. Otherwise, it
|
2013-01-27 17:11:34 -05:00
|
|
|
|
;; delegates the job to either `org-texinfo-table--table.el-table' or
|
|
|
|
|
;; `org-texinfo-table--org-table' functions, depending of the type of
|
2012-08-15 16:00:20 -04:00
|
|
|
|
;; the table.
|
|
|
|
|
;;
|
2013-01-27 17:11:34 -05:00
|
|
|
|
;; `org-texinfo-table--align-string' is a subroutine used to build
|
2012-08-15 16:00:20 -04:00
|
|
|
|
;; alignment string for Org tables.
|
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-table (table contents info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Transcode a TABLE element from Org to Texinfo.
|
|
|
|
|
CONTENTS is the contents of the table. INFO is a plist holding
|
|
|
|
|
contextual information."
|
|
|
|
|
(cond
|
|
|
|
|
;; Case 1: verbatim table.
|
2013-01-27 17:11:34 -05:00
|
|
|
|
((or org-texinfo-tables-verbatim
|
2012-08-15 16:00:20 -04:00
|
|
|
|
(let ((attr (mapconcat 'identity
|
|
|
|
|
(org-element-property :attr_latex table)
|
|
|
|
|
" ")))
|
|
|
|
|
(and attr (string-match "\\<verbatim\\>" attr))))
|
|
|
|
|
(format "@verbatim \n%s\n@end verbatim"
|
|
|
|
|
;; Re-create table, without affiliated keywords.
|
|
|
|
|
(org-trim
|
|
|
|
|
(org-element-interpret-data
|
|
|
|
|
`(table nil ,@(org-element-contents table))))))
|
|
|
|
|
;; Case 2: table.el table. Convert it using appropriate tools.
|
|
|
|
|
((eq (org-element-property :type table) 'table.el)
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(org-texinfo-table--table.el-table table contents info))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
;; Case 3: Standard table.
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(t (org-texinfo-table--org-table table contents info))))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-table-column-widths (table info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Determine the largest table cell in each column to process alignment.
|
|
|
|
|
|
|
|
|
|
TABLE is the table element to transcode. INFO is a plist used as
|
|
|
|
|
a communication channel."
|
|
|
|
|
(let* ((rows (org-element-map table 'table-row 'identity info))
|
|
|
|
|
(collected (loop for row in rows collect
|
2012-11-11 04:08:49 -05:00
|
|
|
|
(org-element-map row 'table-cell 'identity info)))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
(number-cells (length (car collected)))
|
|
|
|
|
cells counts)
|
|
|
|
|
(loop for row in collected do
|
|
|
|
|
(push (mapcar (lambda (ref)
|
2012-08-15 18:00:51 -04:00
|
|
|
|
(let* ((start (org-element-property :contents-begin ref))
|
|
|
|
|
(end (org-element-property :contents-end ref))
|
|
|
|
|
(length (- end start)))
|
|
|
|
|
length)) row) cells))
|
2012-10-04 08:45:28 -04:00
|
|
|
|
(setq cells (org-remove-if 'null cells))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
(push (loop for count from 0 to (- number-cells 1) collect
|
2012-08-15 18:00:51 -04:00
|
|
|
|
(loop for item in cells collect
|
|
|
|
|
(nth count item))) counts)
|
2012-08-24 05:21:24 -04:00
|
|
|
|
(mapconcat (lambda (size)
|
|
|
|
|
(make-string size ?a)) (mapcar (lambda (ref)
|
2013-06-01 05:21:48 -04:00
|
|
|
|
(apply 'max `(,@ref))) (car counts))
|
2012-08-24 05:21:24 -04:00
|
|
|
|
"} {")))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-table--org-table (table contents info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Return appropriate Texinfo code for an Org table.
|
|
|
|
|
|
|
|
|
|
TABLE is the table type element to transcode. CONTENTS is its
|
|
|
|
|
contents, as a string. INFO is a plist used as a communication
|
|
|
|
|
channel.
|
|
|
|
|
|
|
|
|
|
This function assumes TABLE has `org' as its `:type' attribute."
|
|
|
|
|
(let* ((attr (org-export-read-attribute :attr_texinfo table))
|
|
|
|
|
(col-width (plist-get attr :columns))
|
|
|
|
|
(columns (if col-width
|
|
|
|
|
(format "@columnfractions %s"
|
|
|
|
|
col-width)
|
|
|
|
|
(format "{%s}"
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(org-texinfo-table-column-widths
|
2012-08-15 16:00:20 -04:00
|
|
|
|
table info)))))
|
|
|
|
|
;; Prepare the final format string for the table.
|
|
|
|
|
(cond
|
|
|
|
|
;; Longtable.
|
|
|
|
|
;; Others.
|
|
|
|
|
(t (concat
|
|
|
|
|
(format "@multitable %s\n%s@end multitable"
|
|
|
|
|
columns
|
|
|
|
|
contents))))))
|
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-table--table.el-table (table contents info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Returns nothing.
|
|
|
|
|
|
|
|
|
|
Rather than return an invalid table, nothing is returned."
|
|
|
|
|
'nil)
|
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Table Cell
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-table-cell (table-cell contents info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Transcode a TABLE-CELL element from Org to Texinfo.
|
|
|
|
|
CONTENTS is the cell contents. INFO is a plist used as
|
|
|
|
|
a communication channel."
|
|
|
|
|
(concat (if (and contents
|
2013-01-27 17:11:34 -05:00
|
|
|
|
org-texinfo-table-scientific-notation
|
2012-08-15 16:00:20 -04:00
|
|
|
|
(string-match orgtbl-exp-regexp contents))
|
|
|
|
|
;; Use appropriate format string for scientific
|
|
|
|
|
;; notation.
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(format org-texinfo-table-scientific-notation
|
2012-08-15 16:00:20 -04:00
|
|
|
|
(match-string 1 contents)
|
|
|
|
|
(match-string 2 contents))
|
|
|
|
|
contents)
|
|
|
|
|
(when (org-export-get-next-element table-cell info) "\n@tab ")))
|
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Table Row
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-table-row (table-row contents info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Transcode a TABLE-ROW element from Org to Texinfo.
|
|
|
|
|
CONTENTS is the contents of the row. INFO is a plist used as
|
|
|
|
|
a communication channel."
|
|
|
|
|
;; Rules are ignored since table separators are deduced from
|
|
|
|
|
;; borders of the current row.
|
2012-08-15 18:00:51 -04:00
|
|
|
|
(when (eq (org-element-property :type table-row) 'standard)
|
2012-08-29 15:14:03 -04:00
|
|
|
|
(let ((rowgroup-tag
|
|
|
|
|
(cond
|
|
|
|
|
;; Case 1: Belongs to second or subsequent rowgroup.
|
|
|
|
|
((not (= 1 (org-export-table-row-group table-row info)))
|
|
|
|
|
"@item ")
|
|
|
|
|
;; Case 2: Row is from first rowgroup. Table has >=1 rowgroups.
|
|
|
|
|
((org-export-table-has-header-p
|
|
|
|
|
(org-export-get-parent-table table-row) info)
|
|
|
|
|
"@headitem ")
|
|
|
|
|
;; Case 3: Row is from first and only row group.
|
|
|
|
|
(t "@item "))))
|
|
|
|
|
(when (eq (org-element-property :type table-row) 'standard)
|
|
|
|
|
(concat rowgroup-tag contents "\n")))))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Target
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-target (target contents info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Transcode a TARGET object from Org to Texinfo.
|
|
|
|
|
CONTENTS is nil. INFO is a plist holding contextual
|
|
|
|
|
information."
|
|
|
|
|
(format "@anchor{%s}"
|
|
|
|
|
(org-export-solidify-link-text (org-element-property :value target))))
|
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Timestamp
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-timestamp (timestamp contents info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Transcode a TIMESTAMP object from Org to Texinfo.
|
|
|
|
|
CONTENTS is nil. INFO is a plist holding contextual
|
|
|
|
|
information."
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(let ((value (org-texinfo-plain-text
|
2013-01-10 15:42:21 -05:00
|
|
|
|
(org-timestamp-translate timestamp) info)))
|
2012-10-28 11:20:45 -04:00
|
|
|
|
(case (org-element-property :type timestamp)
|
|
|
|
|
((active active-range)
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(format org-texinfo-active-timestamp-format value))
|
2012-10-28 11:20:45 -04:00
|
|
|
|
((inactive inactive-range)
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(format org-texinfo-inactive-timestamp-format value))
|
|
|
|
|
(t (format org-texinfo-diary-timestamp-format value)))))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Verbatim
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-verbatim (verbatim contents info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Transcode a VERBATIM object from Org to Texinfo.
|
|
|
|
|
CONTENTS is nil. INFO is a plist used as a communication
|
|
|
|
|
channel."
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(org-texinfo--text-markup (org-element-property :value verbatim) 'verbatim))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2012-08-15 18:00:51 -04:00
|
|
|
|
;;; Verse Block
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-verse-block (verse-block contents info)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Transcode a VERSE-BLOCK element from Org to Texinfo.
|
|
|
|
|
CONTENTS is verse block contents. INFO is a plist holding
|
|
|
|
|
contextual information."
|
|
|
|
|
;; In a verse environment, add a line break to each newline
|
|
|
|
|
;; character and change each white space at beginning of a line
|
|
|
|
|
;; into a space of 1 em. Also change each blank line with
|
|
|
|
|
;; a vertical space of 1 em.
|
|
|
|
|
(progn
|
|
|
|
|
(setq contents (replace-regexp-in-string
|
|
|
|
|
"^ *\\\\\\\\$" "\\\\vspace*{1em}"
|
|
|
|
|
(replace-regexp-in-string
|
|
|
|
|
"\\(\\\\\\\\\\)?[ \t]*\n" " \\\\\\\\\n" contents)))
|
|
|
|
|
(while (string-match "^[ \t]+" contents)
|
|
|
|
|
(let ((new-str (format "\\hspace*{%dem}"
|
|
|
|
|
(length (match-string 0 contents)))))
|
|
|
|
|
(setq contents (replace-match new-str nil t contents))))
|
|
|
|
|
(format "\\begin{verse}\n%s\\end{verse}" contents)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Interactive functions
|
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-export-to-texinfo
|
2012-12-02 11:24:19 -05:00
|
|
|
|
(&optional async subtreep visible-only body-only ext-plist)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Export current buffer to a Texinfo file.
|
|
|
|
|
|
|
|
|
|
If narrowing is active in the current buffer, only export its
|
|
|
|
|
narrowed part.
|
|
|
|
|
|
|
|
|
|
If a region is active, export that region.
|
|
|
|
|
|
2012-12-02 11:24:19 -05:00
|
|
|
|
A non-nil optional argument ASYNC means the process should happen
|
|
|
|
|
asynchronously. The resulting file should be accessible through
|
|
|
|
|
the `org-export-stack' interface.
|
|
|
|
|
|
2012-08-15 16:00:20 -04:00
|
|
|
|
When optional argument SUBTREEP is non-nil, export the sub-tree
|
|
|
|
|
at point, extracting information from the headline properties
|
|
|
|
|
first.
|
|
|
|
|
|
|
|
|
|
When optional argument VISIBLE-ONLY is non-nil, don't export
|
|
|
|
|
contents of hidden elements.
|
|
|
|
|
|
|
|
|
|
When optional argument BODY-ONLY is non-nil, only write code
|
|
|
|
|
between \"\\begin{document}\" and \"\\end{document}\".
|
|
|
|
|
|
|
|
|
|
EXT-PLIST, when provided, is a property list with external
|
|
|
|
|
parameters overriding Org default settings, but still inferior to
|
|
|
|
|
file-local settings.
|
|
|
|
|
|
|
|
|
|
Return output file's name."
|
|
|
|
|
(interactive)
|
2013-03-19 05:24:30 -04:00
|
|
|
|
(let ((outfile (org-export-output-file-name ".texi" subtreep))
|
2013-09-20 04:41:21 -04:00
|
|
|
|
(org-export-coding-system org-texinfo-coding-system))
|
Export back-ends: Apply changes to export functions
* contrib/lisp/ox-confluence.el (org-confluence-export-as-confluence):
* contrib/lisp/ox-deck.el (org-deck-export-as-html,
org-deck-export-to-html):
* contrib/lisp/ox-freemind.el (org-freemind-export-to-freemind):
* contrib/lisp/ox-groff.el (org-groff-export-to-groff,
org-groff-export-to-pdf):
* contrib/lisp/ox-koma-letter.el (org-koma-letter-export-as-latex,
org-koma-letter-export-to-latex, org-koma-letter-export-to-pdf):
* contrib/lisp/ox-rss.el (org-rss-export-as-rss,
org-rss-export-to-rss):
* contrib/lisp/ox-s5.el (org-s5-export-as-html,
org-s5-export-to-html):
* contrib/lisp/ox-taskjuggler.el (org-taskjuggler-export):
* lisp/ob-haskell.el:
* lisp/ox-ascii.el (org-ascii-export-as-ascii,
org-ascii-export-to-ascii):
* lisp/ox-beamer.el (org-beamer-export-as-latex,
org-beamer-export-to-latex, org-beamer-export-to-pdf):
* lisp/ox-html.el (org-html-export-as-html, org-html-export-to-html):
* lisp/ox-icalendar.el (org-icalendar-export-to-ics):
* lisp/ox-latex.el (org-latex-export-as-latex,
org-latex-export-to-pdf):
* lisp/ox-man.el (org-man-export-to-man, org-man-export-to-pdf):
* lisp/ox-md.el (org-md-export-as-markdown,
org-md-export-to-markdown):
* lisp/ox-odt.el (org-odt-export-to-odt):
* lisp/ox-org.el (org-org-export-as-org, org-org-export-to-org):
* lisp/ox-publish.el (org-publish-org-to):
* lisp/ox-texinfo.el (org-texinfo-export-to-texinfo,
org-texinfo-export-to-info):
* testing/lisp/test-ob-exp.el (test-ob-exp/org-babel-exp-src-blocks/w-no-file):
2013-08-07 04:35:42 -04:00
|
|
|
|
(org-export-to-file 'texinfo outfile
|
|
|
|
|
async subtreep visible-only body-only ext-plist)))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-export-to-info
|
2012-12-02 11:24:19 -05:00
|
|
|
|
(&optional async subtreep visible-only body-only ext-plist)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Export current buffer to Texinfo then process through to INFO.
|
|
|
|
|
|
|
|
|
|
If narrowing is active in the current buffer, only export its
|
|
|
|
|
narrowed part.
|
|
|
|
|
|
|
|
|
|
If a region is active, export that region.
|
|
|
|
|
|
2012-12-02 11:24:19 -05:00
|
|
|
|
A non-nil optional argument ASYNC means the process should happen
|
|
|
|
|
asynchronously. The resulting file should be accessible through
|
|
|
|
|
the `org-export-stack' interface.
|
|
|
|
|
|
2012-08-15 16:00:20 -04:00
|
|
|
|
When optional argument SUBTREEP is non-nil, export the sub-tree
|
|
|
|
|
at point, extracting information from the headline properties
|
|
|
|
|
first.
|
|
|
|
|
|
|
|
|
|
When optional argument VISIBLE-ONLY is non-nil, don't export
|
|
|
|
|
contents of hidden elements.
|
|
|
|
|
|
|
|
|
|
When optional argument BODY-ONLY is non-nil, only write code
|
|
|
|
|
between \"\\begin{document}\" and \"\\end{document}\".
|
|
|
|
|
|
|
|
|
|
EXT-PLIST, when provided, is a property list with external
|
|
|
|
|
parameters overriding Org default settings, but still inferior to
|
|
|
|
|
file-local settings.
|
|
|
|
|
|
|
|
|
|
When optional argument PUB-DIR is set, use it as the publishing
|
|
|
|
|
directory.
|
|
|
|
|
|
|
|
|
|
Return INFO file's name."
|
|
|
|
|
(interactive)
|
Export back-ends: Apply changes to export functions
* contrib/lisp/ox-confluence.el (org-confluence-export-as-confluence):
* contrib/lisp/ox-deck.el (org-deck-export-as-html,
org-deck-export-to-html):
* contrib/lisp/ox-freemind.el (org-freemind-export-to-freemind):
* contrib/lisp/ox-groff.el (org-groff-export-to-groff,
org-groff-export-to-pdf):
* contrib/lisp/ox-koma-letter.el (org-koma-letter-export-as-latex,
org-koma-letter-export-to-latex, org-koma-letter-export-to-pdf):
* contrib/lisp/ox-rss.el (org-rss-export-as-rss,
org-rss-export-to-rss):
* contrib/lisp/ox-s5.el (org-s5-export-as-html,
org-s5-export-to-html):
* contrib/lisp/ox-taskjuggler.el (org-taskjuggler-export):
* lisp/ob-haskell.el:
* lisp/ox-ascii.el (org-ascii-export-as-ascii,
org-ascii-export-to-ascii):
* lisp/ox-beamer.el (org-beamer-export-as-latex,
org-beamer-export-to-latex, org-beamer-export-to-pdf):
* lisp/ox-html.el (org-html-export-as-html, org-html-export-to-html):
* lisp/ox-icalendar.el (org-icalendar-export-to-ics):
* lisp/ox-latex.el (org-latex-export-as-latex,
org-latex-export-to-pdf):
* lisp/ox-man.el (org-man-export-to-man, org-man-export-to-pdf):
* lisp/ox-md.el (org-md-export-as-markdown,
org-md-export-to-markdown):
* lisp/ox-odt.el (org-odt-export-to-odt):
* lisp/ox-org.el (org-org-export-as-org, org-org-export-to-org):
* lisp/ox-publish.el (org-publish-org-to):
* lisp/ox-texinfo.el (org-texinfo-export-to-texinfo,
org-texinfo-export-to-info):
* testing/lisp/test-ob-exp.el (test-ob-exp/org-babel-exp-src-blocks/w-no-file):
2013-08-07 04:35:42 -04:00
|
|
|
|
(let ((outfile (org-export-output-file-name ".texi" subtreep))
|
2013-09-20 04:37:32 -04:00
|
|
|
|
(org-export-coding-system org-texinfo-coding-system))
|
Export back-ends: Apply changes to export functions
* contrib/lisp/ox-confluence.el (org-confluence-export-as-confluence):
* contrib/lisp/ox-deck.el (org-deck-export-as-html,
org-deck-export-to-html):
* contrib/lisp/ox-freemind.el (org-freemind-export-to-freemind):
* contrib/lisp/ox-groff.el (org-groff-export-to-groff,
org-groff-export-to-pdf):
* contrib/lisp/ox-koma-letter.el (org-koma-letter-export-as-latex,
org-koma-letter-export-to-latex, org-koma-letter-export-to-pdf):
* contrib/lisp/ox-rss.el (org-rss-export-as-rss,
org-rss-export-to-rss):
* contrib/lisp/ox-s5.el (org-s5-export-as-html,
org-s5-export-to-html):
* contrib/lisp/ox-taskjuggler.el (org-taskjuggler-export):
* lisp/ob-haskell.el:
* lisp/ox-ascii.el (org-ascii-export-as-ascii,
org-ascii-export-to-ascii):
* lisp/ox-beamer.el (org-beamer-export-as-latex,
org-beamer-export-to-latex, org-beamer-export-to-pdf):
* lisp/ox-html.el (org-html-export-as-html, org-html-export-to-html):
* lisp/ox-icalendar.el (org-icalendar-export-to-ics):
* lisp/ox-latex.el (org-latex-export-as-latex,
org-latex-export-to-pdf):
* lisp/ox-man.el (org-man-export-to-man, org-man-export-to-pdf):
* lisp/ox-md.el (org-md-export-as-markdown,
org-md-export-to-markdown):
* lisp/ox-odt.el (org-odt-export-to-odt):
* lisp/ox-org.el (org-org-export-as-org, org-org-export-to-org):
* lisp/ox-publish.el (org-publish-org-to):
* lisp/ox-texinfo.el (org-texinfo-export-to-texinfo,
org-texinfo-export-to-info):
* testing/lisp/test-ob-exp.el (test-ob-exp/org-babel-exp-src-blocks/w-no-file):
2013-08-07 04:35:42 -04:00
|
|
|
|
(org-export-to-file 'texinfo outfile
|
|
|
|
|
async subtreep visible-only body-only ext-plist
|
|
|
|
|
(lambda (file) (org-texinfo-compile file)))))
|
2013-03-19 05:24:30 -04:00
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun org-texinfo-publish-to-texinfo (plist filename pub-dir)
|
|
|
|
|
"Publish an org file to Texinfo.
|
|
|
|
|
|
|
|
|
|
FILENAME is the filename of the Org file to be published. PLIST
|
|
|
|
|
is the property list for the given project. PUB-DIR is the
|
|
|
|
|
publishing directory.
|
|
|
|
|
|
|
|
|
|
Return output file name."
|
|
|
|
|
(org-publish-org-to 'texinfo filename ".texi" plist pub-dir))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-04-06 13:09:38 -04:00
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun org-texinfo-convert-region-to-texinfo ()
|
|
|
|
|
"Assume the current region has org-mode syntax, and convert it to Texinfo.
|
|
|
|
|
This can be used in any buffer. For example, you can write an
|
|
|
|
|
itemized list in org-mode syntax in an Texinfo buffer and use
|
|
|
|
|
this command to convert it."
|
|
|
|
|
(interactive)
|
|
|
|
|
(org-export-replace-region-by 'texinfo))
|
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-compile (file)
|
2012-08-15 16:00:20 -04:00
|
|
|
|
"Compile a texinfo file.
|
|
|
|
|
|
2012-10-25 10:07:13 -04:00
|
|
|
|
FILE is the name of the file being compiled. Processing is
|
2013-01-27 17:11:34 -05:00
|
|
|
|
done through the command specified in `org-texinfo-info-process'.
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
|
|
|
|
Return INFO file name or an error if it couldn't be produced."
|
2012-10-25 10:07:13 -04:00
|
|
|
|
(let* ((base-name (file-name-sans-extension (file-name-nondirectory file)))
|
|
|
|
|
(full-name (file-truename file))
|
|
|
|
|
(out-dir (file-name-directory file))
|
2013-05-30 14:29:34 -04:00
|
|
|
|
;; Properly set working directory for compilation.
|
2013-05-30 15:48:48 -04:00
|
|
|
|
(default-directory (if (file-name-absolute-p file)
|
2013-05-30 14:29:34 -04:00
|
|
|
|
(file-name-directory full-name)
|
|
|
|
|
default-directory))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
errors)
|
2013-04-06 10:49:10 -04:00
|
|
|
|
(message (format "Processing Texinfo file %s..." file))
|
2012-10-25 10:07:13 -04:00
|
|
|
|
(save-window-excursion
|
|
|
|
|
(cond
|
|
|
|
|
;; A function is provided: Apply it.
|
2013-01-27 17:11:34 -05:00
|
|
|
|
((functionp org-texinfo-info-process)
|
|
|
|
|
(funcall org-texinfo-info-process (shell-quote-argument file)))
|
2012-10-25 10:07:13 -04:00
|
|
|
|
;; A list is provided: Replace %b, %f and %o with appropriate
|
|
|
|
|
;; values in each command before applying it. Output is
|
|
|
|
|
;; redirected to "*Org INFO Texinfo Output*" buffer.
|
2013-01-27 17:11:34 -05:00
|
|
|
|
((consp org-texinfo-info-process)
|
2012-10-25 10:07:13 -04:00
|
|
|
|
(let ((outbuf (get-buffer-create "*Org INFO Texinfo Output*")))
|
|
|
|
|
(mapc
|
|
|
|
|
(lambda (command)
|
|
|
|
|
(shell-command
|
|
|
|
|
(replace-regexp-in-string
|
|
|
|
|
"%b" (shell-quote-argument base-name)
|
|
|
|
|
(replace-regexp-in-string
|
|
|
|
|
"%f" (shell-quote-argument full-name)
|
|
|
|
|
(replace-regexp-in-string
|
|
|
|
|
"%o" (shell-quote-argument out-dir) command t t) t t) t t)
|
|
|
|
|
outbuf))
|
2013-01-27 17:11:34 -05:00
|
|
|
|
org-texinfo-info-process)
|
2012-10-25 10:07:13 -04:00
|
|
|
|
;; Collect standard errors from output buffer.
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(setq errors (org-texinfo-collect-errors outbuf))))
|
2012-10-25 10:07:13 -04:00
|
|
|
|
(t (error "No valid command to process to Info")))
|
2013-05-30 14:29:48 -04:00
|
|
|
|
(let ((infofile (concat out-dir base-name ".info")))
|
2012-10-25 10:07:13 -04:00
|
|
|
|
;; Check for process failure. Provide collected errors if
|
|
|
|
|
;; possible.
|
|
|
|
|
(if (not (file-exists-p infofile))
|
|
|
|
|
(error (concat (format "INFO file %s wasn't produced" infofile)
|
|
|
|
|
(when errors (concat ": " errors))))
|
|
|
|
|
;; Else remove log files, when specified, and signal end of
|
|
|
|
|
;; process to user, along with any error encountered.
|
2013-03-19 05:31:23 -04:00
|
|
|
|
(when org-texinfo-remove-logfiles
|
|
|
|
|
(dolist (ext org-texinfo-logfiles-extensions)
|
|
|
|
|
(let ((file (concat out-dir base-name "." ext)))
|
|
|
|
|
(when (file-exists-p file) (delete-file file)))))
|
2012-10-25 10:07:13 -04:00
|
|
|
|
(message (concat "Process completed"
|
|
|
|
|
(if (not errors) "."
|
|
|
|
|
(concat " with errors: " errors)))))
|
|
|
|
|
;; Return output file name.
|
|
|
|
|
infofile))))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(defun org-texinfo-collect-errors (buffer)
|
2012-08-23 08:36:15 -04:00
|
|
|
|
"Collect some kind of errors from \"makeinfo\" command output.
|
2012-08-15 16:00:20 -04:00
|
|
|
|
|
|
|
|
|
BUFFER is the buffer containing output.
|
|
|
|
|
|
|
|
|
|
Return collected error types as a string, or nil if there was
|
|
|
|
|
none."
|
|
|
|
|
(with-current-buffer buffer
|
|
|
|
|
(save-excursion
|
2012-08-23 08:36:15 -04:00
|
|
|
|
(goto-char (point-min))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
;; Find final "makeinfo" run.
|
2012-08-23 08:36:15 -04:00
|
|
|
|
(when t
|
2012-08-15 16:00:20 -04:00
|
|
|
|
(let ((case-fold-search t)
|
|
|
|
|
(errors ""))
|
|
|
|
|
(when (save-excursion
|
|
|
|
|
(re-search-forward "perhaps incorrect sectioning?" nil t))
|
2012-11-10 21:41:54 -05:00
|
|
|
|
(setq errors (concat errors " [incorrect sectioning]")))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
(when (save-excursion
|
|
|
|
|
(re-search-forward "missing close brace" nil t))
|
|
|
|
|
(setq errors (concat errors " [syntax error]")))
|
|
|
|
|
(when (save-excursion
|
|
|
|
|
(re-search-forward "Unknown command" nil t))
|
|
|
|
|
(setq errors (concat errors " [undefined @command]")))
|
|
|
|
|
(when (save-excursion
|
|
|
|
|
(re-search-forward "No matching @end" nil t))
|
|
|
|
|
(setq errors (concat errors " [block incomplete]")))
|
|
|
|
|
(when (save-excursion
|
|
|
|
|
(re-search-forward "requires a sectioning" nil t))
|
|
|
|
|
(setq errors (concat errors " [invalid section command]")))
|
|
|
|
|
(when (save-excursion
|
2012-08-23 08:36:15 -04:00
|
|
|
|
(re-search-forward "\\[unexpected\]" nil t))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
(setq errors (concat errors " [unexpected error]")))
|
2012-08-23 08:36:15 -04:00
|
|
|
|
(when (save-excursion
|
|
|
|
|
(re-search-forward "misplaced " nil t))
|
|
|
|
|
(setq errors (concat errors " [syntax error]")))
|
2012-08-15 16:00:20 -04:00
|
|
|
|
(and (org-string-nw-p errors) (org-trim errors)))))))
|
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
|
|
|
|
|
(provide 'ox-texinfo)
|
|
|
|
|
|
|
|
|
|
;; Local variables:
|
|
|
|
|
;; generated-autoload-file: "org-loaddefs.el"
|
|
|
|
|
;; End:
|
|
|
|
|
|
|
|
|
|
;;; ox-texinfo.el ends here
|