فهرست منبع

Fix infloop when parsing radio targets

* contrib/lisp/org-element.el (org-element-link-parser): Do not parse
  radio link as a recursive link.
* contrib/lisp/org-export.el (org-export-solidify-link-text): Make
  sure "\" isn't allowed in solidified strings.  This is required to
  allow entities in radio targets.
* EXPERIMENTAL/org-e-latex.el (org-e-latex-link): Apply changes to
  radio links.
* EXPERIMENTAL/org-e-ascii.el (org-e-ascii-link): Apply changes to
  radio links.
Nicolas Goaziou 13 سال پیش
والد
کامیت
6782d6f77b
4فایلهای تغییر یافته به همراه22 افزوده شده و 13 حذف شده
  1. 8 2
      EXPERIMENTAL/org-e-ascii.el
  2. 10 5
      EXPERIMENTAL/org-e-latex.el
  3. 3 5
      contrib/lisp/org-element.el
  4. 1 1
      contrib/lisp/org-export.el

+ 8 - 2
EXPERIMENTAL/org-e-ascii.el

@@ -1376,8 +1376,14 @@ INFO is a plist holding contextual information."
       (let ((ref (org-element-get-property :path link)))
 	(format (org-export-get-coderef-format ref desc)
 		(org-export-resolve-coderef ref info))))
-     ;; Do not apply a special syntax on radio links.
-     ((string= type "radio") desc)
+     ;; Do not apply a special syntax on radio links.  Though, parse
+     ;; and transcode path to have a proper display of contents.
+     ((string= type "radio")
+      (org-export-secondary-string
+       (org-element-parse-secondary-string
+	(org-element-get-property :path link)
+	(cdr (assq 'radio-target org-element-object-restrictions)))
+       'e-ascii info))
      ;; Do not apply a special syntax on fuzzy links pointing to
      ;; targets.
      ((and (string= type "fuzzy")

+ 10 - 5
EXPERIMENTAL/org-e-latex.el

@@ -45,6 +45,7 @@
 (declare-function org-element-parse-secondary-string
 		  "org-element" (string restriction &optional buffer))
 (defvar org-element-string-restrictions)
+(defvar org-element-object-restrictions)
 
 (declare-function org-export-clean-table "org-export" (table specialp))
 (declare-function org-export-data "org-export" (data backend info))
@@ -1405,14 +1406,18 @@ INFO is a plist holding contextual information.  See
     (cond
      ;; Image file.
      (imagep (org-e-latex-link--inline-image link info))
-     ;; Target or radioed target: replace link with the normalized
-     ;; custom-id/target name.
-     ((member type '("target" "radio"))
+     ;; Radioed target: Target's name is obtained from original raw
+     ;; link.  Path is parsed and transcoded in order to have a proper
+     ;; display of the contents.
+     ((string= type "radio")
       (format "\\hyperref[%s]{%s}"
 	      (org-export-solidify-link-text path)
-	      (or desc (org-export-secondary-string path 'e-latex info))))
+	      (org-export-secondary-string
+	       (org-element-parse-secondary-string
+		path (cdr (assq 'radio-target org-element-object-restrictions)))
+	       'e-latex info)))
      ;; Links pointing to an headline: Find destination and build
-     ;; appropriate referencing commanding.
+     ;; appropriate referencing command.
      ((member type '("custom-id" "fuzzy" "id"))
       (let ((destination (if (string= type "fuzzy")
 			     (org-export-resolve-fuzzy-link link info)

+ 3 - 5
contrib/lisp/org-element.el

@@ -1923,13 +1923,11 @@ Assume point is at the beginning of the link."
 	  end contents-begin contents-end link-end post-blank path type
 	  raw-link link)
       (cond
-       ;; Type 1: text targeted from a radio target.
+       ;; Type 1: Text targeted from a radio target.
        ((and org-target-link-regexp (looking-at org-target-link-regexp))
 	(setq type "radio"
-	      path (org-match-string-no-properties 0)
-	      contents-begin (match-beginning 0)
-	      contents-end (match-end 0)
-	      link-end (match-end 0)))
+	      link-end (match-end 0)
+	      path (org-match-string-no-properties 0)))
        ;; Type 2: Standard link, i.e. [[http://orgmode.org][homepage]]
        ((looking-at org-bracket-link-regexp)
 	(setq contents-begin (match-beginning 3)

+ 1 - 1
contrib/lisp/org-export.el

@@ -2512,7 +2512,7 @@ INFO is the plist used as a communication channel."
 (defun org-export-solidify-link-text (s)
   "Take link text S and make a safe target out of it."
   (save-match-data
-    (mapconcat 'identity (org-split-string s "[^a-zA-Z0-9_\\.-]+") "-")))
+    (mapconcat 'identity (org-split-string s "[^a-zA-Z0-9_.-]+") "-")))
 
 (defun org-export-get-coderef-format (path desc)
   "Return format string for code reference link.