adds a basic support of http://schema.org/ScholarlyArticle metadata
This commit is contained in:
+11
-9
@@ -1299,7 +1299,7 @@ class BibEntry {
|
|||||||
function getFormattedAuthors() {
|
function getFormattedAuthors() {
|
||||||
$authors = array();
|
$authors = array();
|
||||||
foreach ($this->getRawAuthors() as $author) {
|
foreach ($this->getRawAuthors() as $author) {
|
||||||
$authors[]=$this->formatAuthor($author);
|
$authors[]='<span itemprop="author" itemtype="http://schema.org/Person">'.$this->formatAuthor($author).'</span>';
|
||||||
}
|
}
|
||||||
return $authors;
|
return $authors;
|
||||||
}
|
}
|
||||||
@@ -1963,6 +1963,8 @@ return
|
|||||||
.bibbooktitle { font-style:italic; }
|
.bibbooktitle { font-style:italic; }
|
||||||
.bibauthor { }
|
.bibauthor { }
|
||||||
.bibpublisher { }
|
.bibpublisher { }
|
||||||
|
|
||||||
|
See http://schema.org/ScholarlyArticle for the metadata
|
||||||
*/
|
*/
|
||||||
function DefaultBibliographyStyle(&$bibentry) {
|
function DefaultBibliographyStyle(&$bibentry) {
|
||||||
$title = $bibentry->getTitle();
|
$title = $bibentry->getTitle();
|
||||||
@@ -1973,13 +1975,13 @@ function DefaultBibliographyStyle(&$bibentry) {
|
|||||||
|
|
||||||
// title
|
// title
|
||||||
// usually in bold: .bibtitle { font-weight:bold; }
|
// usually in bold: .bibtitle { font-weight:bold; }
|
||||||
$title = '<span class="bibtitle">'.$title.'</span>';
|
$title = '<span class="bibtitle" itemprop="name">'.$title.'</span>';
|
||||||
if ($bibentry->hasField('url')) $title = ' <a'.(BIBTEXBROWSER_BIB_IN_NEW_WINDOW?' target="_blank" ':'').' href="'.$bibentry->getField('url').'">'.$title.'</a>';
|
if ($bibentry->hasField('url')) $title = ' <a'.(BIBTEXBROWSER_BIB_IN_NEW_WINDOW?' target="_blank" ':'').' href="'.$bibentry->getField('url').'">'.$title.'</a>';
|
||||||
|
|
||||||
|
|
||||||
// author
|
// author
|
||||||
if ($bibentry->hasField('author')) {
|
if ($bibentry->hasField('author')) {
|
||||||
$coreInfo = $title . ' <span class="bibauthor">('.$bibentry->getFormattedAuthorsImproved().')</span>';}
|
$coreInfo = $title . ' (<span class="bibauthor">'.$bibentry->getFormattedAuthorsImproved().'</span>)';}
|
||||||
else $coreInfo = $title;
|
else $coreInfo = $title;
|
||||||
|
|
||||||
// core info usually contains title + author
|
// core info usually contains title + author
|
||||||
@@ -1988,13 +1990,13 @@ function DefaultBibliographyStyle(&$bibentry) {
|
|||||||
// now the book title
|
// now the book title
|
||||||
$booktitle = '';
|
$booktitle = '';
|
||||||
if ($type=="inproceedings") {
|
if ($type=="inproceedings") {
|
||||||
$booktitle = __('In').' '.$bibentry->getField(BOOKTITLE); }
|
$booktitle = __('In').' '.'<span itemprop="isPartOf">'.$bibentry->getField(BOOKTITLE).'</span>'; }
|
||||||
if ($type=="incollection") {
|
if ($type=="incollection") {
|
||||||
$booktitle = __('Chapter in').' '.$bibentry->getField(BOOKTITLE);}
|
$booktitle = __('Chapter in').' '.'<span itemprop="isPartOf">'.$bibentry->getField(BOOKTITLE).'</span>';}
|
||||||
if ($type=="inbook") {
|
if ($type=="inbook") {
|
||||||
$booktitle = __('Chapter in').' '.$bibentry->getField('chapter');}
|
$booktitle = __('Chapter in').' '.$bibentry->getField('chapter');}
|
||||||
if ($type=="article") {
|
if ($type=="article") {
|
||||||
$booktitle = __('In').' '.$bibentry->getField("journal");}
|
$booktitle = __('In').' '.'<span itemprop="isPartOf">'.$bibentry->getField("journal").'</span>';}
|
||||||
|
|
||||||
//// we may add the editor names to the booktitle
|
//// we may add the editor names to the booktitle
|
||||||
$editor='';
|
$editor='';
|
||||||
@@ -2042,7 +2044,7 @@ function DefaultBibliographyStyle(&$bibentry) {
|
|||||||
if ($bibentry->hasField('volume')) $entry[] = __('volume').' '.$bibentry->getField("volume");
|
if ($bibentry->hasField('volume')) $entry[] = __('volume').' '.$bibentry->getField("volume");
|
||||||
|
|
||||||
|
|
||||||
if ($bibentry->hasField(YEAR)) $entry[] = $bibentry->getYear();
|
if ($bibentry->hasField(YEAR)) $entry[] = '<span itemprop="datePublished">'.$bibentry->getYear().'</span>';
|
||||||
|
|
||||||
$result = implode(", ",$entry).'.';
|
$result = implode(", ",$entry).'.';
|
||||||
|
|
||||||
@@ -2057,7 +2059,7 @@ function DefaultBibliographyStyle(&$bibentry) {
|
|||||||
// add the Coin URL
|
// add the Coin URL
|
||||||
$result .= $bibentry->toCoins();
|
$result .= $bibentry->toCoins();
|
||||||
|
|
||||||
return $result;
|
return '<span itemscope itemtype="http://schema.org/ScholarlyArticle">'.$result.'</span>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -2187,7 +2189,7 @@ function compare_bib_entries($bib1, $bib2) {
|
|||||||
/** creates a query string given an array of parameter, with all specifities of bibtexbrowser_ (such as adding the bibtex file name &bib=foo.bib
|
/** creates a query string given an array of parameter, with all specifities of bibtexbrowser_ (such as adding the bibtex file name &bib=foo.bib
|
||||||
*/
|
*/
|
||||||
function createQueryString($array_param) {
|
function createQueryString($array_param) {
|
||||||
// first a simple common transformation
|
// then a simple transformation and implode
|
||||||
foreach ($array_param as $key => $val) {
|
foreach ($array_param as $key => $val) {
|
||||||
if ($key == Q_FILE) { continue; }
|
if ($key == Q_FILE) { continue; }
|
||||||
// the inverse transformation should also be implemented into query2title
|
// the inverse transformation should also be implemented into query2title
|
||||||
|
|||||||
Reference in New Issue
Block a user