org-e-publish: Fix cache invalid read syntax error

* contrib/lisp/org-e-publish.el (org-e-publish-collect-index): Do not
  store text properties from strings in the cache.  Instead focus on
  necessary data only.
(org-e-publish-index-generate-theindex): Apply changes to previous
function.
This commit is contained in:
Nicolas Goaziou 2012-11-12 00:04:07 +01:00
parent c40a0dbd38
commit aaf179fe7f
1 changed files with 30 additions and 23 deletions

View File

@ -886,23 +886,33 @@ BACKEND is the back-end being used for transcoding. INFO is
a plist containing publishing options. a plist containing publishing options.
The index relative to current file is stored as an alist. An The index relative to current file is stored as an alist. An
association has the following shape: \(TERM FILE-NAME PARENT), association has the following shape: (TERM FILE-NAME PARENT),
where TERM is the indexed term, as a string, FILE-NAME is the where TERM is the indexed term, as a string, FILE-NAME is the
original full path of the file where the term in encountered, and original full path of the file where the term in encountered, and
PARENT is the headline element containing the original index PARENT is a reference to the headline, if any, containing the
keyword." original index keyword. When non-nil, this reference is a cons
(org-e-publish-cache-set-file-property cell. Its CAR is a symbol among `id', `custom-id' and `name' and
(plist-get info :input-file) :index its CDR is a string."
(delete-dups (let ((file (plist-get info :input-file)))
(org-element-map (org-e-publish-cache-set-file-property
tree 'keyword file :index
(lambda (k) (delete-dups
(when (string= (downcase (org-element-property :key k)) (org-element-map
"index") tree 'keyword
(let ((index (org-element-property :value k)) (lambda (k)
(parent (org-export-get-parent-headline k))) (when (equal (upcase (org-element-property :key k)) "INDEX")
(list index (plist-get info :input-file) parent)))) (let ((parent (org-export-get-parent-headline k)))
info))) (list (org-element-property :value k)
file
(cond
((not parent) nil)
((let ((id (org-element-property :id parent)))
(and id (cons 'id id))))
((let ((id (org-element-property :custom-id parent)))
(and id (cons 'custom-id id))))
(t (cons 'name
(org-element-property :raw-value parent))))))))
info))))
;; Return parse-tree to avoid altering output. ;; Return parse-tree to avoid altering output.
tree) tree)
@ -959,14 +969,11 @@ publishing directory."
(format (format
"[[%s][%s]]" "[[%s][%s]]"
;; Destination. ;; Destination.
(cond (case (car target)
((not target) (format "file:%s" file)) ('nil (format "file:%s" file))
((let ((id (org-element-property :id target))) (id (format "id:%s" (cdr target)))
(and id (format "id:%s" id)))) (custom-id (format "file:%s::#%s" file (cdr target)))
((let ((id (org-element-property :custom-id target))) (otherwise (format "file:%s::*%s" file (cdr target))))
(and id (format "file:%s::#%s" file id))))
(t (format "file:%s::*%s" file
(org-element-property :raw-value target))))
;; Description. ;; Description.
(car (last entry))))) (car (last entry)))))
"\n")))) "\n"))))