emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Stefan-W. Hahn" <stefan.hahn@s-hahn.de>
To: Bastien <bzg@gnu.org>
Cc: emacs-orgmode@gnu.org, "Stefan-W. Hahn" <stefan.hahn@s-hahn.de>
Subject: [PATCH 2/5] org-bibtex.el: Use `org-bibtex-read-internal' in `org-bibtex-store-link'
Date: Sun, 23 Mar 2014 11:16:08 +0100	[thread overview]
Message-ID: <1395569771-32421-3-git-send-email-stefan.hahn@s-hahn.de> (raw)
In-Reply-To: <1395569771-32421-1-git-send-email-stefan.hahn@s-hahn.de>

* org-bibtex.el (org-bibtex-store-link): To have the same conversion,
especially removing of {{...}}, of a bibtex entry use
`org-bibtex-read-internal' in `org-bibtex-store-link'.

TINY CHANGE

Signed-off-by: Stefan-W. Hahn <stefan.hahn@s-hahn.de>
---
 lisp/org-bibtex.el | 46 ++++++++++++++++++++--------------------------
 1 file changed, 20 insertions(+), 26 deletions(-)

diff --git a/lisp/org-bibtex.el b/lisp/org-bibtex.el
index 7a12c30..4fd1153 100644
--- a/lisp/org-bibtex.el
+++ b/lisp/org-bibtex.el
@@ -453,33 +453,27 @@ (defun org-bibtex-store-link ()
     (let* ((search (org-create-file-search-in-bibtex))
 	   (link (concat "file:" (abbreviate-file-name buffer-file-name)
 			 "::" search))
-	   (entry (mapcar ; repair strings enclosed in "..." or {...}
-		   (lambda(c)
-		     (if (string-match
-			  "^\\(?:{\\|\"\\)\\(.*\\)\\(?:}\\|\"\\)$" (cdr c))
-			 (cons (car c) (match-string 1 (cdr c))) c))
-		   (save-excursion
-		     (bibtex-beginning-of-entry)
-		     (bibtex-parse-entry)))))
+	   (entry (org-bibtex-read-internal)))
+
       (org-store-link-props
-       :key (cdr (assoc "=key=" entry))
-       :author (or (cdr (assoc "author" entry)) "[no author]")
-       :editor (or (cdr (assoc "editor" entry)) "[no editor]")
-       :title (or (cdr (assoc "title" entry)) "[no title]")
-       :booktitle (or (cdr (assoc "booktitle" entry)) "[no booktitle]")
-       :journal (or (cdr (assoc "journal" entry)) "[no journal]")
-       :publisher (or (cdr (assoc "publisher" entry)) "[no publisher]")
-       :pages (or (cdr (assoc "pages" entry)) "[no pages]")
-       :url (or (cdr (assoc "url" entry)) "[no url]")
-       :year (or (cdr (assoc "year" entry)) "[no year]")
-       :month (or (cdr (assoc "month" entry)) "[no month]")
-       :address (or (cdr (assoc "address" entry)) "[no address]")
-       :volume (or (cdr (assoc "volume" entry)) "[no volume]")
-       :number (or (cdr (assoc "number" entry)) "[no number]")
-       :annote (or (cdr (assoc "annote" entry)) "[no annotation]")
-       :series (or (cdr (assoc "series" entry)) "[no series]")
-       :abstract (or (cdr (assoc "abstract" entry)) "[no abstract]")
-       :btype (or (cdr (assoc "=type=" entry)) "[no type]")
+       :key (cdr (assoc :key entry))
+       :author (or (cdr (assoc :author entry)) "[no author]")
+       :editor (or (cdr (assoc :editor entry)) "[no editor]")
+       :title (or (cdr (assoc :title entry)) "[no title]")
+       :booktitle (or (cdr (assoc :booktitle entry)) "[no booktitle]")
+       :journal (or (cdr (assoc :journal entry)) "[no journal]")
+       :publisher (or (cdr (assoc :publisher entry)) "[no publisher]")
+       :pages (or (cdr (assoc :pages entry)) "[no pages]")
+       :url (or (cdr (assoc :url entry)) "[no url]")
+       :year (or (cdr (assoc :year entry)) "[no year]")
+       :month (or (cdr (assoc :month entry)) "[no month]")
+       :address (or (cdr (assoc :address entry)) "[no address]")
+       :volume (or (cdr (assoc :volume entry)) "[no volume]")
+       :number (or (cdr (assoc :number entry)) "[no number]")
+       :annote (or (cdr (assoc :annote entry)) "[no annotation]")
+       :series (or (cdr (assoc :series entry)) "[no series]")
+       :abstract (or (cdr (assoc :abstract entry)) "[no abstract]")
+       :btype (or (cdr (assoc :type entry)) "[no type]")
        :type "bibtex"
        :link link
        :description org-bibtex-description))))
-- 
1.8.3.2.733.gf8abaeb

  parent reply	other threads:[~2014-03-23 10:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-21 16:17 Problem with org-bibtex-read with fields type, key Stefan-W. Hahn
2014-03-19 11:08 ` Bastien
2014-03-21 19:26   ` Stefan-W. Hahn
2014-03-21 22:02     ` Bastien
2014-03-23 10:16 ` [RFC] " Stefan-W. Hahn
2014-03-23 10:16   ` [PATCH 1/5] org-bibtex.el (org-bibtex-read): Split in two functions for internal use Stefan-W. Hahn
2014-03-23 10:16   ` Stefan-W. Hahn [this message]
2014-03-23 10:16   ` [PATCH 3/5] org-bibtex.el: Replace double used fieldnames ":key" and ":byte" Stefan-W. Hahn
2014-03-23 10:16   ` [PATCH 4/5] org-bibtex.el: Change property names in `org-bibtex-store-link' API Stefan-W. Hahn
2014-03-23 10:16   ` [PATCH 5/5] org-bibtex.el: Clarifying description of `org-bibtex-type-property-name' Stefan-W. Hahn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1395569771-32421-3-git-send-email-stefan.hahn@s-hahn.de \
    --to=stefan.hahn@s-hahn.de \
    --cc=bzg@gnu.org \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).