Skip to content

Commit

Permalink
probable fix for issue #854
Browse files Browse the repository at this point in the history
this mostly just ignores @string types I think. The previous code flagged them incorrectly
as entries, which then triggered an invalid entry type warning in org-ref.
  • Loading branch information
jkitchin committed Feb 15, 2021
1 parent 63d36fe commit d2f24a2
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions org-ref-utils.el
Expand Up @@ -1131,7 +1131,7 @@ if FORCE is non-nil reparse the buffer no matter what."
(find-file-noselect bibfile)
(bibtex-validate))
(cl-pushnew
(format "Invalid bibtex file found. [[file:%s]]" bibfile)
(format "Invalid bibtex file found. [[file:%s]]\n" bibfile)
bib-candidates)))
bibfiles)
;; check types
Expand All @@ -1140,16 +1140,17 @@ if FORCE is non-nil reparse the buffer no matter what."
(with-current-buffer
(find-file-noselect bibfile)
(goto-char (point-min))
(while (re-search-forward "^@\\(.*\\){" nil t)
(unless (member (s-trim (downcase (match-string 1)))
(cdr (assoc bibtex-dialect
(list
(cons 'BibTeX (mapcar (lambda (e) (downcase (car e)))
bibtex-BibTeX-entry-alist))
(cons 'biblatex (mapcar (lambda (e) (downcase (car e)))
bibtex-biblatex-entry-alist))))))
(while (re-search-forward "^@\\(.*?\\)[({]" nil t)
(when (and (not (string= "string" (downcase (match-string-no-properties 1))))
(not (member (s-trim (downcase (match-string-no-properties 1)))
(cdr (assoc bibtex-dialect
(list
(cons 'BibTeX (mapcar (lambda (e) (downcase (car e)))
bibtex-BibTeX-entry-alist))
(cons 'biblatex (mapcar (lambda (e) (downcase (car e)))
bibtex-biblatex-entry-alist))))))))
(cl-pushnew
(format "Invalid bibtex entry type (%s) found in [[file:%s::%s]]" (match-string 1)
(format "Invalid bibtex entry type (%s) found in [[file:%s::%s]]\n" (match-string-no-properties 1)
bibfile (line-number-at-pos))
bib-candidates)))))
bibfiles))
Expand Down Expand Up @@ -1355,7 +1356,10 @@ if FORCE is non-nil reparse the buffer no matter what."



(insert "- cite link definition:\n" (pp (assoc "cite" org-link-parameters)))
(insert "- cite link definition:\n" (with-temp-buffer
(insert (format "%S" (assoc "cite" org-link-parameters)))
(pp-buffer)
(buffer-string)))

(insert "\n* LaTeX setup\n\n")
(cl-loop for executable in '("latex" "pdflatex" "bibtex" "biblatex"
Expand Down

0 comments on commit d2f24a2

Please sign in to comment.