[Refdb-cvs] CVS: elisp refdb-mode.el,1.19,1.20
Status: Beta
Brought to you by:
mhoenicka
From: Markus H. <mho...@us...> - 2005-12-08 00:56:58
|
Update of /cvsroot/refdb/elisp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3333 Modified Files: refdb-mode.el Log Message: added L1-L4 to tag list;new config variable refdb-default-ris-encoding;new function refdb-getref-from-citation Index: refdb-mode.el =================================================================== RCS file: /cvsroot/refdb/elisp/refdb-mode.el,v retrieving revision 1.19 retrieving revision 1.20 diff -u -U2 -r1.19 -r1.20 --- refdb-mode.el 26 Nov 2005 00:26:02 -0000 1.19 +++ refdb-mode.el 8 Dec 2005 00:56:49 -0000 1.20 @@ -245,4 +245,9 @@ ;; to 'refdbc -C getref'.) ;; +;; Get References in Citation +;; Move point somewhere into a citation (i.e. a <citation> element in +;; a DocBook document and a <seg> in a TEI document), and this command +;; will retrieve all references cited in this element. +;; ;; Pick References ;; Add references to your personal reference list @@ -782,7 +787,16 @@ (const :tag "Miscellaneous 4 \(M4\)" M4) (const :tag "Miscellaneous 5 \(M5\)" M5) + (const :tag "Link1 \(L1\)" L1) + (const :tag "Link2 \(L2\)" L2) + (const :tag "Link3 \(L3\)" L3) + (const :tag "Link4 \(L4\)" L4) ) :group 'refdb-data-options) +(defcustom refdb-default-ris-encoding 'iso-latin-1 + "*Use this character encoding to display datasets in RIS format." + :type 'symbol + :group 'refdb-data-options) + (defcustom refdb-character-encodings-list '( @@ -1601,4 +1615,11 @@ ) +(defvar refdb-getref-from-citation-menu-item + ["Get References from Citation" + (refdb-getref-from-citation) + t] + "RefDB getref-from-citation menu item." + ) + (defvar refdb-pickref-menu-item ["Pick references" @@ -2754,5 +2775,5 @@ ) ;; todo: should be customizable. use refdbc setting - (set-buffer-file-coding-system 'iso-latin-1) + (set-buffer-file-coding-system refdb-default-ris-encoding) ) ) @@ -2970,4 +2991,28 @@ ) +(defun refdb-getref-from-citation() + "Display all references cited in the citation containing Point." + (interactive) + (save-excursion + (let ((eoc (re-search-forward "</citation *>\\|</seg *>" nil t)) + (id-string)) + (re-search-backward "<citation role=\"REFDB\" *>\\|<seg type=\"REFDBCITATION\".*>" nil t) + ;; in multiple citations the first linked is from the multiple definition but this doesn't hurt the query + (while (re-search-forward "\\(target\\|linkend\\)=\"ID\\([^-\"]+\\)" eoc t) + (let ((target (match-string 2 nil))) + ;; see whether ID is a numeric ID or an alphanumeric CK + (if (string-match "^[0-9]$" target) + (setq id-string (concat id-string " OR :ID:=" target)) + (setq id-string (concat id-string " OR :CK:=" target))) + ) + ) + (if (not (eq (length id-string) 0)) + ;; each cycle adds an " OR " at the beginning. We don't need the first one + (refdb-getref-by-advanced-search (substring id-string 4)) + (error "No citation found in the source document")) + ) + ) + ) + (defun refdb-pickref (idlist) "Add references to your personal reference list." @@ -6578,4 +6623,5 @@ refdb-getref-submenu-definition refdb-getref-on-region-submenu-definition + refdb-getref-from-citation-menu-item refdb-pickref-menu-item refdb-dumpref-menu-item |