Browse Source

Minor: Improvement to bibtex-to-cff (#120)

pull/122/head
Moritz Schubotz 2 years ago
committed by GitHub
parent
commit
f02349154f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      bibtex-to-cff.php

9
bibtex-to-cff.php

@ -1,10 +1,10 @@
<?php
// create CITATION.cff file for Github from a bibtex file
// 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
// $ php bibtex-to-cff.php test_cli.bib --id classical
// -> this creates a file CITATION.cff for @xx{classical,
$_GET['library']=1;
@ -14,13 +14,16 @@ 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]);
}
}
if (is_null($current_entry)) {
echo "Did not find entry specified in the --id argument.";
return;
}
echo $current_entry->toCFF();
}

Loading…
Cancel
Save