summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2015-05-07 22:15:00 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2015-05-07 22:15:00 +0200
commita35c4332f243cc51b2de5adc285d9786e95ef1f6 (patch)
treedee27d04ad94ec6d4f5bad60f8056375484325ef
parent9aa69058bc4cbe3be088df9e96b18caf5359a3a8 (diff)
downloadorg-mode-a35c4332f243cc51b2de5adc285d9786e95ef1f6.tar.gz
ox-publish: Allow external references outside of publishing
* lisp/ox-publish.el (org-publish-resolve-external-link): Warn instead of throwing an error when a reference to a non-published external file is encountered.
-rw-r--r--lisp/ox-publish.el40
1 files changed, 21 insertions, 19 deletions
diff --git a/lisp/ox-publish.el b/lisp/ox-publish.el
index ff61559..951f0fe 100644
--- a/lisp/ox-publish.el
+++ b/lisp/ox-publish.el
@@ -1144,25 +1144,27 @@ This function allows to resolve external links like:
[[file.org::*fuzzy][description]]
[[file.org::#custom-id][description]]
[[file.org::fuzzy][description]]"
- (unless org-publish-cache
- (user-error
- "Reference \"%s\" in file \"%s\" cannot be resolved without publishing"
- search
- file))
- (let ((references (org-publish-cache-get-file-property
- (expand-file-name file) :references nil t)))
- (cond
- ((cdr (case (aref search 0)
- (?* (assoc (cons 'headline (org-split-string (substring search 1)))
- references))
- (?# (assoc (cons 'custom-id (substring search 1)) references))
- (t
- (let ((s (org-split-string search)))
- (or (assoc (cons 'target s) references)
- (assoc (cons 'other s) references)
- (assoc (cons 'headline s) references)))))))
- (t (message "Unknown cross-reference \"%s\" in file \"%s\"" search file)
- "MissingReference"))))
+ (if (not org-publish-cache)
+ (progn
+ (message "Reference \"%s\" in file \"%s\" cannot be resolved without \
+publishing"
+ search
+ file)
+ "MissingReference")
+ (let ((references (org-publish-cache-get-file-property
+ (expand-file-name file) :references nil t)))
+ (cond
+ ((cdr (case (aref search 0)
+ (?* (assoc (cons 'headline (org-split-string (substring search 1)))
+ references))
+ (?# (assoc (cons 'custom-id (substring search 1)) references))
+ (t
+ (let ((s (org-split-string search)))
+ (or (assoc (cons 'target s) references)
+ (assoc (cons 'other s) references)
+ (assoc (cons 'headline s) references)))))))
+ (t (message "Unknown cross-reference \"%s\" in file \"%s\"" search file)
+ "MissingReference")))))