1 2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 3;; 4;; MODULE : bibtextm.scm 5;; DESCRIPTION : conversion of bibtex trees to TeXmacs trees 6;; COPYRIGHT : (C) 2010 David MICHEL 7;; 8;; This software falls under the GNU general public license version 3 or later. 9;; It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE 10;; in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>. 11;; 12;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 13 14(texmacs-module (convert bibtex bibtextm)) 15 16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 17;; User interface 18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 19 20(define (parse-bibtex s) 21 (tree->stree (parse-bib s))) 22 23(tm-define (parse-bibtex-snippet s) 24 (parse-bibtex s)) 25 26(tm-define (parse-bibtex-document s) 27 `(!file (document 28 (style "bibliography") 29 (body ,(parse-bibtex s))))) 30 31(tm-define (bibtex->texmacs bib) 32 (:type (-> stree stree)) 33 (:synopsis "Convert a parsed BibTeX stree @t into a TeXmacs stree.") 34 (let* ((snippet? (not (func? bib '!file 1))) 35 (body (if snippet? bib (cadr bib)))) 36 body)) 37 38