improves google scholar metadata
This commit is contained in:
+39
-5
@@ -1558,8 +1558,16 @@ class BibEntry {
|
||||
$s.=$this->getText();
|
||||
return $s;
|
||||
}
|
||||
|
||||
/** returns the first and last page of the entry as an array ([0]->first, [2]->last) */
|
||||
function getPages() {
|
||||
preg_match('/([0-9]+).*?([0-9]+)/',$this->getField('pages'),$matches);
|
||||
array_shift($matches);
|
||||
return $matches;
|
||||
}
|
||||
|
||||
} // enc class BibEntry
|
||||
|
||||
/** returns an HTML tag depending on BIBTEXBROWSER_LAYOUT e.g. <TABLE> */
|
||||
function get_HTML_tag_for_layout() {
|
||||
switch(BIBTEXBROWSER_LAYOUT) { /* switch for different layouts */
|
||||
@@ -2658,8 +2666,22 @@ class BibEntryDisplay {
|
||||
return $this->bib->toCoins().$this->bib->toEntryUnformatted();
|
||||
}
|
||||
|
||||
/** Creates metadata for Google Scholar
|
||||
* + a description
|
||||
/** Returns a dictionary of metadata. If the same metadata appears multiple times, it is concatenated with ";"
|
||||
*/
|
||||
function metadata_dict() {
|
||||
$result = array();
|
||||
foreach($this->metadata() as $v) {
|
||||
if (!in_array($v[0], $result)) {
|
||||
$result[$v[0]] = $v[1];
|
||||
} else {
|
||||
$result[$v[0]] .= ';'.$v[1];
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/** Returns an array containing the metadata for Google Scholar
|
||||
* array (array('citation_title', 'foo'), ....)
|
||||
* @see http://scholar.google.com/intl/en/scholar/inclusion.html
|
||||
* @see http://www.monperrus.net/martin/accurate+bibliographic+metadata+and+google+scholar
|
||||
* */
|
||||
@@ -2676,10 +2698,11 @@ class BibEntryDisplay {
|
||||
foreach($authors as $author) {
|
||||
$result[] = array('citation_author',$author);
|
||||
}
|
||||
$result[] = array('citation_publication_date',$this->bib->getYear());
|
||||
|
||||
// this page
|
||||
$result[] = array('citation_abstract_html_url','http://'.$_SERVER['HTTP_HOST'].($_SERVER['SERVER_PORT']=='80'?'':$_SERVER['SERVER_PORT']).str_replace('&','&',$_SERVER['REQUEST_URI']));
|
||||
// the date
|
||||
$result[] = array('citation_publication_date',$this->bib->getYear());
|
||||
$result[] = array('citation_date',$this->bib->getYear());
|
||||
$result[] = array('citation_year',$this->bib->getYear());
|
||||
|
||||
if ($this->bib->hasField("publisher")) {
|
||||
$result[] = array('citation_publisher',$this->bib->getPublisher());
|
||||
@@ -2689,6 +2712,10 @@ class BibEntryDisplay {
|
||||
if ($this->bib->getType()=="article") { // journal article
|
||||
$result[] = array('citation_journal_title',$this->bib->getField("journal"));
|
||||
$result[] = array('citation_volume',$this->bib->getField("volume"));
|
||||
if ($this->bib->hasField("number")) {
|
||||
// in bibtex, the issue number is usually in a field "number"
|
||||
$result[] = array('citation_issue',$this->bib->getField("number"));
|
||||
}
|
||||
if ($this->bib->hasField("issue")) {
|
||||
$result[] = array('citation_issue',$this->bib->getField("issue"));
|
||||
}
|
||||
@@ -2732,8 +2759,14 @@ class BibEntryDisplay {
|
||||
if ($this->bib->hasField("url")) {
|
||||
$result[] = array('citation_pdf_url',$this->bib->getField("url"));
|
||||
}
|
||||
|
||||
if ($this->bib->hasField("pages")) {
|
||||
$pages = $this->bib->getPages();
|
||||
$result[] = array('citation_firstpage',$pages[0]);
|
||||
$result[] = array('citation_lastpage',$pages[1]);
|
||||
}
|
||||
|
||||
} // end Google Scholar
|
||||
|
||||
// we don't introduce yet another kind of bibliographic metadata
|
||||
// the core bibtex metadata will simply be available as json
|
||||
@@ -2830,6 +2863,7 @@ class BibEntryDisplay {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// DATABASE MANAGEMENT
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user