Function: r2b-snarf-input

r2b-snarf-input is a byte-compiled function defined in refbib.el.gz.

Signature

(r2b-snarf-input)

Documentation

Parse buffer into global variables.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/refbib.el.gz
(defun r2b-snarf-input ()
   "Parse buffer into global variables."
   (let ((case-fold-search t))
      (r2b-trace "snarfing...")
      (sit-for 0)
      (set-buffer r2b-in-buf)
      (goto-char (point-min))
      (princ "    " r2b-log)
      (princ (buffer-substring (point) (progn (end-of-line) (point))) r2b-log)
      (terpri r2b-log)

      (r2b-get-field 'r2bv-author "%A")
      (r2b-get-field 'r2bv-editor "%E")
      (cond
	 (r2bv-author
	    (r2b-set-match 'r2bv-primary-author 1
	       "\\b\\(\\w+\\)[ \t]*\\($\\|,\\)" r2bv-author)
	    )
	 (r2bv-editor
	    (r2b-set-match 'r2bv-primary-author 1
	       "\\b\\(\\w+\\)[ \t]*\\($\\|,\\)" r2bv-editor)
	    )
	 (t
	    (setq r2bv-primary-author "")
	    )
	 )

      (r2b-get-field 'r2bv-date "%D" t t)
      (r2b-set-match 'r2bv-year 0 "[12][0-9][0-9][0-9]" r2bv-date)
      (and (null r2bv-year)
	 (r2b-set-match 'r2bv-year 1 "[^0-9]\\([0-9][0-9]\\)$" r2bv-date)
	 (setq r2bv-year (concat "19" r2bv-year)))
      (r2b-set-match 'r2bv-decade 1 "..\\(..\\)" r2bv-year)
      (r2b-set-match 'r2bv-month 0
	 "[0-9]+/\\|[a-zA-Z]+" r2bv-date)
      (if (and (stringp r2bv-month) (string-match "\\(.*\\)/$" r2bv-month))
	 (setq r2bv-month (substring r2bv-month 0 (match-end 1))))
      (r2b-convert-month)

      (r2b-get-field 'r2bv-title "%T" t t t)
      (r2b-set-match 'r2bv-title-first-word 4
	 r2b-stop-regexp
	 r2bv-title)

      (r2b-get-field 'r2bv-annote "%X" t )
      (r2b-get-field 'r2bv-tr "%R" t)
      (r2b-get-field 'r2bv-address "%C" t)
      (r2b-get-field 'r2bv-institution "%I" t)
      (r2b-get-field 'r2bv-keywords "%K")
      (r2b-get-field 'r2bv-booktitle "%B" t nil t)
      (r2b-get-field 'r2bv-journal "%J" t nil t)
      (r2b-get-field 'r2bv-volume "%V" t)
      (r2b-get-field 'r2bv-number "%N" t)
      (r2b-get-field 'r2bv-pages "%P" t)
      (r2b-get-field 'r2bv-where "%W" t)
      (r2b-get-field 'r2bv-ordering "%O" t)
      )
   )