|
@@ -1035,15 +1035,17 @@ CONTENTS is nil. INFO is a plist holding contextual information."
|
|
|
|
|
|
(defun org-texinfo--@ref (datum description info)
|
|
(defun org-texinfo--@ref (datum description info)
|
|
"Return @ref command for element or object DATUM.
|
|
"Return @ref command for element or object DATUM.
|
|
-DESCRIPTION is the name of the section to print, as a string."
|
|
|
|
|
|
+DESCRIPTION is the printed name of the section, as a string, or
|
|
|
|
+nil."
|
|
(let ((node-name (org-texinfo--get-node datum info))
|
|
(let ((node-name (org-texinfo--get-node datum info))
|
|
;; Sanitize DESCRIPTION for cross-reference use. In
|
|
;; Sanitize DESCRIPTION for cross-reference use. In
|
|
- ;; particular, remove colons as they seem to cause (even
|
|
|
|
- ;; within @asis{...} to the Texinfo reader.
|
|
|
|
- (title (replace-regexp-in-string
|
|
|
|
- "[ \t]*:+" ""
|
|
|
|
- (replace-regexp-in-string "," "@comma{}" description))))
|
|
|
|
- (if (equal title node-name)
|
|
|
|
|
|
+ ;; particular, remove colons as they seem to cause pain (even
|
|
|
|
+ ;; within @asis{...}) to the Texinfo reader.
|
|
|
|
+ (title (and description
|
|
|
|
+ (replace-regexp-in-string
|
|
|
|
+ "[ \t]*:+" ""
|
|
|
|
+ (replace-regexp-in-string "," "@comma{}" description)))))
|
|
|
|
+ (if (or (not title) (equal title node-name))
|
|
(format "@ref{%s}" node-name)
|
|
(format "@ref{%s}" node-name)
|
|
(format "@ref{%s, , %s}" node-name title))))
|
|
(format "@ref{%s, , %s}" node-name title))))
|
|
|
|
|
|
@@ -1091,20 +1093,8 @@ INFO is a plist holding contextual information. See
|
|
(org-element-type
|
|
(org-element-type
|
|
(org-element-property :parent destination))))))
|
|
(org-element-property :parent destination))))))
|
|
(let ((headline (org-element-lineage destination '(headline) t)))
|
|
(let ((headline (org-element-lineage destination '(headline) t)))
|
|
- (org-texinfo--@ref
|
|
|
|
- headline
|
|
|
|
- (or desc (org-texinfo--sanitize-title
|
|
|
|
- (org-element-property :title headline) info))
|
|
|
|
- info)))
|
|
|
|
- (_
|
|
|
|
- (org-texinfo--@ref
|
|
|
|
- destination
|
|
|
|
- (or desc
|
|
|
|
- (pcase (org-export-get-ordinal destination info)
|
|
|
|
- ((and (pred integerp) n) (number-to-string n))
|
|
|
|
- ((and (pred consp) n) (mapconcat #'number-to-string n "."))
|
|
|
|
- (_ "???"))) ;cannot guess the description
|
|
|
|
- info)))))
|
|
|
|
|
|
+ (org-texinfo--@ref headline desc info)))
|
|
|
|
+ (_ (org-texinfo--@ref destination desc info)))))
|
|
((string= type "mailto")
|
|
((string= type "mailto")
|
|
(format "@email{%s}"
|
|
(format "@email{%s}"
|
|
(concat (org-texinfo--sanitize-content path)
|
|
(concat (org-texinfo--sanitize-content path)
|