Commit Graph

323 Commits

Author SHA1 Message Date
Ihor Radchenko 72b0e9ff04
org-export: Do not strip link type by default during export
* lisp/ox-html.el (org-html-link):
* lisp/ox-latex.el (org-latex-link):
* lisp/ox-man.el (org-man-link):
* lisp/ox-md.el (org-md-link):
* lisp/ox-odt.el (org-odt-link--inline-image):
* lisp/ox-texinfo.el (org-texinfo-link): Preserve link type during
export for all the links, not just for a hard-coded subset.
* etc/ORG-NEWS (Built-in HTML, LaTeX, Man, Markdown, ODT, and Texinfo
exporters preserve the link protocol during export): Document the
breaking change.

Link: https://list.orgmode.org/orgmode/878r9nofpw.fsf@localhost/
2024-03-12 13:57:47 +03:00
Stefan Monnier b0c3c90574
ox-texinfo:: Always provide a @direntry
Until now @dircategory/@direntry entries were added only if
both TEXINFO_DIR_CATEGORY and TEXINFO_DIR_TITLE were set.
And the setting of TEXINFO_DIR_TITLE had to be careful to
provide exactly the right syntax.

This patch changes various things in this regard:
- Always generate a @dircategory/@direntry.
- Default TEXINFO_DIR_CATEGORY to "Misc".
- Use the document title by default if TEXINFO_DIR_DESC is missing.
- Rename TEXINFO_DIR_TITLE to TEXINFO_DIR_NAME.
- Use the filename by default when TEXINFO_DIR_NAME is missing.
- Try and make it harder to provide a direntry that does not
  have the right format or refers to a different filename than
  the one we're outputting to.

* lisp/ox-texinfo.el (texinfo): Add entry for TEXINFO_DIR_NAME.
(org-texinfo-template): Use sane defaults for `@direntry` and `@dircategory`.

* doc/org-manual.org (Texinfo specific export settings): Adjust accordingly.
(Info directory file, A Texinfo example, Export Setup): Update examples
to use the new syntax.
* etc/ORG-NEWS (Version 9.7 / New features): Add entry.
2024-03-08 13:45:26 +03:00
Stefan Monnier 4fd8691941
lisp/ox-texinfo.el: Remove redundant `:group`s 2024-03-08 13:45:25 +03:00
Ihor Radchenko f90322377c
ox: Fix exporting code blocks with missing language specifier
* lisp/ox-latex.el (org-latex-inline-src-block): Export code blocks
without language as verbatim.
* lisp/ox-man.el (org-man-inline-src-block):
(org-man-src-block): Do not try to call source-highlight executable
when code block language is missing.
* lisp/ox-odt.el (org-odt-do-format-code):
* lisp/ox-texinfo.el (org-texinfo-src-block): Do not throw error when
code block language is missing.

Reproducer (not available on the list):

  To reproduce my problem you can write create an org-mode buffer (C-x b
  1.org M-x org-mode) with the following content:

  #+begin_src lua :tangle yes  :noweb yes
    aaa
    <<second>>
  #+end_src

  #+name: second
  #+begin_src
   bbb
  #+end_src

  Then enable exporting to texinfo and export the buffer:
    M-: (require 'ox-texinfo)
    C-c C-e i t

  The folllowing backtrace appears (providing you already enabled
  debugging on errors):

  Debugger entered--Lisp error: (wrong-type-argument stringp nil)
    apply(debug error (wrong-type-argument stringp nil))
    edebug(error (wrong-type-argument stringp nil))
    signal(wrong-type-argument (stringp nil))
    edebug-signal(wrong-type-argument (stringp nil))
    string-match("lisp" nil nil t)
    string-match-p("lisp" nil)
    (edebug-after (edebug-before 1) 5 (string-match-p "lisp" (edebug-after (edebug-before 2) 4
  (org-element-property :language (edebug-after 0 3 src-block)))))

Reported-by: pva-outdoor@yandex.ru
Link: https://list.orgmode.org/orgmode/87jzn7oz1u.fsf@yandex.ru/
2024-02-24 12:52:51 +03:00
Ihor Radchenko fd45bfa648
Acknowledge that Nicolas Goaziou is no longer maintaining Org libraries
* lisp/ox-ascii.el:
* lisp/ox-beamer.el:
* lisp/ox-icalendar.el:
* lisp/ox-md.el:
* lisp/ox-org.el:
* lisp/ox-publish.el:
* lisp/ox-texinfo.el:
* lisp/ox.el: Remove "Maintainer" line.
2024-02-14 13:41:21 +01:00
Kyle Meyer 72a2db86d9 Merge branch 'bugfix' 2024-01-06 16:02:02 -05:00
Po Lu 9f1d6dfd73 Backport commit 8e1c56ae4 from Emacs
; Add 2024 to copyright years
8e1c56ae46754dd7baedff49a464f078f0e9912d
Po Lu
Tue Jan 2 09:47:10 2024 +0800
2024-01-06 15:48:23 -05:00
Ihor Radchenko d2ce1c6ec1
lisp/ox-texinfo.el: Fix @menu in headlines without contents
* lisp/ox-texinfo.el (org-texinfo--normalize-headlines): Do not rely
upon undocumented implementation side-effects in `org-element-create'
that have been changed.

*
testing/lisp/test-ox-texinfo.el (test-ox-texinfo/normalize-headlines):
New test.

Reported-by: Jonas Bernoulli <jonas@bernoul.li>
Link: https://orgmode.org/list/87zfybnqwf.fsf@bernoul.li
2023-12-16 15:10:29 +01:00
Ihor Radchenko 4758255035
lisp/ox-texinfo.el (org-element-ast): Fix checkdoc warnings
Require org-element-ast explicitly to avoid checkdoc warnings for its
functions.  org-element-ast is indirectly loaded by ox->org-element,
but requiring it directly is indeed more clear.
2023-11-14 20:07:47 +02:00
Ihor Radchenko dbf415b840
Revert "org-texinfo--match-definition: Drop redundant `save-match-data'"
This reverts commit e32bd5f7c7.

This is `pcase-let*', not `pcase', so the arguments are _all_
evaluated and match data must be preserved in the ARGS binding.

Link: https://yhetil.org/emacs-devel/877cp8bkpa.fsf@bernoul.li
2023-09-02 20:07:07 +03:00
Ihor Radchenko e32bd5f7c7
org-texinfo--match-definition: Drop redundant `save-match-data'
* lisp/ox-texinfo.el (org-texinfo--match-definition): It is safe to
drop `save-match-data' as the function modifies the match data anyway,
and `save-match-data' does not affect anything else.
2023-08-29 12:38:04 +03:00
Ihor Radchenko bc29f5de41
org-element: New `org-element-*property*' functions
* lisp/org-element.el (org-element-begin):
(org-element-end):
(org-element-contents-begin):
(org-element-contents-end):
(org-element-post-affiliated):
(org-element-post-blank): New functions for fast access to frequently
used element properties.  The functions are `setf'-able.

Update all the relevant code in Org to use the new functions instead
of genetic property queries.
2023-07-01 14:35:43 +03:00
Ihor Radchenko 81a7e8c836
org-element-lineage: Allow TYPES to be a symbol
* lisp/org-element-ast.el (org-element-lineage): Allow TYPES argument
to be a symbol.
* lisp/ox-ascii.el (org-ascii--current-text-width):
(org-ascii-format-inlinetask-default):
(org-ascii-section):
* lisp/ox-beamer.el (org-beamer--format-block):
* lisp/ox-html.el (org-html-section):
(org-html-table-cell):
(org-html-table-row):
* lisp/ox-latex.el (org-latex-table-cell):
(org-latex-table-row):
* lisp/ox-odt.el (org-odt-headline):
(org-odt-table-style-spec):
(org-odt-get-table-cell-styles):
(org-odt-table-cell):
(org-odt-table-row):
* lisp/ox-org.el (org-org-section):
* lisp/ox-publish.el (org-publish-collect-index):
* lisp/ox-texinfo.el (org-texinfo--get-node):
(org-texinfo-section):
(org-texinfo-table-row):
* lisp/ox.el (org-export--skip-p):
(org-export-get-node-property):
(org-export-table-cell-borders):
(org-export-table-row-in-header-p):
(org-export-table-row-number):
(org-export-collect-headlines): Update all the callers.
2023-07-01 14:35:43 +03:00
Ihor Radchenko 2d22d7f515
ox.el: Rename `org-element-get-parent-element' and move to org-element
* lisp/org-element.el: Rename `org-element-get-parent-element' to
`org-element-parent-element'.
* lisp/org-compat.el (org-export-get-parent-element):
* lisp/ox.el (org-export-get-parent-element): Remove, adding obsolete
alias.
(org-export--skip-p):
* lisp/org-table.el:
* lisp/ox-beamer.el (org-beamer-link):
* lisp/ox-html.el (org-html-link):
* lisp/ox-latex.el (org-latex-footnote-reference):
* lisp/ox-md.el (org-md-link):
* lisp/ox-odt.el (org-odt-format-label):
(org-odt-link--inline-image):
(org-odt-link--inline-formula):
* lisp/ox-texinfo.el (org-texinfo--inline-image): Update all the
callers.
2023-07-01 14:35:42 +03:00
Ihor Radchenko ea4f4fdf58
Rename `org-export-get-parent' to `org-element-parent' 2023-07-01 14:35:41 +03:00
Ihor Radchenko 6a7aee2c35
org-texinfo--normalize-headlines: Use `org-element-create' 2023-07-01 14:35:40 +03:00
Ihor Radchenko a7d1dfa171
Use `org-element-type-p'
Use `org-element-type-p' across Org source, except some tests, where `eq' can
produce more meaningful failure explanations.
2023-07-01 14:35:35 +03:00
Ihor Radchenko c22697f472
Use new function names `org-element-extract' and `org-element-set' 2023-07-01 14:35:32 +03:00
Matthew Trzcinski 88c572de25 Create aliases for export region functions
lisp/ox-ascii.el: Create alias `org-export-region-to-ascii` for
`org-ascii-convert-region-to-ascii`.
lisp/ox-html.el: Create alias `org-export-region-to-html` for
`org-html-convert-region-to-html`.
lisp/ox-latex.el: Create alias `org-export-region-to-latex` for
`org-latex-convert-region-to-latex`.
lisp/ox-md.el: Create alias `org-export-region-to-md` for
`org-md-convert-region-to-md`.
lisp/ox-texinfo.el: Create alias `org-export-region-to-texinfo` for
`org-texinfo-convert-region-to-texinfo`.
doc/org-manual.org: Change commands from "*-convert-region-*" form to
the "org-export-region-to-*" aliases.  Add function index for aliases.
2023-06-29 21:18:01 +02:00
Ihor Radchenko 2c77551a68
org-texinfo-export-to-info: Fix docstring
* lisp/ox-texinfo.el (org-texinfo-export-to-info): Remove description
of a removed argument from the docstring.  The PUB-DIR argument has
been removed in 496ed832d.

Reported-by: Niall Dooley <dooleyn@gmail.com>
Link: https://list.orgmode.org/orgmode/CADS3Lq7W=LZYd3F3aA0p1RaDWdHSmwahvs8oyJfx_Hw0WF9K9Q@mail.gmail.com/
2023-06-02 10:23:57 +03:00
Ihor Radchenko 8037aab493
org-texinfo-export-to-info: Fix docstring
* lisp/ox-texinfo.el (org-texinfo-export-to-info): Remove description
of a removed argument from the docstring.  The PUB-DIR argument has
been removed in 496ed832d.

Reported-by: Niall Dooley <dooleyn@gmail.com>
Link: https://list.orgmode.org/orgmode/CADS3Lq7W=LZYd3F3aA0p1RaDWdHSmwahvs8oyJfx_Hw0WF9K9Q@mail.gmail.com/
2023-05-24 16:56:24 +02:00
Ihor Radchenko f81ba451a7
Prefer "backend" over "back-end"
* doc/org-manual.org (Exporting): Add cindex entry for both "backend"
and "back-end" for better searchability.

All other changes are trivial.

Note that `org-element-export-snippet-parser' will still use :back-end
property.  So will ox.el in INFO channel.
2023-04-20 14:11:19 +02:00
Ihor Radchenko 4c01eba265
org-texinfo-supports-math-p: Fix CI test failures
* lisp/ox-texinfo.el (org-texinfo-supports-math-p): Consider
compilation error as indication that math is not supported.  texinfo
compiler throws "unknown command `displaymath'" error in such case,
causing `org-texinfo-compile' to err as well.

Fixes CI tests failures when testing with Texinfo versions with no
math support.

https://builds.sr.ht/~bzg/job/959487
2023-03-19 13:58:07 +01:00
Rudolf Adamkovič 99c8ed09f8
ox-texinfo: Fix invalid syntax in Texinfo version detection code
* lisp/ox-texinfo.el (org-texinfo-supports-math-p): Fix the incorrect
syntax @displaymath{1 + 1 = 2} used to detect whether Texinfo supports
TeX "math mode".  Instead, use the correct syntax @math{1 + 1 = 2}.
2023-02-17 13:30:16 +03:00
Eli Zaretskii e0815d7545 Backport commit cae528457 from Emacs
; Add 2023 to copyright years.
cae528457cb862dc886a34240c9d4c73035b6659
Eli Zaretskii
Sun Jan 1 05:31:12 2023 -0500
2023-01-01 12:44:47 -05:00
Ihor Radchenko 5a10517d02
Add missing :package-version tags in changed `defcustom'
* lisp/ob-clojure.el (ob-clojure-babashka-command):
(ob-clojure-nbb-command):
* lisp/ob-exp.el (org-babel-exp-code-template):
* lisp/ob-latex.el (org-babel-latex-pdf-svg-process):
* lisp/org-agenda.el (org-agenda-show-outline-path):
* lisp/org-capture.el (org-capture-templates):
* lisp/org-clock.el (org-clocktable-defaults):
* lisp/org-persist.el (org-persist-directory):
(org-persist-remote-files):
(org-persist-default-expiry):
* lisp/org-refile.el (org-refile-use-outline-path):
* lisp/org-src.el (org-src-lang-modes):
* lisp/org.el (org-resource-download-policy):
(org-safe-remote-resources):
(org-time-stamp-custom-formats):
(org-property-separators):
(org-preview-latex-process-alist):
(org-structure-template-alist):
* lisp/ox-latex.el (org-latex-inline-image-rules):
(org-latex-src-block-backend):
(org-latex-engraved-options):
(org-latex-engraved-theme):
* lisp/ox-md.el (org-md-toplevel-hlevel):
* lisp/ox-texinfo.el (org-texinfo-with-latex): Add :package-version
keywords to the new custom options, and those with the value or
meaning changed.
2022-11-13 15:29:15 +08:00
Rudolf Adamkovič c940b460c7
ox-texinfo: Include LaTeX in Texinfo exports
* lisp/ox-texinfo.el (org-texinfo-with-latex): New customize.
* lisp/ox-texinfo.el (org-texinfo-latex-environment): New function.
* lisp/ox-texinfo.el (org-texinfo-latex-fragment): New function.
* lisp/ox-texinfo.el (org-texinfo-supports-math-p): New function.
* lisp/ox-texinfo.el (org-texinfo-supports-math--cache): New variable.
* lisp/ox-texinfo.el (texinfo): Set latex-environment.
* lisp/ox-texinfo.el (texinfo): Set latex-fragment.
* testing/lisp/test-ox-texinfo.el: Add basic tests.
2022-09-21 15:29:50 +08:00
Ihor Radchenko e81a094383
Assert all the Org files to load the same Org version
* lisp/org-compat.el (org-assert-version): New macro comparing Org
version at compile time and laod time.

Add `org-assert-version' call to all files:

* lisp/org-macs.el:
* lisp/org-crypt.el:
* lisp/org-ctags.el:
* lisp/org-cycle.el:
* lisp/org-datetree.el:
* lisp/org-duration.el:
* lisp/org-element.el (avl-tree):
* lisp/org-entities.el:
* lisp/org-faces.el:
* lisp/org-feed.el:
* lisp/org-fold-core.el:
* lisp/org-fold.el:
* lisp/org-footnote.el:
* lisp/org-goto.el:
* lisp/org-habit.el:
* lisp/org-id.el:
* lisp/org-indent.el:
* lisp/org-inlinetask.el:
* lisp/org-keys.el:
* lisp/org-lint.el:
* lisp/org-list.el:
* lisp/org-macro.el:
* lisp/org-mobile.el:
* lisp/org-mouse.el:
* lisp/org-num.el:
* lisp/org-pcomplete.el:
* lisp/org-persist.el:
* lisp/org-plot.el:
* lisp/org-protocol.el:
* lisp/org-refile.el:
* lisp/org-src.el:
* lisp/org-table.el:
* lisp/org-tempo.el:
* lisp/org-timer.el:
* lisp/org.el:
* lisp/ox-ascii.el:
* lisp/ox-beamer.el:
* lisp/ox-html.el:
* lisp/ox-icalendar.el:
* lisp/ox-koma-letter.el:
* lisp/ox-latex.el:
* lisp/ox-man.el:
* lisp/ox-md.el:
* lisp/ox-odt.el:
* lisp/ox-org.el:
* lisp/ox-publish.el:
* lisp/ox-texinfo.el:
* lisp/ox.el:
2022-09-04 12:24:55 +08:00
Stefan Kangas 41e19f1d7a
; Fix typos 2022-07-01 17:42:52 +08:00
Jonas Bernoulli 98588ebfe1 ox-texinfo: Allow enabling compact syntax for @itemx per file
* doc/org-manual.org (Plain lists in Texinfo export): Document the
:texinfo-compact-itemx export option and variable
org-texinfo-compact-itemx.
(Texinfo specific properties): Mention new export option and variable.
* lisp/ox-texinfo.el: Add org-texinfo-compact-itemx to the
:options-alist of the texinfo backend.
* lisp/ox-texinfo.el (org-texinfo-compact-itemx): New option.
* lisp/ox-texinfo.el (org-texinfo--massage-key-item): Add INFO
argument and use the :texinfo-compact-itemx export option.
* lisp/ox-texinfo.el (org-texinfo-item): Use the
:texinfo-compact-itemx export option.
2022-02-09 00:38:23 +01:00
Jonas Bernoulli 1312e1a938 ox-texinfo: Define definition commands using description lists
* doc/org-manual.org (Plain lists in Texinfo export): Document use
of definition command prefixes in description lists.
* lisp/ox-texinfo.el: Add org-texinfo--separate-definitions to the
list of :filter-parse-tree functions of the texinfo backend.
* lisp/ox-texinfo.el (org-texinfo--definition-command-alist)
(org-texinfo--definition-command-regexp): New variables.
* lisp/ox-texinfo.el (org-texinfo--separate-definitions)
(org-texinfo--match-definition, org-texinfo--split-definition)
(org-texinfo--split-plain-list, org-texinfo--massage-key-item):
New functions.
2022-02-09 00:35:59 +01:00
Jonas Bernoulli e52743fb30 ox-texinfo: Optionally use @itemx for certain description list items
* doc/org-manual.org (Plain lists in Texinfo export): Reorder and
document new functionality.
* lisp/ox-texinfo.el (org-texinfo-item): In a description list when
its :compact attribute is non-nil, then transcode consecutive items
using one @item and one or more @itemx commands, if all of them
except for the last one lack content.
2022-02-08 22:45:36 +01:00
Jonas Bernoulli 3d0f592de7 ox-texinfo: Add function for use by kbd macro
* doc/doc-setup.org: Use org-texinfo-kbd-macro for kbd macro.
* doc/org-manual.org: Add new node "Key bindings in Texinfo export".
* lisp/ox-texinfo.el (org-texinfo--quoted-keys-regexp): New variable.
* lisp/ox-texinfo.el (org-texinfo-kbd-macro): New function.
2022-02-08 22:45:27 +01:00
Kyle Meyer aae2ac3a68 Merge branch 'bugfix' 2022-01-01 15:21:37 -05:00
Kyle Meyer 5a229cbc44 Update copyright year to 2022 2022-01-01 15:17:08 -05:00
Nicolas Goaziou 96e022bbe0 Merge branch 'bugfix' 2021-12-10 10:29:41 +01:00
Sébastien Miquel 8d189720b2 ox: Fix async export with native compilation
* lisp/ox-beamer.el (org-beamer-export-to-pdf):
* lisp/ox-icalendar.el (org-icalendar-export-to-ics):
* lisp/ox-koma-letter.el (org-koma-letter-export-to-pdf):
* lisp/ox-man.el (org-man-export-to-pdf):
* lisp/ox-texinfo.el (org-texinfo-export-to-info): Quote lambda.

Quote or name lambdas to prevent their compilation into anonymous
functions which cannot be passed to the external async emacs process.
2021-12-10 10:22:53 +01:00
Bastien 8b78d482a6 Fix email addresses in some *.el headers 2021-10-03 08:54:33 +02:00
Bastien 806ac1b7f6 *el: Fix indentation 2021-09-29 09:22:47 +02:00
Stefan Kangas 51cdd6e30f Various minor docfixes found by checkdoc 2021-09-16 21:24:59 +02:00
Nicolas Goaziou f70e36252a Merge branch 'maint' 2021-06-02 17:22:41 +02:00
Nicolas Goaziou 093c94e31b texinfo: Fix off-by-one error
* lisp/ox-texinfo.el (org-texinfo--menu-entries): Fix off-by-one
error.

This is a follow-up to f99f26306c.

Reported-by: Jonas Bernoulli <jonas@bernoul.li>
<http://lists.gnu.org/r/emacs-orgmode/2021-05/msg01290.html>
2021-06-02 17:21:15 +02:00
Bastien c9be80ceb0 Add Nicolas as the maintainer for a few ox-*.el files
* lisp/ox.el:
* lisp/ox-texinfo.el:
* lisp/ox-publish.el:
* lisp/ox-org.el:
* lisp/ox-md.el:
* lisp/ox-icalendar.el:
* lisp/ox-beamer.el:
* lisp/ox-ascii.el: Add Nicolas as the maintainer.
2021-05-03 06:41:56 +02:00
Nicolas Goaziou e3153145f4 Merge branch 'maint' 2021-04-30 15:51:20 +02:00
Nicolas Goaziou e266fac1ed ox-texinfo: Property display images with relative file names
* lisp/ox-texinfo.el (org-texinfo--inline-image): Make sure to remove
leading "./" from file name.

Reported-by: Ramesh Nedunchezian <rameshnedunchezian@outlook.com>
<http://lists.gnu.org/r/emacs-orgmode/2021-04/msg00873.html>
2021-04-30 15:50:25 +02:00
Nicolas Goaziou f918ba1094 Merge branch 'maint' 2021-04-19 14:34:43 +02:00
Nicolas Goaziou a89d96e6a5 texinfo: Consider any variation on "Top" a reserved node name
* lisp/ox-texinfo.el (org-texinfo--get-node): Change node name if it
conflicts with variations like "top", since they also appear to be
reserved by Texinfo.
2021-04-19 14:32:53 +02:00
Nicolas Goaziou b33face41c Merge branch 'maint' 2021-04-13 00:37:16 +02:00
Nicolas Goaziou 6dbd132e62 ox-texinfo: Fix footnotes ending on a special environment
* lisp/ox-texinfo.el (org-texinfo-footnote-reference): Prevent
a footnote from ending on an "@end" line.

Reported-by: Ramesh Nedunchezian <rameshnedunchezian@outlook.com>
<http://lists.gnu.org/r/emacs-orgmode/2021-04/msg00228.html>
2021-04-13 00:36:31 +02:00
Nicolas Goaziou bf98b12d5c Merge branch 'maint' 2021-04-10 12:29:28 +02:00