You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
115 lines
3.3 KiB
115 lines
3.3 KiB
<?php /** default bibliography btyle of bibtexbrowser
|
|
|
|
see [[http://www.monperrus.net/martin/bibtexbrowser/]]
|
|
|
|
*/
|
|
|
|
/**
|
|
this function transforms a $bibentry into an HTML string
|
|
* it is called by function bib2html if the user did not choose a specific style
|
|
* the default usable CSS styles are
|
|
* .bibtitle { font-weight:bold; }
|
|
* .bibbooktitle { font-style:italic; }
|
|
* .bibauthor { }
|
|
* .bibpublisher { }
|
|
*/
|
|
function DefaultBibliographyStyle(&$bibentry) {
|
|
$title = $bibentry->getTitle();
|
|
$type = $bibentry->getType();
|
|
|
|
// later on, all values of $entry will be joined by a comma
|
|
$entry=array();
|
|
|
|
// title
|
|
// usually in bold: .bibtitle { font-weight:bold; }
|
|
$title = '<span class="bibtitle">'.$title.'</span>';
|
|
if ($bibentry->hasField('url')) $title = ' <a href="'.$bibentry->getField("url").'">'.$title.'</a>';
|
|
|
|
|
|
// author
|
|
if ($bibentry->hasField('author')) {
|
|
$coreInfo = $title . ' <span class="bibauthor">('.$bibentry->formattedAuthors().')</span>';}
|
|
else $coreInfo = $title;
|
|
|
|
// core info usually contains title + author
|
|
$entry[] = $coreInfo;
|
|
|
|
// now the book title
|
|
$booktitle = '';
|
|
if ($type=="inproceedings") {
|
|
$booktitle = 'In '.$bibentry->getField(BOOKTITLE); }
|
|
if ($type=="incollection") {
|
|
$booktitle = 'Chapter in '.$bibentry->getField(BOOKTITLE);}
|
|
if ($type=="inbook") {
|
|
$booktitle = 'Chapter in '.$bibentry->getField('chapter');}
|
|
if ($type=="article") {
|
|
$booktitle = 'In '.$bibentry->getField("journal");}
|
|
if (($type=="misc") && $bibentry->hasField("note")) {
|
|
$booktitle = $bibentry->getField("note");}
|
|
|
|
//// we may add the editor names to the booktitle
|
|
$editor='';
|
|
if ($bibentry->hasField(EDITOR)) {
|
|
$editors = array();
|
|
foreach ($bibentry->getEditors() as $ed) {
|
|
$editors[]=formatAuthor($ed);
|
|
}
|
|
$editor = implode(', ',$editors).', '.(count($editors)>1?'eds.':'ed.');
|
|
}
|
|
if ($editor!='') $booktitle .=' ('.$editor.')';
|
|
// end editor section
|
|
|
|
// is the booktitle available
|
|
if ($booktitle!='') {
|
|
$entry[] = '<span class="bibbooktitle">'.$booktitle.'</span>';
|
|
}
|
|
|
|
|
|
$publisher='';
|
|
if ($type=="phdthesis") {
|
|
$publisher = 'PhD thesis, '.$bibentry->getField(SCHOOL);
|
|
}
|
|
if ($type=="mastersthesis") {
|
|
$publisher = 'Master\'s thesis, '.$bibentry->getField(SCHOOL);
|
|
}
|
|
if ($type=="bachelorsthesis") {
|
|
$publisher = 'Bachelor\'s thesis, '.$bibentry->getField(SCHOOL);
|
|
}
|
|
if ($type=="techreport") {
|
|
$publisher = 'Technical report, '.$bibentry->getField("institution");
|
|
}
|
|
|
|
if ($type=="misc") {
|
|
$publisher = $bibentry->getField('howpublished');
|
|
}
|
|
|
|
if ($bibentry->hasField("publisher")) {
|
|
$publisher = $bibentry->getField("publisher");
|
|
}
|
|
|
|
if ($publisher!='') $entry[] = '<span class="bibpublisher">'.$publisher.'</span>';
|
|
|
|
|
|
if ($bibentry->hasField('volume')) $entry[] = "volume ".$bibentry->getField("volume");
|
|
|
|
|
|
if ($bibentry->hasField(YEAR)) $entry[] = $bibentry->getYear();
|
|
|
|
$result = implode(", ",$entry).'.';
|
|
|
|
// some comments (e.g. acceptance rate)?
|
|
if ($bibentry->hasField('comment')) {
|
|
$result .= " (".$bibentry->getField("comment").")";
|
|
}
|
|
if ($bibentry->hasField('note')) {
|
|
$result .= " (".$bibentry->getField("note").")";
|
|
}
|
|
|
|
// add the Coin URL
|
|
$result .= "\n".$bibentry->toCoins();
|
|
|
|
return $result;
|
|
}
|
|
|
|
|
|
?>
|