* Texinfo: Custom navigation and links in headings
@ 2024-08-22 18:20 Rudolf Adamkovič
2024-08-23 7:08 ` Rudolf Adamkovič
0 siblings, 1 reply; 9+ messages in thread
From: Rudolf Adamkovič @ 2024-08-22 18:20 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 617 bytes --]
Howdy!
I would like to contribute two patches for the Texinfo exporter:
1. Custom, or disabled, Texinfo navigation.
This enables the user to, e.g.
- put a top-level tree to a wider "Up" context, or
- hide "Next" and "Previous" for a group of unrelated headings, or
- build deeper hierarchies if needed.
2. Links in Texinfo section names.
Importantly, this also applies to
sub-`h:' headings,
which are exported as plain lists.
(Note: Links are a bit buggy on the Texinfo side, but that is not an
Org issue; they are supported, and I find them useful.)
Thank you.
Rudy
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ox-texinfo-Add-support-for-custom-navigation-hierarc.patch --]
[-- Type: text/x-patch, Size: 8523 bytes --]
From 1c4fc3979ea26ca93742b16d9c135ec62a8b4d0b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= <rudolf@adamkovic.org>
Date: Thu, 22 Aug 2024 12:27:01 +0200
Subject: [PATCH 1/2] ox-texinfo: Add support for custom navigation hierarchies
* doc/org-manual.org (Headings and sectioning structure): Describe the
new functionality in detail.
* etc/ORG-NEWS (Texinfo exports can have custom navigation
hierarchies): Inform end users about the new functionality.
* lisp/org.el (org-default-properties): Offer the `ALT_TITLE' and
`ALT_NAVIGATION' properties for completion.
* lisp/ox-texinfo.el (org-texinfo-headline): Use the `ALT_NAVIGATION'
property when generating Texinfo notes to set the Next, Previous, and
Up pointers of the relevant Texinfo node.
* testing/lisp/test-ox-texinfo.el (test-ox-texinfo/alt-title):
(test-ox-texinfo/alt-navigation/all-directions):
(test-ox-texinfo/alt-navigation/one-direction):
(test-ox-texinfo/alt-navigation/no-directions):
(test-ox-texinfo/alt-navigation/with-alt-title): Test the new
functionality to avoid regressions in the future.
---
doc/org-manual.org | 23 ++++++++
etc/ORG-NEWS | 7 +++
lisp/org.el | 3 +-
lisp/ox-texinfo.el | 5 +-
testing/lisp/test-ox-texinfo.el | 99 +++++++++++++++++++++++++++++++++
5 files changed, 135 insertions(+), 2 deletions(-)
diff --git a/doc/org-manual.org b/doc/org-manual.org
index 9365c66b1..9b53c13c1 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -15999,6 +15999,29 @@ the node in which a reader enters an Info manual. As such, it is
expected not to appear in printed output generated from the =.texi=
file. See [[info:texinfo::The Top Node]], for more information.
+#+cindex: @samp{ALT_NAVIGATION}, property
+By default, Texinfo automatically sets the /Next/, /Previous/, and
+/Up/ pointers, reflecting the hierarchy of your document. If you want
+it to reflect a different hierarchy, or no hierarchy at all, set the
+=ALT_NAVIGATION= property to a list of at most 3 titles, separated by
+commas, to be used for the /Next/, /Previous/, and /Up/ pointers,
+respectively. For example:
+
+#+begin_example
+,* Mathematical Logic
+ :PROPERTIES:
+ :ALT_TITLE: Logic
+ :END:
+
+,* Proposition
+ :PROPERTIES:
+ :ALT_NAVIGATION: ,, Logic
+ :END:
+
+ - /Next/ and /Previous/ disabled.
+ - /Up/ leads to [[Mathematical Logic]].
+#+end_example
+
*** Indices
:PROPERTIES:
:DESCRIPTION: Creating indices.
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 392788055..25dd3ae49 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -77,6 +77,13 @@ You can now create links to =shortdoc= documentation groups for Emacs
Lisp functions (see =M-x shortdoc-display-group=). Requires Emacs 28
or newer.
+*** Texinfo exports can have custom navigation hierarchies
+
+You can now alter the Texinfo navigation hierarchy by specifying the
+/Next/, /Previous/, and /Up/ pointers in the =ALT_NAVIGATION=
+property. For more information, see "13.14.6 Headings and sectioning
+structure" section of the Org manual.
+
** New and changed options
# Chanes deadling with changing default values of customizations,
diff --git a/lisp/org.el b/lisp/org.el
index d5c1dcb35..dcd05571e 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -12691,7 +12691,8 @@ but in some other way.")
"EXPORT_TITLE" "EXPORT_AUTHOR" "EXPORT_DATE" "UNNUMBERED"
"ORDERED" "NOBLOCKING" "COOKIE_DATA" "LOG_INTO_DRAWER" "REPEAT_TO_STATE"
"CLOCK_MODELINE_TOTAL" "STYLE" "HTML_CONTAINER_CLASS"
- "ORG-IMAGE-ACTUAL-WIDTH")
+ "ORG-IMAGE-ACTUAL-WIDTH"
+ "ALT_TITLE" "ALT_NAVIGATION")
"Some properties that are used by Org mode for various purposes.
Being in this list makes sure that they are offered for completion.")
diff --git a/lisp/ox-texinfo.el b/lisp/ox-texinfo.el
index 6adee9fca..43fdf27ae 100644
--- a/lisp/ox-texinfo.el
+++ b/lisp/ox-texinfo.el
@@ -1102,6 +1102,7 @@ holding contextual information."
(full-text
(funcall (plist-get info :texinfo-format-headline-function)
todo todo-type priority text tags))
+ (navigation (org-element-property :ALT_NAVIGATION headline))
(contents
(concat "\n"
(if (org-string-nw-p contents) (concat "\n" contents) "")
@@ -1118,7 +1119,9 @@ holding contextual information."
(concat
;; Even if HEADLINE is using @subheading and al., leave an
;; anchor so cross-references in the Org document still work.
- (format (if notoc? "@anchor{%s}\n" "@node %s\n") node)
+ (format (if notoc? "@anchor{%s}" "@node %s") node)
+ (if navigation (concat "," navigation) "")
+ "\n"
(format command full-text)
contents))))))
diff --git a/testing/lisp/test-ox-texinfo.el b/testing/lisp/test-ox-texinfo.el
index b16a344e7..352df378f 100644
--- a/testing/lisp/test-ox-texinfo.el
+++ b/testing/lisp/test-ox-texinfo.el
@@ -345,5 +345,104 @@ body
(should-not (org-element-contents section))
(should (eq first-heading (org-element-parent section)))))))
+\f
+;;; Alternative title and navigation
+
+(ert-deftest test-ox-texinfo/alt-title ()
+ "Test alternative titles."
+ (should
+ (org-test-with-temp-text
+ (string-join
+ (list "* Title 1"
+ ":PROPERTIES:"
+ ":ALT_TITLE: Title 2"
+ ":END:")
+ "\n")
+ (let ((export-buffer "*Test Texinfo Export*")
+ (org-export-show-temporary-export-buffer nil))
+ (org-export-to-buffer 'texinfo export-buffer
+ nil nil nil nil nil
+ #'texinfo-mode)
+ (with-current-buffer export-buffer
+ (goto-char (point-min))
+ (search-forward "@node Title 2"))))))
+
+(ert-deftest test-ox-texinfo/alt-navigation/all-directions ()
+ "Test alternative navigation in all directions."
+ (should
+ (org-test-with-temp-text
+ (string-join
+ (list "* Title"
+ ":PROPERTIES:"
+ ":ALT_NAVIGATION: Next,Previous,Up"
+ ":END:")
+ "\n")
+ (let ((export-buffer "*Test Texinfo Export*")
+ (org-export-show-temporary-export-buffer nil))
+ (org-export-to-buffer 'texinfo export-buffer
+ nil nil nil nil nil
+ #'texinfo-mode)
+ (with-current-buffer export-buffer
+ (goto-char (point-min))
+ (search-forward "@node Title,Next,Previous,Up"))))))
+
+(ert-deftest test-ox-texinfo/alt-navigation/one-direction ()
+ "Test alternative navigation in only one direction."
+ (should
+ (org-test-with-temp-text
+ (string-join
+ (list "* Title"
+ ":PROPERTIES:"
+ ":ALT_NAVIGATION: ,, Up"
+ ":END:")
+ "\n")
+ (let ((export-buffer "*Test Texinfo Export*")
+ (org-export-show-temporary-export-buffer nil))
+ (org-export-to-buffer 'texinfo export-buffer
+ nil nil nil nil nil
+ #'texinfo-mode)
+ (with-current-buffer export-buffer
+ (goto-char (point-min))
+ (search-forward "@node Title,,, Up"))))))
+
+(ert-deftest test-ox-texinfo/alt-navigation/no-directions ()
+ "Test alternative navigation with all directions disabled."
+ (should
+ (org-test-with-temp-text
+ (string-join
+ (list "* Title"
+ ":PROPERTIES:"
+ ":ALT_NAVIGATION: ,,,"
+ ":END:")
+ "\n")
+ (let ((export-buffer "*Test Texinfo Export*")
+ (org-export-show-temporary-export-buffer nil))
+ (org-export-to-buffer 'texinfo export-buffer
+ nil nil nil nil nil
+ #'texinfo-mode)
+ (with-current-buffer export-buffer
+ (goto-char (point-min))
+ (search-forward "@node Title,,,"))))))
+
+(ert-deftest test-ox-texinfo/alt-navigation/with-alt-title ()
+ "Test alternative navigation combined with alternative titles."
+ (should
+ (org-test-with-temp-text
+ (string-join
+ (list "* Title 1"
+ ":PROPERTIES:"
+ ":ALT_TITLE: Title 2"
+ ":ALT_NAVIGATION: Next,Previous,Up"
+ ":END:")
+ "\n")
+ (let ((export-buffer "*Test Texinfo Export*")
+ (org-export-show-temporary-export-buffer nil))
+ (org-export-to-buffer 'texinfo export-buffer
+ nil nil nil nil nil
+ #'texinfo-mode)
+ (with-current-buffer export-buffer
+ (goto-char (point-min))
+ (search-forward "@node Title 2,Next,Previous,Up"))))))
+
(provide 'test-ox-texinfo)
;;; test-ox-texinfo.el end here
--
2.39.3 (Apple Git-146)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-ox-texinfo-Add-support-for-links-in-titles.patch --]
[-- Type: text/x-patch, Size: 4792 bytes --]
From ecd8df5bd46feeb8951005bc4929b1384d16bad6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= <rudolf@adamkovic.org>
Date: Thu, 22 Aug 2024 18:11:35 +0200
Subject: [PATCH 2/2] ox-texinfo: Add support for links in titles
* etc/ORG-NEWS (Texinfo export backend now allows links to be used in
headings): Inform end users about the new functionality.
* lisp/ox-texinfo.el:
(org-texinfo--format-entries):
(org-texinfo--get-node):
(org-texinfo--sanitize-title-reference):
(org-texinfo--sanitize-title): A 2-step change: (1) Rename
`--sanitize-title' to `--sanitize-title-reference' and (2) create a
new `--sanitize-title' sanitation function. The new function is less
strict in that does not remove links, which should be allowed in
sectioning commands, such as `@unnumbered'. The old function remains
more strict, which is useful for generating `@node' names, for
example.
* testing/lisp/test-ox-texinfo.el:
(test-ox-texinfo/headings-with-links): Test the new functionality to
avoid regressions in the future.
---
etc/ORG-NEWS | 4 ++++
lisp/ox-texinfo.el | 17 +++++++++++++++--
testing/lisp/test-ox-texinfo.el | 28 ++++++++++++++++++++++++++++
3 files changed, 47 insertions(+), 2 deletions(-)
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 25dd3ae49..b6d9c54ef 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -230,6 +230,10 @@ This way, attachments will remain accessible when opening symlinked Org file.
When no attach dir exists, Org mode will still prefer creating it in
the "default" directory - where the symlink is located.
+*** Texinfo export can have links in headings
+
+The Texinfo export backend no longer removes links from headings.
+
* Version 9.7
** Important announcements and breaking changes
diff --git a/lisp/ox-texinfo.el b/lisp/ox-texinfo.el
index 43fdf27ae..4a02e7b04 100644
--- a/lisp/ox-texinfo.el
+++ b/lisp/ox-texinfo.el
@@ -524,7 +524,7 @@ node or anchor name is unique."
(org-texinfo--sanitize-node
(pcase (org-element-type datum)
(`headline
- (org-texinfo--sanitize-title
+ (org-texinfo--sanitize-title-reference
(org-export-get-alt-title datum info) info))
(`radio-target
(org-export-data (org-element-contents datum) info))
@@ -569,6 +569,19 @@ periods, commas and colons."
(defun org-texinfo--sanitize-title (title info)
"Make TITLE suitable as a section name.
TITLE is a string or a secondary string. INFO is the current
+export state, as a plist."
+ (org-export-data-with-backend
+ title
+ (org-export-create-backend
+ :parent 'texinfo
+ :transcoders `((footnote-reference . ,#'ignore)
+ (radio-target . ,(lambda (_r c _) c))
+ (target . ,#'ignore)))
+ info))
+
+(defun org-texinfo--sanitize-title-reference (title info)
+ "Make TITLE suitable as a section reference.
+TITLE is a string or a secondary string. INFO is the current
export state, as a plist."
(org-export-data-with-backend
title (org-export-toc-entry-backend 'texinfo) info))
@@ -1471,7 +1484,7 @@ a plist containing contextual information."
;; name. Remove them.
(replace-regexp-in-string
"[ \t]*:+" ""
- (org-texinfo--sanitize-title
+ (org-texinfo--sanitize-title-reference
(org-export-get-alt-title h info) info)))
(node (org-texinfo--get-node h info))
(entry (concat "* " title ":"
diff --git a/testing/lisp/test-ox-texinfo.el b/testing/lisp/test-ox-texinfo.el
index 352df378f..f22448681 100644
--- a/testing/lisp/test-ox-texinfo.el
+++ b/testing/lisp/test-ox-texinfo.el
@@ -444,5 +444,33 @@ body
(goto-char (point-min))
(search-forward "@node Title 2,Next,Previous,Up"))))))
+\f
+;;; Headings with links
+
+(ert-deftest test-ox-texinfo/headings-with-links ()
+ "Test node and chapter names."
+ (should
+ (org-test-with-temp-text
+ (string-join
+ (list "* Heading 1"
+ " ...."
+ "* Heading 2 ([[* Heading 1][Heading 1]])"
+ " ....")
+ "\n")
+ (let ((export-buffer "*Test Texinfo Export*")
+ (org-export-show-temporary-export-buffer nil))
+ (org-export-to-buffer 'texinfo export-buffer
+ nil nil nil nil nil
+ #'texinfo-mode)
+ (with-current-buffer export-buffer
+ (goto-char (point-min))
+ (search-forward "* Heading 1::")
+ (search-forward "* Heading 2 (Heading 1)::")
+ (search-forward "@node Heading 1")
+ (search-forward "@chapter Heading 1")
+ (search-forward "@node Heading 2 (Heading 1)")
+ (search-forward "@chapter Heading 2 (@ref{Heading 1})")
+ (buffer-string))))))
+
(provide 'test-ox-texinfo)
;;; test-ox-texinfo.el end here
--
2.39.3 (Apple Git-146)
[-- Attachment #4: Type: text/plain, Size: 173 bytes --]
--
"Thinking is a momentary dismissal of irrelevancies."
--- Richard Buckminster Fuller, 1969
Rudolf Adamkovič <rudolf@adamkovic.org> [he/him]
http://adamkovic.org
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: Texinfo: Custom navigation and links in headings
2024-08-22 18:20 Texinfo: Custom navigation and links in headings Rudolf Adamkovič
@ 2024-08-23 7:08 ` Rudolf Adamkovič
2024-08-23 12:45 ` Rudolf Adamkovič
0 siblings, 1 reply; 9+ messages in thread
From: Rudolf Adamkovič @ 2024-08-23 7:08 UTC (permalink / raw)
To: emacs-orgmode
Rudolf Adamkovič <rudolf@adamkovic.org> writes:
> 1. Custom, or disabled, Texinfo navigation.
I found a bug where
the Top node ignores ALT_NAVIGATION.
This is because the node
is treated separately in `ox-texinfo.el'.
I will fix the bug it today.
Cheers!
Rudy
--
"I love deadlines. I love the whooshing noise they make as they go by."
--- Douglas Adams, The Salmon of Doubt, 2002
Rudolf Adamkovic <rudolf@adamkovic.org> [he/him]
http://adamkovic.org
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Texinfo: Custom navigation and links in headings
2024-08-23 7:08 ` Rudolf Adamkovič
@ 2024-08-23 12:45 ` Rudolf Adamkovič
2024-08-24 6:46 ` [PATCH] Re: Texinfo: Custom navigation and links in headings (was: Texinfo: Custom navigation and links in headings) Rudolf Adamkovič
0 siblings, 1 reply; 9+ messages in thread
From: Rudolf Adamkovič @ 2024-08-23 12:45 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 421 bytes --]
Rudolf Adamkovič <rudolf@adamkovic.org> writes:
> I found a bug where
>
> the Top node ignores ALT_NAVIGATION.
>
> This is because the node
>
> is treated separately in `ox-texinfo.el'.
>
> I will fix the bug it today.
And fixed! Please see the attached patches.
(I also fixed commit messages, indentation, etc.)
The patches are
ready for code review
now.
Thank you!
Rudy
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ox-texinfo-Add-support-for-custom-navigation-hierarc.patch --]
[-- Type: text/x-patch, Size: 12055 bytes --]
From ba13b7a50d515db99a5cdd0dea19ea98b76d68b8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= <rudolf@adamkovic.org>
Date: Thu, 22 Aug 2024 12:27:01 +0200
Subject: [PATCH 1/2] ox-texinfo: Add support for custom navigation hierarchies
* doc/org-manual.org (Headings and sectioning structure): Describe the
new feature in detail.
* etc/ORG-NEWS (Texinfo exports can have custom navigation
hierarchies): Inform end users about the new feature.
* lisp/org.el (org-default-properties): Offer the `ALT_TITLE' and
`ALT_NAVIGATION' properties for completion.
* lisp/ox-texinfo.el (org-texinfo-headline, org-texinfo-template): Use
the `ALT_NAVIGATION' property when generating Texinfo notes to set the
Next, Previous, and Up pointers of the relevant Texinfo node.
(org-texinfo--match-definition, org-texinfo-item): Fix indentation.
* testing/lisp/test-ox-texinfo.el (test-ox-texinfo/alt-title,
test-ox-texinfo/alt-navigation/all-directions,
test-ox-texinfo/alt-navigation/one-direction,
test-ox-texinfo/alt-navigation/no-directions,
test-ox-texinfo/alt-navigation/with-alt-title,
test-ox-texinfo/alt-navigation/top/default,
test-ox-texinfo/alt-navigation/top/default): Test the new feature to
avoid regressions in the future.
---
doc/org-manual.org | 23 ++++++
etc/ORG-NEWS | 7 ++
lisp/org.el | 3 +-
lisp/ox-texinfo.el | 21 +++--
testing/lisp/test-ox-texinfo.el | 133 ++++++++++++++++++++++++++++++++
5 files changed, 181 insertions(+), 6 deletions(-)
diff --git a/doc/org-manual.org b/doc/org-manual.org
index 9365c66b1..9b53c13c1 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -15999,6 +15999,29 @@ the node in which a reader enters an Info manual. As such, it is
expected not to appear in printed output generated from the =.texi=
file. See [[info:texinfo::The Top Node]], for more information.
+#+cindex: @samp{ALT_NAVIGATION}, property
+By default, Texinfo automatically sets the /Next/, /Previous/, and
+/Up/ pointers, reflecting the hierarchy of your document. If you want
+it to reflect a different hierarchy, or no hierarchy at all, set the
+=ALT_NAVIGATION= property to a list of at most 3 titles, separated by
+commas, to be used for the /Next/, /Previous/, and /Up/ pointers,
+respectively. For example:
+
+#+begin_example
+,* Mathematical Logic
+ :PROPERTIES:
+ :ALT_TITLE: Logic
+ :END:
+
+,* Proposition
+ :PROPERTIES:
+ :ALT_NAVIGATION: ,, Logic
+ :END:
+
+ - /Next/ and /Previous/ disabled.
+ - /Up/ leads to [[Mathematical Logic]].
+#+end_example
+
*** Indices
:PROPERTIES:
:DESCRIPTION: Creating indices.
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 392788055..25dd3ae49 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -77,6 +77,13 @@ You can now create links to =shortdoc= documentation groups for Emacs
Lisp functions (see =M-x shortdoc-display-group=). Requires Emacs 28
or newer.
+*** Texinfo exports can have custom navigation hierarchies
+
+You can now alter the Texinfo navigation hierarchy by specifying the
+/Next/, /Previous/, and /Up/ pointers in the =ALT_NAVIGATION=
+property. For more information, see "13.14.6 Headings and sectioning
+structure" section of the Org manual.
+
** New and changed options
# Chanes deadling with changing default values of customizations,
diff --git a/lisp/org.el b/lisp/org.el
index d5c1dcb35..dcd05571e 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -12691,7 +12691,8 @@ but in some other way.")
"EXPORT_TITLE" "EXPORT_AUTHOR" "EXPORT_DATE" "UNNUMBERED"
"ORDERED" "NOBLOCKING" "COOKIE_DATA" "LOG_INTO_DRAWER" "REPEAT_TO_STATE"
"CLOCK_MODELINE_TOTAL" "STYLE" "HTML_CONTAINER_CLASS"
- "ORG-IMAGE-ACTUAL-WIDTH")
+ "ORG-IMAGE-ACTUAL-WIDTH"
+ "ALT_TITLE" "ALT_NAVIGATION")
"Some properties that are used by Org mode for various purposes.
Being in this list makes sure that they are offered for completion.")
diff --git a/lisp/ox-texinfo.el b/lisp/ox-texinfo.el
index 6adee9fca..a396d93d3 100644
--- a/lisp/ox-texinfo.el
+++ b/lisp/ox-texinfo.el
@@ -652,7 +652,7 @@ The car is the command and the cdr is its arguments."
(string-match org-texinfo--definition-command-regexp tag)
(pcase-let*
((cmd (car (rassoc (match-string-no-properties 1 tag)
- org-texinfo--definition-command-alist)))
+ org-texinfo--definition-command-alist)))
(`(,cmd ,category)
(and cmd (save-match-data (split-string cmd " "))))
(args (match-string-no-properties 2 tag)))
@@ -799,7 +799,7 @@ holding export options."
(org-export-data copying info))))
(let* ((dircat (or (plist-get info :texinfo-dircat) "Misc"))
(file (or (org-strip-quotes (plist-get info :texinfo-filename))
- (plist-get info :output-file)))
+ (plist-get info :output-file)))
(file (if file (file-name-sans-extension file)))
(dn (or (plist-get info :texinfo-dirname)
(plist-get info :texinfo-dirtitle))) ;Obsolete name.
@@ -875,7 +875,15 @@ holding export options."
;; Configure Top Node when not for TeX. Also include contents
;; from the first section of the document.
"@ifnottex\n"
- "@node Top\n"
+ ;; Top node.
+ "@node Top"
+ (if-let ((top-navigation
+ (org-element-map (plist-get info :parse-tree) 'org-data
+ (lambda (data)
+ (org-element-property :ALT_NAVIGATION data))
+ info t)))
+ (concat ", " top-navigation))
+ "\n"
(format "@top %s\n" title)
(let* ((first-section
(org-element-map (plist-get info :parse-tree) 'section
@@ -1102,6 +1110,7 @@ holding contextual information."
(full-text
(funcall (plist-get info :texinfo-format-headline-function)
todo todo-type priority text tags))
+ (navigation (org-element-property :ALT_NAVIGATION headline))
(contents
(concat "\n"
(if (org-string-nw-p contents) (concat "\n" contents) "")
@@ -1118,7 +1127,9 @@ holding contextual information."
(concat
;; Even if HEADLINE is using @subheading and al., leave an
;; anchor so cross-references in the Org document still work.
- (format (if notoc? "@anchor{%s}\n" "@node %s\n") node)
+ (format (if notoc? "@anchor{%s}" "@node %s") node)
+ (if navigation (concat ", " navigation) "")
+ "\n"
(format command full-text)
contents))))))
@@ -1189,7 +1200,7 @@ contextual information."
(compact (and (eq (org-element-property :type plain-list) 'descriptive)
(or (plist-get info :texinfo-compact-itemx)
(org-not-nil (org-export-read-attribute
- :attr_texinfo plain-list :compact)))))
+ :attr_texinfo plain-list :compact)))))
(previous-item nil))
(when (and compact
(org-export-get-next-element item info)
diff --git a/testing/lisp/test-ox-texinfo.el b/testing/lisp/test-ox-texinfo.el
index b16a344e7..fe931baa4 100644
--- a/testing/lisp/test-ox-texinfo.el
+++ b/testing/lisp/test-ox-texinfo.el
@@ -345,5 +345,138 @@ body
(should-not (org-element-contents section))
(should (eq first-heading (org-element-parent section)))))))
+\f
+;;; Alternative title and navigation
+
+(ert-deftest test-ox-texinfo/alt-title ()
+ "Test alternative titles."
+ (should
+ (org-test-with-temp-text
+ (string-join
+ (list "* Title 1"
+ ":PROPERTIES:"
+ ":ALT_TITLE: Title 2"
+ ":END:")
+ "\n")
+ (let ((export-buffer "*Test Texinfo Export*")
+ (org-export-show-temporary-export-buffer nil))
+ (org-export-to-buffer 'texinfo export-buffer
+ nil nil nil nil nil
+ #'texinfo-mode)
+ (with-current-buffer export-buffer
+ (goto-char (point-min))
+ (search-forward "@node Title 2"))))))
+
+(ert-deftest test-ox-texinfo/alt-navigation/all-directions ()
+ "Test alternative navigation in all directions."
+ (should
+ (org-test-with-temp-text
+ (string-join
+ (list "* Title"
+ ":PROPERTIES:"
+ ":ALT_NAVIGATION: Next, Previous, Up"
+ ":END:")
+ "\n")
+ (let ((export-buffer "*Test Texinfo Export*")
+ (org-export-show-temporary-export-buffer nil))
+ (org-export-to-buffer 'texinfo export-buffer
+ nil nil nil nil nil
+ #'texinfo-mode)
+ (with-current-buffer export-buffer
+ (goto-char (point-min))
+ (search-forward "@node Title, Next, Previous, Up"))))))
+
+(ert-deftest test-ox-texinfo/alt-navigation/one-direction ()
+ "Test alternative navigation in only one direction."
+ (should
+ (org-test-with-temp-text
+ (string-join
+ (list "* Title"
+ ":PROPERTIES:"
+ ":ALT_NAVIGATION: ,, Up"
+ ":END:")
+ "\n")
+ (let ((export-buffer "*Test Texinfo Export*")
+ (org-export-show-temporary-export-buffer nil))
+ (org-export-to-buffer 'texinfo export-buffer
+ nil nil nil nil nil
+ #'texinfo-mode)
+ (with-current-buffer export-buffer
+ (goto-char (point-min))
+ (search-forward "@node Title, ,, Up"))))))
+
+(ert-deftest test-ox-texinfo/alt-navigation/no-directions ()
+ "Test alternative navigation with all directions disabled."
+ (should
+ (org-test-with-temp-text
+ (string-join
+ (list "* Title"
+ ":PROPERTIES:"
+ ":ALT_NAVIGATION: ,,"
+ ":END:")
+ "\n")
+ (let ((export-buffer "*Test Texinfo Export*")
+ (org-export-show-temporary-export-buffer nil))
+ (org-export-to-buffer 'texinfo export-buffer
+ nil nil nil nil nil
+ #'texinfo-mode)
+ (with-current-buffer export-buffer
+ (goto-char (point-min))
+ (search-forward "@node Title, ,,"))))))
+
+(ert-deftest test-ox-texinfo/alt-navigation/with-alt-title ()
+ "Test alternative navigation combined with alternative titles."
+ (should
+ (org-test-with-temp-text
+ (string-join
+ (list "* Title 1"
+ ":PROPERTIES:"
+ ":ALT_TITLE: Title 2"
+ ":ALT_NAVIGATION: Next, Previous, Up"
+ ":END:")
+ "\n")
+ (let ((export-buffer "*Test Texinfo Export*")
+ (org-export-show-temporary-export-buffer nil))
+ (org-export-to-buffer 'texinfo export-buffer
+ nil nil nil nil nil
+ #'texinfo-mode)
+ (with-current-buffer export-buffer
+ (goto-char (point-min))
+ (search-forward "@node Title 2, Next, Previous, Up"))))))
+
+
+(ert-deftest test-ox-texinfo/alt-navigation/top-node/default ()
+ "Test alternative navigation when not set at the top level."
+ (should
+ (org-test-with-temp-text "Hello world!"
+ (let ((export-buffer "*Test Texinfo Export*")
+ (org-export-show-temporary-export-buffer nil))
+ (org-export-to-buffer 'texinfo export-buffer
+ nil nil nil nil nil
+ #'texinfo-mode)
+ (with-current-buffer export-buffer
+ (goto-char (point-min))
+ (re-search-forward "^@node Top$"))))))
+
+(ert-deftest test-ox-texinfo/alt-navigation/top-node/custom ()
+ "Test alternative navigation when set at the top level."
+ (should
+ (org-test-with-temp-text
+ (string-join
+ (list ":PROPERTIES:"
+ ":ALT_NAVIGATION: Next, Previous, Up"
+ ":END:"
+ "#+TITLE: Title"
+ "* Headline")
+ "\n")
+ (let ((export-buffer "*Test Texinfo Export*")
+ (org-export-show-temporary-export-buffer nil))
+ (org-export-to-buffer 'texinfo export-buffer
+ nil nil nil nil nil
+ #'texinfo-mode)
+ (with-current-buffer export-buffer
+ (goto-char (point-min))
+ (re-search-forward "^@node Top, Next, Previous, Up$"))))))
+
(provide 'test-ox-texinfo)
;;; test-ox-texinfo.el end here
--
2.39.3 (Apple Git-146)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-ox-texinfo-Add-support-for-links-in-titles.patch --]
[-- Type: text/x-patch, Size: 4784 bytes --]
From 25170ef19a54909fd49c26de50d9396dc63ed3c1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= <rudolf@adamkovic.org>
Date: Thu, 22 Aug 2024 18:11:35 +0200
Subject: [PATCH 2/2] ox-texinfo: Add support for links in titles
* etc/ORG-NEWS (Texinfo export backend now allows links to be used in
headings): Inform end users about the new feature.
* lisp/ox-texinfo.el: (org-texinfo--format-entries,
org-texinfo--get-node, org-texinfo--sanitize-title-reference,
org-texinfo--sanitize-title): A 2-step change: (1) Rename
`--sanitize-title' to `--sanitize-title-reference' and (2) create a
new `--sanitize-title' sanitation function. The new function is less
strict in that does not remove links, which should be allowed in
sectioning commands, such as `@unnumbered'. The old function remains
more strict, which is useful for generating `@node' names, for
example.
* testing/lisp/test-ox-texinfo.el:
(test-ox-texinfo/headings-with-links): Test the new functionality to
avoid regressions in the future.
---
etc/ORG-NEWS | 4 ++++
lisp/ox-texinfo.el | 17 +++++++++++++++--
testing/lisp/test-ox-texinfo.el | 28 ++++++++++++++++++++++++++++
3 files changed, 47 insertions(+), 2 deletions(-)
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 25dd3ae49..b6d9c54ef 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -230,6 +230,10 @@ This way, attachments will remain accessible when opening symlinked Org file.
When no attach dir exists, Org mode will still prefer creating it in
the "default" directory - where the symlink is located.
+*** Texinfo export can have links in headings
+
+The Texinfo export backend no longer removes links from headings.
+
* Version 9.7
** Important announcements and breaking changes
diff --git a/lisp/ox-texinfo.el b/lisp/ox-texinfo.el
index a396d93d3..e39d7da97 100644
--- a/lisp/ox-texinfo.el
+++ b/lisp/ox-texinfo.el
@@ -524,7 +524,7 @@ node or anchor name is unique."
(org-texinfo--sanitize-node
(pcase (org-element-type datum)
(`headline
- (org-texinfo--sanitize-title
+ (org-texinfo--sanitize-title-reference
(org-export-get-alt-title datum info) info))
(`radio-target
(org-export-data (org-element-contents datum) info))
@@ -569,6 +569,19 @@ periods, commas and colons."
(defun org-texinfo--sanitize-title (title info)
"Make TITLE suitable as a section name.
TITLE is a string or a secondary string. INFO is the current
+export state, as a plist."
+ (org-export-data-with-backend
+ title
+ (org-export-create-backend
+ :parent 'texinfo
+ :transcoders `((footnote-reference . ,#'ignore)
+ (radio-target . ,(lambda (_r c _) c))
+ (target . ,#'ignore)))
+ info))
+
+(defun org-texinfo--sanitize-title-reference (title info)
+ "Make TITLE suitable as a section reference.
+TITLE is a string or a secondary string. INFO is the current
export state, as a plist."
(org-export-data-with-backend
title (org-export-toc-entry-backend 'texinfo) info))
@@ -1479,7 +1492,7 @@ a plist containing contextual information."
;; name. Remove them.
(replace-regexp-in-string
"[ \t]*:+" ""
- (org-texinfo--sanitize-title
+ (org-texinfo--sanitize-title-reference
(org-export-get-alt-title h info) info)))
(node (org-texinfo--get-node h info))
(entry (concat "* " title ":"
diff --git a/testing/lisp/test-ox-texinfo.el b/testing/lisp/test-ox-texinfo.el
index fe931baa4..f70abba50 100644
--- a/testing/lisp/test-ox-texinfo.el
+++ b/testing/lisp/test-ox-texinfo.el
@@ -478,5 +478,33 @@ body
(goto-char (point-min))
(re-search-forward "^@node Top, Next, Previous, Up$"))))))
+\f
+;;; Headings with links
+
+(ert-deftest test-ox-texinfo/headings-with-links ()
+ "Test node and chapter names."
+ (should
+ (org-test-with-temp-text
+ (string-join
+ (list "* Heading 1"
+ " ...."
+ "* Heading 2 ([[* Heading 1][Heading 1]])"
+ " ....")
+ "\n")
+ (let ((export-buffer "*Test Texinfo Export*")
+ (org-export-show-temporary-export-buffer nil))
+ (org-export-to-buffer 'texinfo export-buffer
+ nil nil nil nil nil
+ #'texinfo-mode)
+ (with-current-buffer export-buffer
+ (goto-char (point-min))
+ (search-forward "* Heading 1::")
+ (search-forward "* Heading 2 (Heading 1)::")
+ (search-forward "@node Heading 1")
+ (search-forward "@chapter Heading 1")
+ (search-forward "@node Heading 2 (Heading 1)")
+ (search-forward "@chapter Heading 2 (@ref{Heading 1})")
+ (buffer-string))))))
+
(provide 'test-ox-texinfo)
;;; test-ox-texinfo.el end here
--
2.39.3 (Apple Git-146)
[-- Attachment #4: Type: text/plain, Size: 214 bytes --]
--
"All you have to do is write one true sentence. Write the truest
sentence that you know." --- Ernest Miller Hemingway (1899-1961)
Rudolf Adamkovič <rudolf@adamkovic.org> [he/him]
http://adamkovic.org
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH] Re: Texinfo: Custom navigation and links in headings (was: Texinfo: Custom navigation and links in headings)
2024-08-23 12:45 ` Rudolf Adamkovič
@ 2024-08-24 6:46 ` Rudolf Adamkovič
2024-08-24 9:19 ` [PATCH] Re: Texinfo: Custom navigation and links in headings Rudolf Adamkovič
0 siblings, 1 reply; 9+ messages in thread
From: Rudolf Adamkovič @ 2024-08-24 6:46 UTC (permalink / raw)
To: emacs-orgmode
Rudolf Adamkovič <rudolf@adamkovic.org> writes:
> The patches are
>
> ready for code review
>
> now.
Now with '[PATCH]' in the subject. :)
Rudy
--
"I do not fear death. I had been dead for billions and billions of
years before I was born, and had not suffered the slightest
inconvenience from it." --- Mark Twain, paraphrased
Rudolf Adamkovič <rudolf@adamkovic.org> [he/him]
http://adamkovic.org
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Re: Texinfo: Custom navigation and links in headings
2024-08-24 6:46 ` [PATCH] Re: Texinfo: Custom navigation and links in headings (was: Texinfo: Custom navigation and links in headings) Rudolf Adamkovič
@ 2024-08-24 9:19 ` Rudolf Adamkovič
2024-08-24 19:54 ` [PATCH v3] Improvements to Texinfo exporter (was: [PATCH] Re: Texinfo: Custom navigation and links in headings) Rudolf Adamkovič
0 siblings, 1 reply; 9+ messages in thread
From: Rudolf Adamkovič @ 2024-08-24 9:19 UTC (permalink / raw)
To: emacs-orgmode
Rudolf Adamkovič <rudolf@adamkovic.org> writes:
> The patches are
>
> ready for code review
>
> now.
I found yet another bug.
All three
node names in `ALT_NAVIGATION'
must go through `org-texinfo--sanitize-node',
otherwise various characters cause
"Up reference to nonexistent `NODE NAME'
errors.
I will fix the bug today.
Rudy
--
"Simplicity is complexity resolved."
--- Constantin Brâncuși, 1876-1957
Rudolf Adamkovič <rudolf@adamkovic.org> [he/him]
http://adamkovic.org
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v3] Improvements to Texinfo exporter (was: [PATCH] Re: Texinfo: Custom navigation and links in headings)
2024-08-24 9:19 ` [PATCH] Re: Texinfo: Custom navigation and links in headings Rudolf Adamkovič
@ 2024-08-24 19:54 ` Rudolf Adamkovič
2024-08-30 13:19 ` Rudolf Adamkovič
0 siblings, 1 reply; 9+ messages in thread
From: Rudolf Adamkovič @ 2024-08-24 19:54 UTC (permalink / raw)
To: emacs-orgmode; +Cc: yantar92
[-- Attachment #1: Type: text/plain, Size: 580 bytes --]
Rudolf Adamkovič <rudolf@adamkovic.org> writes:
> I will fix the bug today.
And fixed.
CHANGE 1/3
I split `ALT_NAVIGATION' to
`ALT_NEXT'
`ALT_PREVIOUS'
`ALT_UP'
to support commas in node names.
(I am open to renaming to `TEXINFO_UP', etc.)
CHANGE 2/3
I added a 3rd patch that makes
numeric values of `toc' in `#+OPTIONS'
work out of the box, like in e.g. HTML exports.
CHANGE 3/3
Further, I
improved commit messages, documentation,
and the like.
Ready for review ... again!
Rudy
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ox-texinfo-Support-alternative-navigation.patch --]
[-- Type: text/x-patch, Size: 19270 bytes --]
From 7a8692ec67360414143524d49a098fd99fce03a3 Mon Sep 17 00:00:00 2001
From: Rudolf Adamkovic <rudolf@adamkovic.org>
Date: Sat, 24 Aug 2024 21:35:44 +0200
Subject: [PATCH 1/3] ox-texinfo: Support alternative navigation
* doc/org-manual.org (Headings and sectioning structure): Describe the
new feature.
* etc/ORG-NEWS (Texinfo exports can use alternative navigation):
Announce the new feature.
* lisp/ox-texinfo.el (org-texinfo-headline, org-texinfo-template): Use
the `ALT_NEXT', `ALT_PREVIOUS', and `ALT_UP' Org properties when
generating Texinfo @node lines for Next, Previous, and Up pointers.
* testing/lisp/test-ox-texinfo.el (test-ox-texinfo/alt-title,
test-ox-texinfo/alt-navigation/all-directions,
test-ox-texinfo/alt-navigation/one-direction,
test-ox-texinfo/alt-navigation/no-directions,
test-ox-texinfo/alt-navigation/with-alt-title,
test-ox-texinfo/alt-navigation/top/default,
test-ox-texinfo/alt-navigation/top/default): Test the new feature to
avoid regressions in the future.
---
doc/org-manual.org | 20 +++
etc/ORG-NEWS | 8 +
lisp/ox-texinfo.el | 103 +++++++-----
testing/lisp/test-ox-texinfo.el | 290 ++++++++++++++++++++++++++++++++
4 files changed, 382 insertions(+), 39 deletions(-)
diff --git a/doc/org-manual.org b/doc/org-manual.org
index 9365c66b1..049454624 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -15999,6 +15999,26 @@ the node in which a reader enters an Info manual. As such, it is
expected not to appear in printed output generated from the =.texi=
file. See [[info:texinfo::The Top Node]], for more information.
+#+cindex: @samp{ALT_NEXT}, property
+#+cindex: @samp{ALT_PREVIOUS}, property
+#+cindex: @samp{ALT_UP}, property
+Texinfo automatically sets the /Next/, /Previous/, and /Up/ pointers,
+reflecting the hierarchy of your document. If you want to use a
+different hierarchy, or no hierarchy at all, set the =ALT_NEXT=,
+=ALT_PREVIOUS=, and =ALT_UP= properties to the relevant titles. For
+example:
+
+#+begin_example
+,* Mathematical Logic
+ :PROPERTIES:
+ :ALT_TITLE: Logic
+ :END:
+,* Proposition
+ :PROPERTIES:
+ :ALT_UP: Logic
+ :END:
+#+end_example
+
*** Indices
:PROPERTIES:
:DESCRIPTION: Creating indices.
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 392788055..49dafcd5d 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -77,6 +77,14 @@ You can now create links to =shortdoc= documentation groups for Emacs
Lisp functions (see =M-x shortdoc-display-group=). Requires Emacs 28
or newer.
+*** Texinfo exports can use alternative navigation
+
+You can now alter the Texinfo navigation hierarchy by specifying the
+/Next/, /Previous/, and /Up/ pointers in the =ALT_NEXT=,
+=ALT_PREVIOUS=, and =ALT_UP= properties, respectively. For more
+information, see "13.14.6 Headings and sectioning structure" section
+of the Org manual.
+
** New and changed options
# Chanes deadling with changing default values of customizations,
diff --git a/lisp/ox-texinfo.el b/lisp/ox-texinfo.el
index 6adee9fca..808dc22f6 100644
--- a/lisp/ox-texinfo.el
+++ b/lisp/ox-texinfo.el
@@ -512,46 +512,63 @@ INFO is a plist used as a communication channel. See
;; Else use format string.
(fmt (format fmt text))))
+(defun org-texinfo--node-line (headline info)
+ "Return node line for HEADLINE.
+
+INFO is a plist used as a communication channel."
+ (let ((next (org-element-property :ALT_NEXT headline))
+ (previous (org-element-property :ALT_PREVIOUS headline))
+ (up (org-element-property :ALT_UP headline)))
+ (string-trim-right
+ (concat (format "@node %s" (org-texinfo--get-node headline info))
+ (if (or next previous up) ", ")
+ (and next (org-texinfo--sanitize-node next))
+ (if (or previous up) ", ")
+ (and previous (org-texinfo--sanitize-node previous))
+ (if (or up) ", ")
+ (and up (org-texinfo--sanitize-node up))))))
+
(defun org-texinfo--get-node (datum info)
"Return node or anchor associated to DATUM.
-DATUM is a headline, a radio-target or a target. INFO is a plist
-used as a communication channel. The function guarantees the
+DATUM is org-data (root), a headline, a radio-target or a target. INFO
+is a plist used as a communication channel. The function guarantees the
node or anchor name is unique."
- (let ((cache (plist-get info :texinfo-node-cache)))
- (or (cdr (assq datum cache))
- (let* ((salt 0)
- (basename
- (org-texinfo--sanitize-node
- (pcase (org-element-type datum)
- (`headline
- (org-texinfo--sanitize-title
- (org-export-get-alt-title datum info) info))
- (`radio-target
- (org-export-data (org-element-contents datum) info))
- (`target
- (org-element-property :value datum))
- (_
- (or (org-element-property :name datum)
- (org-export-get-reference datum info))))))
- (name basename))
- ;; Org exports deeper elements before their parents. If two
- ;; node names collide -- e.g., they have the same title --
- ;; within the same hierarchy, the second one would get the
- ;; smaller node name. This is counter-intuitive.
- ;; Consequently, we ensure that every parent headline gets
- ;; its node beforehand. As a recursive operation, this
- ;; achieves the desired effect.
- (let ((parent (org-element-lineage datum 'headline)))
- (when (and parent (not (assq parent cache)))
- (org-texinfo--get-node parent info)
- (setq cache (plist-get info :texinfo-node-cache))))
- ;; Ensure NAME is unique and not reserved node name "Top",
- ;; no matter what case is used.
- (while (or (string-equal "Top" (capitalize name))
- (rassoc name cache))
- (setq name (concat basename (format " (%d)" (cl-incf salt)))))
- (plist-put info :texinfo-node-cache (cons (cons datum name) cache))
- name))))
+ (if (eq (org-element-type datum) 'org-data) "Top"
+ (let ((cache (plist-get info :texinfo-node-cache)))
+ (or (cdr (assq datum cache))
+ (let* ((salt 0)
+ (basename
+ (org-texinfo--sanitize-node
+ (pcase (org-element-type datum)
+ (`headline
+ (org-texinfo--sanitize-title
+ (org-export-get-alt-title datum info) info))
+ (`radio-target
+ (org-export-data (org-element-contents datum) info))
+ (`target
+ (org-element-property :value datum))
+ (_
+ (or (org-element-property :name datum)
+ (org-export-get-reference datum info))))))
+ (name basename))
+ ;; Org exports deeper elements before their parents. If
+ ;; two node names collide -- e.g., they have the same
+ ;; title -- within the same hierarchy, the second one
+ ;; would get the smaller node name. This is
+ ;; counter-intuitive. Consequently, we ensure that every
+ ;; parent headline gets its node beforehand. As a
+ ;; recursive operation, this achieves the desired effect.
+ (let ((parent (org-element-lineage datum 'headline)))
+ (when (and parent (not (assq parent cache)))
+ (org-texinfo--get-node parent info)
+ (setq cache (plist-get info :texinfo-node-cache))))
+ ;; Ensure NAME is unique and not reserved node name "Top",
+ ;; no matter what case is used.
+ (while (or (string-equal "Top" (capitalize name))
+ (rassoc name cache))
+ (setq name (concat basename (format " (%d)" (cl-incf salt)))))
+ (plist-put info :texinfo-node-cache (cons (cons datum name) cache))
+ name)))))
(defun org-texinfo--sanitize-node (title)
"Bend string TITLE to node line requirements.
@@ -875,7 +892,12 @@ holding export options."
;; Configure Top Node when not for TeX. Also include contents
;; from the first section of the document.
"@ifnottex\n"
- "@node Top\n"
+ ;; Top node.
+ (org-element-map (plist-get info :parse-tree) 'org-data
+ (lambda (root)
+ (org-texinfo--node-line root info))
+ info t)
+ "\n"
(format "@top %s\n" title)
(let* ((first-section
(org-element-map (plist-get info :parse-tree) 'section
@@ -1118,7 +1140,10 @@ holding contextual information."
(concat
;; Even if HEADLINE is using @subheading and al., leave an
;; anchor so cross-references in the Org document still work.
- (format (if notoc? "@anchor{%s}\n" "@node %s\n") node)
+ (if notoc?
+ (format "@anchor{%s}" node)
+ (org-texinfo--node-line headline info))
+ "\n"
(format command full-text)
contents))))))
diff --git a/testing/lisp/test-ox-texinfo.el b/testing/lisp/test-ox-texinfo.el
index b16a344e7..fb0269649 100644
--- a/testing/lisp/test-ox-texinfo.el
+++ b/testing/lisp/test-ox-texinfo.el
@@ -345,5 +345,295 @@ body
(should-not (org-element-contents section))
(should (eq first-heading (org-element-parent section)))))))
+\f
+;;; Alternative title and navigation
+
+(ert-deftest test-ox-texinfo/alt-title ()
+ "Test alternative titles."
+ (should
+ (org-test-with-temp-text
+ (string-join
+ (list "* Title 1"
+ ":PROPERTIES:"
+ ":ALT_TITLE: Title 2"
+ ":END:")
+ "\n")
+ (let ((export-buffer "*Test Texinfo Export*")
+ (org-export-show-temporary-export-buffer nil))
+ (org-export-to-buffer 'texinfo export-buffer
+ nil nil nil nil nil
+ #'texinfo-mode)
+ (with-current-buffer export-buffer
+ (goto-char (point-min))
+ (re-search-forward "^@node Title 2$"))))))
+
+(ert-deftest test-ox-texinfo/alt-title/sanitized ()
+ "Test sanitized alternative titles."
+ (should
+ (org-test-with-temp-text
+ (string-join
+ (list "* Title 1"
+ ":PROPERTIES:"
+ ":ALT_TITLE: (Foo:) Bar, baz."
+ ":END:")
+ "\n")
+ (let ((export-buffer "*Test Texinfo Export*")
+ (org-export-show-temporary-export-buffer nil))
+ (org-export-to-buffer 'texinfo export-buffer
+ nil nil nil nil nil
+ #'texinfo-mode)
+ (with-current-buffer export-buffer
+ (goto-char (point-min))
+ (re-search-forward "^@node \\[Foo) Bar baz$"))))))
+
+(ert-deftest test-ox-texinfo/alt-navigation/next ()
+ "Test alternative navigation to Next nodes."
+ (should
+ (org-test-with-temp-text
+ (string-join
+ (list "* Title"
+ ":PROPERTIES:"
+ ":ALT_NEXT: Next"
+ ":END:")
+ "\n")
+ (let ((export-buffer "*Test Texinfo Export*")
+ (org-export-show-temporary-export-buffer nil))
+ (org-export-to-buffer 'texinfo export-buffer
+ nil nil nil nil nil
+ #'texinfo-mode)
+ (with-current-buffer export-buffer
+ (goto-char (point-min))
+ (re-search-forward "^@node Title, Next$"))))))
+
+(ert-deftest test-ox-texinfo/alt-navigation/next/sanitized ()
+ "Test sanitized alternative navigation to Next nodes."
+ (should
+ (org-test-with-temp-text
+ (string-join
+ (list "* Title 1"
+ ":PROPERTIES:"
+ ":ALT_NEXT: (Foo:) Bar, baz."
+ ":END:")
+ "\n")
+ (let ((export-buffer "*Test Texinfo Export*")
+ (org-export-show-temporary-export-buffer nil))
+ (org-export-to-buffer 'texinfo export-buffer
+ nil nil nil nil nil
+ #'texinfo-mode)
+ (with-current-buffer export-buffer
+ (goto-char (point-min))
+ (re-search-forward "^@node Title 1, \\[Foo) Bar baz$"))))))
+
+(ert-deftest test-ox-texinfo/alt-navigation/next/with-previous ()
+ "Test alternative navigation to Next and Previous nodes."
+ (should
+ (org-test-with-temp-text
+ (string-join
+ (list "* Title"
+ ":PROPERTIES:"
+ ":ALT_NEXT: Next"
+ ":ALT_PREVIOUS: Previous"
+ ":END:")
+ "\n")
+ (let ((export-buffer "*Test Texinfo Export*")
+ (org-export-show-temporary-export-buffer nil))
+ (org-export-to-buffer 'texinfo export-buffer
+ nil nil nil nil nil
+ #'texinfo-mode)
+ (with-current-buffer export-buffer
+ (goto-char (point-min))
+ (re-search-forward "^@node Title, Next, Previous$"))))))
+
+(ert-deftest test-ox-texinfo/alt-navigation/next/with-previous-and-up ()
+ "Test alternative navigation to Next, Previous, and Up nodes."
+ (should
+ (org-test-with-temp-text
+ (string-join
+ (list "* Title"
+ ":PROPERTIES:"
+ ":ALT_NEXT: Next"
+ ":ALT_PREVIOUS: Previous"
+ ":ALT_UP: Up"
+ ":END:")
+ "\n")
+ (let ((export-buffer "*Test Texinfo Export*")
+ (org-export-show-temporary-export-buffer nil))
+ (org-export-to-buffer 'texinfo export-buffer
+ nil nil nil nil nil
+ #'texinfo-mode)
+ (with-current-buffer export-buffer
+ (goto-char (point-min))
+ (re-search-forward "^@node Title, Next, Previous, Up$"))))))
+
+(ert-deftest test-ox-texinfo/alt-navigation/previous ()
+ "Test alternative navigation to Previous nodes."
+ (should
+ (org-test-with-temp-text
+ (string-join
+ (list "* Title"
+ ":PROPERTIES:"
+ ":ALT_PREVIOUS: Previous"
+ ":END:")
+ "\n")
+ (let ((export-buffer "*Test Texinfo Export*")
+ (org-export-show-temporary-export-buffer nil))
+ (org-export-to-buffer 'texinfo export-buffer
+ nil nil nil nil nil
+ #'texinfo-mode)
+ (with-current-buffer export-buffer
+ (goto-char (point-min))
+ (re-search-forward "^@node Title, , Previous$"))))))
+
+(ert-deftest test-ox-texinfo/alt-navigation/previous/sanitized ()
+ "Test sanitized alternative navigation to Previous nodes."
+ (should
+ (org-test-with-temp-text
+ (string-join
+ (list "* Title 1"
+ ":PROPERTIES:"
+ ":ALT_PREVIOUS: (Foo:) Bar, baz."
+ ":END:")
+ "\n")
+ (let ((export-buffer "*Test Texinfo Export*")
+ (org-export-show-temporary-export-buffer nil))
+ (org-export-to-buffer 'texinfo export-buffer
+ nil nil nil nil nil
+ #'texinfo-mode)
+ (with-current-buffer export-buffer
+ (goto-char (point-min))
+ (re-search-forward "^@node Title 1, , \\[Foo) Bar baz$"))))))
+
+(ert-deftest test-ox-texinfo/alt-navigation/previous/with-up ()
+ "Test alternative navigation to Previous and Up nodes."
+ (should
+ (org-test-with-temp-text
+ (string-join
+ (list "* Title"
+ ":PROPERTIES:"
+ ":ALT_PREVIOUS: Previous"
+ ":ALT_UP: Up"
+ ":END:")
+ "\n")
+ (let ((export-buffer "*Test Texinfo Export*")
+ (org-export-show-temporary-export-buffer nil))
+ (org-export-to-buffer 'texinfo export-buffer
+ nil nil nil nil nil
+ #'texinfo-mode)
+ (with-current-buffer export-buffer
+ (goto-char (point-min))
+ (re-search-forward "^@node Title, , Previous, Up$"))))))
+
+(ert-deftest test-ox-texinfo/alt-navigation/up ()
+ "Test alternative navigation to Up nodes."
+ (should
+ (org-test-with-temp-text
+ (string-join
+ (list "* Title"
+ ":PROPERTIES:"
+ ":ALT_UP: Up"
+ ":END:")
+ "\n")
+ (let ((export-buffer "*Test Texinfo Export*")
+ (org-export-show-temporary-export-buffer nil))
+ (org-export-to-buffer 'texinfo export-buffer
+ nil nil nil nil nil
+ #'texinfo-mode)
+ (with-current-buffer export-buffer
+ (goto-char (point-min))
+ (re-search-forward "^@node Title, , , Up$"))))))
+
+(ert-deftest test-ox-texinfo/alt-navigation/up/sanitized ()
+ "Test sanitized alternative navigation to Up nodes."
+ (should
+ (org-test-with-temp-text
+ (string-join
+ (list "* Title 1"
+ ":PROPERTIES:"
+ ":ALT_UP: (Foo:) Bar, baz."
+ ":END:")
+ "\n")
+ (let ((export-buffer "*Test Texinfo Export*")
+ (org-export-show-temporary-export-buffer nil))
+ (org-export-to-buffer 'texinfo export-buffer
+ nil nil nil nil nil
+ #'texinfo-mode)
+ (with-current-buffer export-buffer
+ (goto-char (point-min))
+ (re-search-forward "^@node Title 1, , , \\[Foo) Bar baz$"))))))
+
+(ert-deftest test-ox-texinfo/alt-navigation/no-pointers ()
+ "Test alternative navigation with no pointers."
+ (should
+ (org-test-with-temp-text
+ (string-join
+ (list "* Title"
+ ":PROPERTIES:"
+ ":ALT_NEXT:"
+ ":END:")
+ "\n")
+ (let ((export-buffer "*Test Texinfo Export*")
+ (org-export-show-temporary-export-buffer nil))
+ (org-export-to-buffer 'texinfo export-buffer
+ nil nil nil nil nil
+ #'texinfo-mode)
+ (with-current-buffer export-buffer
+ (goto-char (point-min))
+ (re-search-forward "^@node Title,$"))))))
+
+(ert-deftest test-ox-texinfo/alt-navigation/top-node/not-set ()
+ "Test alternative navigation for Top nodes, when not set."
+ (should
+ (org-test-with-temp-text "Hello world!"
+ (let ((export-buffer "*Test Texinfo Export*")
+ (org-export-show-temporary-export-buffer nil))
+ (org-export-to-buffer 'texinfo export-buffer
+ nil nil nil nil nil
+ #'texinfo-mode)
+ (with-current-buffer export-buffer
+ (goto-char (point-min))
+ (re-search-forward "^@node Top$"))))))
+
+(ert-deftest test-ox-texinfo/alt-navigation/top-node/set ()
+ "Test alternative navigation for Top nodes, when set."
+ (should
+ (org-test-with-temp-text
+ (string-join
+ (list ":PROPERTIES:"
+ ":ALT_NEXT: Next"
+ ":ALT_PREVIOUS: Previous"
+ ":ALT_UP: Up"
+ ":END:"
+ "#+TITLE: Title"
+ "* Headline")
+ "\n")
+ (let ((export-buffer "*Test Texinfo Export*")
+ (org-export-show-temporary-export-buffer nil))
+ (org-export-to-buffer 'texinfo export-buffer
+ nil nil nil nil nil
+ #'texinfo-mode)
+ (with-current-buffer export-buffer
+ (goto-char (point-min))
+ (re-search-forward "^@node Top, Next, Previous, Up$"))))))
+
+(ert-deftest test-ox-texinfo/alt-navigation/with-alt-title ()
+ "Test alternative navigation combined with alternative titles."
+ (should
+ (org-test-with-temp-text
+ (string-join
+ (list "* Title 1"
+ ":PROPERTIES:"
+ ":ALT_TITLE: Title 2"
+ ":ALT_UP: Title 3"
+ ":END:")
+ "\n")
+ (let ((export-buffer "*Test Texinfo Export*")
+ (org-export-show-temporary-export-buffer nil))
+ (org-export-to-buffer 'texinfo export-buffer
+ nil nil nil nil nil
+ #'texinfo-mode)
+ (with-current-buffer export-buffer
+ (goto-char (point-min))
+ (re-search-forward "^@node Title 2, , , Title 3$"))))))
+
(provide 'test-ox-texinfo)
;;; test-ox-texinfo.el end here
--
2.39.3 (Apple Git-146)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-ox-texinfo-Support-links-in-headings.patch --]
[-- Type: text/x-patch, Size: 4859 bytes --]
From 3b9c3753df9580805ec763c0deaacaac0cfc38e1 Mon Sep 17 00:00:00 2001
From: Rudolf Adamkovic <rudolf@adamkovic.org>
Date: Sat, 24 Aug 2024 21:37:29 +0200
Subject: [PATCH 2/3] ox-texinfo: Support links in headings
* etc/ORG-NEWS (Texinfo exporter now supports links in headings):
Announce the new feature.
* lisp/ox-texinfo.el: (org-texinfo--format-entries,
org-texinfo--get-node, org-texinfo--sanitize-title-reference,
org-texinfo--sanitize-title): A 2-step change: (1) Rename
`--sanitize-title' to `--sanitize-title-reference' and (2) create a
new `--sanitize-title' sanitation function. The new function is less
strict in that does not remove links, which should be allowed in
sectioning commands, such as `@unnumbered'. The old function remains
more strict, which is useful for generating `@node' names, for
example.
* testing/lisp/test-ox-texinfo.el:
(test-ox-texinfo/headings-with-links): Test the new functionality to
avoid regressions in the future.
---
etc/ORG-NEWS | 6 ++++++
lisp/ox-texinfo.el | 17 +++++++++++++++--
testing/lisp/test-ox-texinfo.el | 28 ++++++++++++++++++++++++++++
3 files changed, 49 insertions(+), 2 deletions(-)
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 49dafcd5d..0ae1e4c81 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -231,6 +231,12 @@ This way, attachments will remain accessible when opening symlinked Org file.
When no attach dir exists, Org mode will still prefer creating it in
the "default" directory - where the symlink is located.
+*** Texinfo exporter now supports links in headings
+
+The Texinfo exporter no longer removes links from headings. This
+applies to all headings, below and above the =H= and =toc= export
+=#+OPTIONS:=.
+
* Version 9.7
** Important announcements and breaking changes
diff --git a/lisp/ox-texinfo.el b/lisp/ox-texinfo.el
index 808dc22f6..2e316d204 100644
--- a/lisp/ox-texinfo.el
+++ b/lisp/ox-texinfo.el
@@ -541,7 +541,7 @@ node or anchor name is unique."
(org-texinfo--sanitize-node
(pcase (org-element-type datum)
(`headline
- (org-texinfo--sanitize-title
+ (org-texinfo--sanitize-title-reference
(org-export-get-alt-title datum info) info))
(`radio-target
(org-export-data (org-element-contents datum) info))
@@ -586,6 +586,19 @@ periods, commas and colons."
(defun org-texinfo--sanitize-title (title info)
"Make TITLE suitable as a section name.
TITLE is a string or a secondary string. INFO is the current
+export state, as a plist."
+ (org-export-data-with-backend
+ title
+ (org-export-create-backend
+ :parent 'texinfo
+ :transcoders `((footnote-reference . ,#'ignore)
+ (radio-target . ,(lambda (_r c _) c))
+ (target . ,#'ignore)))
+ info))
+
+(defun org-texinfo--sanitize-title-reference (title info)
+ "Make TITLE suitable as a section reference.
+TITLE is a string or a secondary string. INFO is the current
export state, as a plist."
(org-export-data-with-backend
title (org-export-toc-entry-backend 'texinfo) info))
@@ -1493,7 +1506,7 @@ a plist containing contextual information."
;; name. Remove them.
(replace-regexp-in-string
"[ \t]*:+" ""
- (org-texinfo--sanitize-title
+ (org-texinfo--sanitize-title-reference
(org-export-get-alt-title h info) info)))
(node (org-texinfo--get-node h info))
(entry (concat "* " title ":"
diff --git a/testing/lisp/test-ox-texinfo.el b/testing/lisp/test-ox-texinfo.el
index fb0269649..4a521b3ed 100644
--- a/testing/lisp/test-ox-texinfo.el
+++ b/testing/lisp/test-ox-texinfo.el
@@ -635,5 +635,33 @@ body
(goto-char (point-min))
(re-search-forward "^@node Title 2, , , Title 3$"))))))
+\f
+;;; Headings with links
+
+(ert-deftest test-ox-texinfo/headings-with-links ()
+ "Test node and chapter names."
+ (should
+ (org-test-with-temp-text
+ (string-join
+ (list "* Heading 1"
+ " ...."
+ "* Heading 2 ([[* Heading 1][Heading 1]])"
+ " ....")
+ "\n")
+ (let ((export-buffer "*Test Texinfo Export*")
+ (org-export-show-temporary-export-buffer nil))
+ (org-export-to-buffer 'texinfo export-buffer
+ nil nil nil nil nil
+ #'texinfo-mode)
+ (with-current-buffer export-buffer
+ (goto-char (point-min))
+ (and
+ (re-search-forward "^* Heading 1::$")
+ (re-search-forward "^* Heading 2 (Heading 1)::$")
+ (re-search-forward "^@node Heading 1$")
+ (re-search-forward "^@chapter Heading 1$")
+ (re-search-forward "^@node Heading 2 (Heading 1)$")
+ (re-search-forward "^@chapter Heading 2 (@ref{Heading 1})$")))))))
+
(provide 'test-ox-texinfo)
;;; test-ox-texinfo.el end here
--
2.39.3 (Apple Git-146)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0003-ox-texinfo-Support-numeric-values-of-toc-in-OPTIONS.patch --]
[-- Type: text/x-patch, Size: 5719 bytes --]
From a45ed0eaa84144a5a34324d54aa326d5476ac5c2 Mon Sep 17 00:00:00 2001
From: Rudolf Adamkovic <rudolf@adamkovic.org>
Date: Sat, 24 Aug 2024 15:26:18 +0200
Subject: [PATCH 3/3] ox-texinfo: Support numeric values of `toc' in
`#+OPTIONS'
* etc/ORG-NEWS (Texinfo exporter now supports numeric =toc= values in
=#+OPTIONS:=): Announce the new feature.
* lisp/ox.el (org-export-excluded-from-toc-p): Return nil for all
headlines that are above the `toc' value in export `#+OPTIONS'.
* testing/lisp/test-ox-texinfo.el
(test-ox-texinfo/headings-and-table-of-contents): Add a test.
---
etc/ORG-NEWS | 9 +++++
lisp/ox.el | 6 ++-
testing/lisp/test-ox-texinfo.el | 66 +++++++++++++++++++++++++++++++++
3 files changed, 80 insertions(+), 1 deletion(-)
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 0ae1e4c81..3c0bfc173 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -85,6 +85,15 @@ You can now alter the Texinfo navigation hierarchy by specifying the
information, see "13.14.6 Headings and sectioning structure" section
of the Org manual.
+*** Texinfo exporter now supports numeric =toc= values in =#+OPTIONS:=
+
+For example, given =H:3= and =toc:2= in =#+OPTIONS:=, all headings at
+the 1st and 2nd level appear in the table of contents and those at the
+3rd level do not. The latter will be instead exported as if they had
+the =UNNUMBERED= property set to =notoc=, that is using the Texinfo
+command given in the =unnumbered-no-toc-3= list position of the
+=org-texinfo-classes= variable, as documented.
+
** New and changed options
# Chanes deadling with changing default values of customizations,
diff --git a/lisp/ox.el b/lisp/ox.el
index 7a0ab4dc7..acc535f72 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -5625,7 +5625,11 @@ contents. However, it is useful if some additional processing is
required on headlines excluded from table of contents."
(or (org-element-property :footnote-section-p headline)
(org-export-low-level-p headline info)
- (equal "notoc" (org-export-get-node-property :UNNUMBERED headline t))))
+ (equal "notoc" (org-export-get-node-property :UNNUMBERED headline t))
+ (let ((toc-depth (plist-get info :with-toc)))
+ (and (wholenump toc-depth)
+ (> (org-element-property :level headline)
+ toc-depth)))))
(defun org-export-toc-entry-backend (parent &rest transcoders)
"Return an export backend appropriate for table of contents entries.
diff --git a/testing/lisp/test-ox-texinfo.el b/testing/lisp/test-ox-texinfo.el
index 4a521b3ed..e6dfaf876 100644
--- a/testing/lisp/test-ox-texinfo.el
+++ b/testing/lisp/test-ox-texinfo.el
@@ -663,5 +663,71 @@ body
(re-search-forward "^@node Heading 2 (Heading 1)$")
(re-search-forward "^@chapter Heading 2 (@ref{Heading 1})$")))))))
+\f
+;;; Headings and table of contents
+
+(ert-deftest test-ox-texinfo/headings-and-table-of-contents ()
+ "Test headings with regards to table of contents."
+ (should
+ (org-test-with-temp-text
+ (string-join
+ (list "#+OPTIONS: h:2 toc:1 num:nil"
+ "* Level 1"
+ "** Level 1-1"
+ "*** Level 1-1-1"
+ "*** Level 1-1-2"
+ "** Level 1-2"
+ "*** Level 1-2-1"
+ "*** Level 1-2-2"
+ "* Level 2"
+ "** Level 2-1"
+ "*** Level 2-1-1"
+ "*** Level 2-1-2"
+ "** Level 2-2"
+ "*** Level 2-2-1"
+ "*** Level 2-2-2")
+ "\n")
+ (let ((export-buffer "*Test Texinfo Export*")
+ (org-export-show-temporary-export-buffer nil))
+ (org-export-to-buffer 'texinfo export-buffer
+ nil nil nil nil nil
+ #'texinfo-mode)
+ (with-current-buffer export-buffer
+ (goto-char (point-min))
+ (and
+ (re-search-forward "^@menu$")
+ (re-search-forward "^* Level 1::$")
+ (re-search-forward "^* Level 2::$")
+ (re-search-forward "^@detailmenu$")
+ (re-search-forward "^Level 1$")
+ (re-search-forward "^* Level 1-1::$")
+ (re-search-forward "^* Level 1-2::$")
+ (re-search-forward "^Level 2$")
+ (re-search-forward "^* Level 2-1::$")
+ (re-search-forward "^* Level 2-2::$")
+ (re-search-forward "^@node Level 1$")
+ (re-search-forward "^@unnumbered Level 1$")
+ (re-search-forward "^@menu$")
+ (re-search-forward "^* Level 1-1::$")
+ (re-search-forward "^* Level 1-2::$")
+ (re-search-forward "^@heading Level 1-1$")
+ (re-search-forward "^@anchor{Level 1-1-1}Level 1-1-1$")
+ (re-search-forward "^@anchor{Level 1-1-2}Level 1-1-2$")
+ (re-search-forward "^@heading Level 1-2$")
+ (re-search-forward "^@anchor{Level 1-2-1}Level 1-2-1$")
+ (re-search-forward "^@anchor{Level 1-2-2}Level 1-2-2$")
+ (re-search-forward "^@node Level 2$")
+ (re-search-forward "^@unnumbered Level 2$")
+ (re-search-forward "^@menu$")
+ (re-search-forward "^* Level 2-1::$")
+ (re-search-forward "^* Level 2-2::$")
+ (re-search-forward "^@heading Level 2-1$")
+ (re-search-forward "^@anchor{Level 2-1-1}Level 2-1-1$")
+ (re-search-forward "^@anchor{Level 2-1-2}Level 2-1-2$")
+ (re-search-forward "^@anchor{Level 2-2}$")
+ (re-search-forward "^@heading Level 2-2$")
+ (re-search-forward "^@anchor{Level 2-2-1}Level 2-2-1$")
+ (re-search-forward "^@anchor{Level 2-2-2}Level 2-2-2$")))))))
+
(provide 'test-ox-texinfo)
;;; test-ox-texinfo.el end here
--
2.39.3 (Apple Git-146)
[-- Attachment #5: Type: text/plain, Size: 173 bytes --]
--
"Thinking is a momentary dismissal of irrelevancies."
--- Richard Buckminster Fuller, 1969
Rudolf Adamkovič <rudolf@adamkovic.org> [he/him]
http://adamkovic.org
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v3] Improvements to Texinfo exporter (was: [PATCH] Re: Texinfo: Custom navigation and links in headings)
2024-08-24 19:54 ` [PATCH v3] Improvements to Texinfo exporter (was: [PATCH] Re: Texinfo: Custom navigation and links in headings) Rudolf Adamkovič
@ 2024-08-30 13:19 ` Rudolf Adamkovič
2024-08-31 13:36 ` Ihor Radchenko
2024-08-31 20:48 ` Rudolf Adamkovič
0 siblings, 2 replies; 9+ messages in thread
From: Rudolf Adamkovič @ 2024-08-30 13:19 UTC (permalink / raw)
To: emacs-orgmode; +Cc: yantar92
Rudolf Adamkovič <rudolf@adamkovic.org> writes:
> Ready for review ... again!
Here I am, again!
I found I do not need alternative navigation, as I can simulate
"alternative up" with links in parent Org headings.
[Texinfo renders that just fine in HTML.]
The other two patches are bug fixes, to
- support links in headings
(including those exported as lists)
and
- support numeric `toc:' values in `#+OPTIONS'
(like an export backend should),
which are important.
I will rebase those onto `main' and
submit them separately,
one per thread, to
make code review easier.
P.S. This thread is orthogonal to
[PATCH] Texinfo: Check for math support without warnings and quietly
https://list.orgmode.org/m2r0aaxqaa.fsf@adamkovic.org/T/
which is waiting for review.
Rudy
--
"Be especially critical of any statement following the word
'obviously.'" --- Anna Pell Wheeler, 1883-1966
Rudolf Adamkovič <rudolf@adamkovic.org> [he/him]
http://adamkovic.org
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3] Improvements to Texinfo exporter (was: [PATCH] Re: Texinfo: Custom navigation and links in headings)
2024-08-30 13:19 ` Rudolf Adamkovič
@ 2024-08-31 13:36 ` Ihor Radchenko
2024-08-31 20:48 ` Rudolf Adamkovič
1 sibling, 0 replies; 9+ messages in thread
From: Ihor Radchenko @ 2024-08-31 13:36 UTC (permalink / raw)
To: Rudolf Adamkovič; +Cc: emacs-orgmode
Rudolf Adamkovič <rudolf@adamkovic.org> writes:
> I found I do not need alternative navigation, as I can simulate
> "alternative up" with links in parent Org headings.
>
> [Texinfo renders that just fine in HTML.]
>
> The other two patches are bug fixes, to
>
> - support links in headings
> (including those exported as lists)
>
> and
>
> - support numeric `toc:' values in `#+OPTIONS'
> (like an export backend should),
>
> which are important.
>
> I will rebase those onto `main' and
>
> submit them separately,
>
> one per thread, to
>
> make code review easier.
Ok.
Closing this thread.
Canceled.
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3] Improvements to Texinfo exporter (was: [PATCH] Re: Texinfo: Custom navigation and links in headings)
2024-08-30 13:19 ` Rudolf Adamkovič
2024-08-31 13:36 ` Ihor Radchenko
@ 2024-08-31 20:48 ` Rudolf Adamkovič
1 sibling, 0 replies; 9+ messages in thread
From: Rudolf Adamkovič @ 2024-08-31 20:48 UTC (permalink / raw)
To: emacs-orgmode; +Cc: yantar92
Rudolf Adamkovič <rudolf@adamkovic.org> writes:
> I will rebase those onto `main' and
>
> submit them separately,
>
> one per thread, to
>
> make code review easier.
And done. The two patches, now rebased on `main' are submitted via `git
send-email`, are now waiting for review:
[PATCH] ox-texinfo: Support links in headings
https://list.orgmode.org/20240831203526.31509-1-rudolf@adamkovic.org/T/#u
[PATCH] ox-texinfo: Support numeric values of `toc' in `#+OPTIONS'
https://list.orgmode.org/20240831203449.31407-1-rudolf@adamkovic.org/T/#u
The third patch from the other day is also waiting for review:
[PATCH] Texinfo: Check for math support without warnings and quietly
https://list.orgmode.org/m2r0aaxqaa.fsf@adamkovic.org/T/
I am dogfooding all three patches on `my-main'.
This thread shall rest in peace. :)
Rudy
--
"It is no paradox to say that in our most theoretical moods we may be
nearest to our most practical applications." --- Alfred North
Whitehead, 1861-1947
Rudolf Adamkovič <rudolf@adamkovic.org> [he/him]
http://adamkovic.org
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2024-08-31 20:49 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-22 18:20 Texinfo: Custom navigation and links in headings Rudolf Adamkovič
2024-08-23 7:08 ` Rudolf Adamkovič
2024-08-23 12:45 ` Rudolf Adamkovič
2024-08-24 6:46 ` [PATCH] Re: Texinfo: Custom navigation and links in headings (was: Texinfo: Custom navigation and links in headings) Rudolf Adamkovič
2024-08-24 9:19 ` [PATCH] Re: Texinfo: Custom navigation and links in headings Rudolf Adamkovič
2024-08-24 19:54 ` [PATCH v3] Improvements to Texinfo exporter (was: [PATCH] Re: Texinfo: Custom navigation and links in headings) Rudolf Adamkovič
2024-08-30 13:19 ` Rudolf Adamkovič
2024-08-31 13:36 ` Ihor Radchenko
2024-08-31 20:48 ` Rudolf Adamkovič
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.