From 249bb452eba1a1d74965f74758ac22f0f7d6ff6a Mon Sep 17 00:00:00 2001 From: Martin Monperrus Date: Fri, 17 Sep 2021 14:25:58 +0200 Subject: [PATCH] add support for generating CITATION.cff --- bibtex-to-cff.php | 53 ++++++++++++++++++++++++++++++++ bibtexbrowser-documentation.wiki | 29 ++++++++--------- 2 files changed, 68 insertions(+), 14 deletions(-) create mode 100755 bibtex-to-cff.php diff --git a/bibtex-to-cff.php b/bibtex-to-cff.php new file mode 100755 index 0000000..2ec050f --- /dev/null +++ b/bibtex-to-cff.php @@ -0,0 +1,53 @@ + this creates a file CITATION.cff for @xx{classical, + +$_GET['library']=1; +require('bibtexbrowser.php'); + +function bibtexbrowser_cff($arguments) { + $db = new BibDataBase(); + $db->load($arguments[1]); + $current_entry=NULL; + $current_field=NULL; + for ($i=2;$igetEntryByKey($arguments[$i+1]); + } + } + // now we have $current_entry + echo "cff-version: 1.2.0"."\n"; + echo "# CITATION.cff created with https://github.com/monperrus/bibtexbrowser/"."\n"; + echo "preferred-citation:"."\n"; + echo " title: \"".$current_entry->getTitle()."\""."\n"; + if ($current_entry->hasField("doi")) { + echo " doi: \"".$current_entry->getField("doi")."\""."\n"; + } + if ($current_entry->hasField("year")) { + echo " year: \"".$current_entry->getField("year")."\""."\n"; + } + if ($current_entry->hasField("journal")) { + echo " type: article\n"; + echo " journal: \"".$current_entry->getField("journal")."\""."\n"; + } + if ($current_entry->hasField("booktitle")) { + echo " type: conference-paper\n"; + echo " conference: \"".$current_entry->getField("booktitle")."\""."\n"; + } + echo " authors:"."\n"; + foreach ($current_entry->getFormattedAuthorsArray() as $author) { + $split = splitFullName($author); + echo " - family-names: ".$split[1]."\n"; + echo " given-names: ".$split[0]."\n"; + } +} + +bibtexbrowser_cff($argv); + +?> diff --git a/bibtexbrowser-documentation.wiki b/bibtexbrowser-documentation.wiki index 4c008e4..10a7d05 100755 --- a/bibtexbrowser-documentation.wiki +++ b/bibtexbrowser-documentation.wiki @@ -11,21 +11,22 @@ This documentation is collaborative, you can improve it using a [[https://github +++TOC+++ =====Features===== -* **(01/2017)** support basic composer support -* **(02/2016)** support for [[http://ogp.me/|OpenGraph metadata]] -* **(10/2015)** support for filtering bibtex fields -* **(10/2013)** support for localization (see below) -* **(07/2012)** new label types (see config value ABBRV_TYPE) -* **(10/2011)** if a bibtex entry contains a field gsid (like Google Scholar ID), bibtexbrowser includes a link [cites] to the cited-by page of Google Scholar (e.g. [[http://scholar.google.com/scholar?cites=15080874515065717592]]) -* **(03/2011)** bibtexbrowser includes a hide/show mechanism for bibtex entries (in Javascript, see configuration variable BIBTEXBROWSER_USE_PROGRESSIVE_ENHANCEMENT) -* **(10/2010)** bibtexbrowser now supports cross-references (Bibtex crossref) -* **(09/2010)** bibtexbrowser now supports multiple bibtex files (''bibtexbrowser.php?bib=file1.bib;file2.bib'') -* **(05/2010)** bibtexbrowser adds links to your co-author pages if you define the corresponding @string (see function addHomepageLink) -* **(01/2010)** bibtexbrowser can handle user-defined bibliographic styles +* (09/2021) add support for generating CITATION.cff files with helper script bibtex-to-cff.php +* (01/2017) support basic composer support +* (02/2016) support for [[http://ogp.me/|OpenGraph metadata]] +* (10/2015) support for filtering bibtex fields +* (10/2013) support for localization (see below) +* (07/2012) new label types (see config value ABBRV_TYPE) +* (10/2011) if a bibtex entry contains a field gsid (like Google Scholar ID), bibtexbrowser includes a link [cites] to the cited-by page of Google Scholar (e.g. [[http://scholar.google.com/scholar?cites=15080874515065717592]]) +* (03/2011) bibtexbrowser includes a hide/show mechanism for bibtex entries (in Javascript, see configuration variable BIBTEXBROWSER_USE_PROGRESSIVE_ENHANCEMENT) +* (10/2010) bibtexbrowser now supports cross-references (Bibtex crossref) +* (09/2010) bibtexbrowser now supports multiple bibtex files (''bibtexbrowser.php?bib=file1.bib;file2.bib'') +* (05/2010) bibtexbrowser adds links to your co-author pages if you define the corresponding @string (see function addHomepageLink) +* (01/2010) bibtexbrowser can handle user-defined bibliographic styles * bibtexbrowser generates publication RSS feeds (simply add &rss at the end of the URL)! [[http://www.monperrus.net/martin/bibtexbrowser.php?bib=monperrus.bib&all&rss|demo]] -* **(10/2009)** bibtexbrowser is able to generate a bibtex file containing only the selected entries (simply add &astext at the end of the link) -* **(10/2009)** bibtexbrowser is now independent of the configuration of register_globals -* **(01/2009)** bibtexbrowser allows multi criteria search, e.g. [[http://www.monperrus.net/martin/bibtexbrowser.php?bib=monperrus.bib&type=inproceedings&year=2013|demo]] +* (10/2009) bibtexbrowser is able to generate a bibtex file containing only the selected entries (simply add &astext at the end of the link) +* (10/2009) bibtexbrowser is now independent of the configuration of register_globals +* (01/2009) bibtexbrowser allows multi criteria search, e.g. [[http://www.monperrus.net/martin/bibtexbrowser.php?bib=monperrus.bib&type=inproceedings&year=2013|demo]] * bibtexbrowser generates [[http://ocoins.info/|COinS]] metadata for automatic import of bibliographic entries with [[http://www.zotero.org/|Zotero]] and [[http://www.mendeley.com/|Mendeley]]. * bibtexbrowser generates [[http://www.monperrus.net/martin/accurate+bibliographic+metadata+and+google+scholar|Google Scholar metadata]] so as to improve the visibility of your papers on Google Scholar. * bibtexbrowser replaces constants defined in @STRING