improved the way to handle labels.
Now it depends on the value of the variable ABBRV_TYPE ABBRV_TYPE == "default" => [1] One paper ABBRV_TYPE == "year" => [2007] One paper (the year of publication) ABBRV_TYPE == "x-abbrv" => [OOPSLA] One paper (the value of the bibtex field x-abbrv)
This commit is contained in:
+44
-15
@@ -153,6 +153,11 @@ All the variable parts of bibtexbrowser can be modified with a file called ''bib
|
|||||||
// disable Javascript progressive enhancement
|
// disable Javascript progressive enhancement
|
||||||
// define('BIBTEXBROWSER_USE_PROGRESSIVE_ENHANCEMENT',false);
|
// define('BIBTEXBROWSER_USE_PROGRESSIVE_ENHANCEMENT',false);
|
||||||
|
|
||||||
|
// may be default/year/x-abbrv
|
||||||
|
// default => [1] The essence of metamodeling
|
||||||
|
// year => [2005] The essence of metamodeling
|
||||||
|
// x-abbrv => [SoSyM] The essence of metamodeling if the bibtex entry contains a field x-abbrv
|
||||||
|
//define('ABBRV_TYPE','default');
|
||||||
|
|
||||||
// see the other define(...) in the source, they are all overridable
|
// see the other define(...) in the source, they are all overridable
|
||||||
|
|
||||||
@@ -268,6 +273,8 @@ define('BIBTEXBROWSER','v__MTIME__');
|
|||||||
// the target frame of menu links
|
// the target frame of menu links
|
||||||
@define('BIBTEXBROWSER_MENU_TARGET','main'); // might be define('BIBTEXBROWSER_MENU_TARGET','_self'); in bibtexbrowser.local.php
|
@define('BIBTEXBROWSER_MENU_TARGET','main'); // might be define('BIBTEXBROWSER_MENU_TARGET','_self'); in bibtexbrowser.local.php
|
||||||
|
|
||||||
|
@define('ABBRV_TYPE','default');// may be default/year/x-abbrv
|
||||||
|
|
||||||
@define('COMMA_NAMES',false);// do have authors in a comma separated form?
|
@define('COMMA_NAMES',false);// do have authors in a comma separated form?
|
||||||
@define('TYPES_SIZE',10); // number of entry types per table
|
@define('TYPES_SIZE',10); // number of entry types per table
|
||||||
@define('YEAR_SIZE',20); // number of years per table
|
@define('YEAR_SIZE',20); // number of years per table
|
||||||
@@ -751,7 +758,7 @@ class BibDBBuilder {
|
|||||||
|
|
||||||
function setEntryKey($entrykey) {
|
function setEntryKey($entrykey) {
|
||||||
//echo "new entry:".$entrykey."\n";
|
//echo "new entry:".$entrykey."\n";
|
||||||
$this->currentEntry->setField('key',$entrykey);
|
$this->currentEntry->setKey($entrykey);
|
||||||
}
|
}
|
||||||
|
|
||||||
function beginEntry() {
|
function beginEntry() {
|
||||||
@@ -927,8 +934,6 @@ class BibEntry {
|
|||||||
/** Creates an empty new bib entry. Each bib entry is assigned a unique
|
/** Creates an empty new bib entry. Each bib entry is assigned a unique
|
||||||
* identification number. */
|
* identification number. */
|
||||||
function BibEntry() {
|
function BibEntry() {
|
||||||
static $id = 0;
|
|
||||||
$this->id = $id++;
|
|
||||||
$this->fields = array();
|
$this->fields = array();
|
||||||
$this->constants = array();
|
$this->constants = array();
|
||||||
$this->text ='';
|
$this->text ='';
|
||||||
@@ -940,6 +945,13 @@ class BibEntry {
|
|||||||
return strtolower($this->getField(Q_TYPE));
|
return strtolower($this->getField(Q_TYPE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Sets the key of this bib entry. */
|
||||||
|
function setKey($value) {
|
||||||
|
$this->setField('key',$value);
|
||||||
|
// by default the ID is the key
|
||||||
|
$this->id = $value;
|
||||||
|
}
|
||||||
|
|
||||||
/** Sets a field of this bib entry. */
|
/** Sets a field of this bib entry. */
|
||||||
function setField($name, $value) {
|
function setField($name, $value) {
|
||||||
$name = strtolower($name);
|
$name = strtolower($name);
|
||||||
@@ -1207,6 +1219,25 @@ class BibEntry {
|
|||||||
function getId() {
|
function getId() {
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Returns the abbreviation. */
|
||||||
|
function getAbbrv() {
|
||||||
|
if (ABBRV_TYPE == 'default') return $this->id;
|
||||||
|
if (ABBRV_TYPE == 'year') return $this->getYear();
|
||||||
|
if (ABBRV_TYPE == 'x-abbrv') {
|
||||||
|
if ($this->hasField('x-abbrv')) {return $this->getField('x-abbrv');}
|
||||||
|
// otherwise
|
||||||
|
return $this->getKey();
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Exception('Unknown configuration value for ABBRV_TYPE');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** Sets the abbreviation (e.g. [OOPSLA] or [1]) */
|
||||||
|
function setAbbrv($abbrv) {
|
||||||
|
return $this->id = $abbrv;
|
||||||
|
}
|
||||||
|
|
||||||
function getText() {
|
function getText() {
|
||||||
/** Returns the verbatim text of this bib entry. */
|
/** Returns the verbatim text of this bib entry. */
|
||||||
@@ -1242,7 +1273,7 @@ class BibEntry {
|
|||||||
*/
|
*/
|
||||||
function toTR() {
|
function toTR() {
|
||||||
echo '<tr class="bibline">';
|
echo '<tr class="bibline">';
|
||||||
echo '<td class="bibref"><a name="'.$this->getId().'"></a>['.$this->getId().']</td> ';
|
echo '<td class="bibref"><a name="'.$this->getId().'"></a>['.$this->getAbbrv().']</td> ';
|
||||||
echo '<td class="bibitem">';
|
echo '<td class="bibitem">';
|
||||||
echo bib2html($this);
|
echo bib2html($this);
|
||||||
|
|
||||||
@@ -2013,7 +2044,7 @@ class DefaultContentStrategy {
|
|||||||
krsort($entries);
|
krsort($entries);
|
||||||
foreach ($entries as $bib) {
|
foreach ($entries as $bib) {
|
||||||
if ($display->isDisplayed($index)) {
|
if ($display->isDisplayed($index)) {
|
||||||
$bib->id = $refnum--;
|
$bib->setAbbrv($refnum--);
|
||||||
$bib->toTR();
|
$bib->toTR();
|
||||||
}
|
}
|
||||||
$index++;
|
$index++;
|
||||||
@@ -2070,10 +2101,17 @@ class AcademicDisplay extends BibtexBrowserDisplay {
|
|||||||
if (count($entries)>0) {
|
if (count($entries)>0) {
|
||||||
echo "\n".'<div class="header">'.$title.'</div>'."\n";
|
echo "\n".'<div class="header">'.$title.'</div>'."\n";
|
||||||
echo '<table class="result">'."\n";
|
echo '<table class="result">'."\n";
|
||||||
|
|
||||||
|
// by default the abbreviation is incermented over all
|
||||||
|
// searches
|
||||||
|
static $count;
|
||||||
|
if ($count == NULL) { $count = 1; } // init
|
||||||
|
$id = $count;
|
||||||
foreach ($entries as $bib) {
|
foreach ($entries as $bib) {
|
||||||
$bib->id = $bib->getYear();
|
$bib->setAbbrv($id++);
|
||||||
$bib->toTR();
|
$bib->toTR();
|
||||||
} // end foreach
|
} // end foreach
|
||||||
|
$count = @$count + count($entries);
|
||||||
echo '</table>';
|
echo '</table>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2435,15 +2473,6 @@ class BibDataBase {
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Given its ID, return the bib entry. */
|
|
||||||
function getEntry($id){
|
|
||||||
foreach($this->bibdb as $bib) {
|
|
||||||
if($bib->getId() == $id)
|
|
||||||
return $bib;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Given its key, return the bib entry. */
|
/** Given its key, return the bib entry. */
|
||||||
function getEntryByKey($key) {
|
function getEntryByKey($key) {
|
||||||
return $this->bibdb[$key];
|
return $this->bibdb[$key];
|
||||||
|
|||||||
Reference in New Issue
Block a user