add support for generating CITATION.cff
This commit is contained in:
Executable
+53
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
// create CITATION.cff file for Github from a bibtex file
|
||||
// reference documentation: https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-citation-files#about-citation-files
|
||||
// script part of https://github.com/monperrus/bibtexbrowser/
|
||||
//
|
||||
// Usage
|
||||
// $ php bibtexbrowser-cff.php test_cli.bib --id classical
|
||||
// -> 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;$i<count($arguments); $i++) {
|
||||
$arg=$arguments[$i];
|
||||
if ($arg=='--id') {
|
||||
$current_entry = $db->getEntryByKey($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);
|
||||
|
||||
?>
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user