explains how to use other bibliographic formats
This commit is contained in:
@@ -363,6 +363,42 @@ class DynamicDispatcher extends Dispatcher {
|
|||||||
?>
|
?>
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
====How to load bibliographic data in other formats?====
|
||||||
|
|
||||||
|
If your bibliographic data comes from XML or a database, you can still browse it with bibtexbrowser as follows:
|
||||||
|
Add in ''bibtexbrowser.local.php'':
|
||||||
|
<pre>
|
||||||
|
define("BIBTEXBROWSER_MAIN", 'PgmDispatcher');
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
and then in ''bibtexbrowser.after.php'':
|
||||||
|
<pre>
|
||||||
|
<?php
|
||||||
|
class PgmDispatcher extends Dispatcher {
|
||||||
|
function getDB() {
|
||||||
|
$db = new BibDataBase();
|
||||||
|
|
||||||
|
// builds the first entry
|
||||||
|
$entry = new BibEntry();
|
||||||
|
$entry->setType("article");
|
||||||
|
$entry->setField("title", "foo");
|
||||||
|
$entry->setField("year", "2014");
|
||||||
|
$entry->setKey("kolp");
|
||||||
|
$db->addEntry($entry);
|
||||||
|
|
||||||
|
// builds the second entry
|
||||||
|
$entry2 = new BibEntry();
|
||||||
|
$entry2->setType("article");
|
||||||
|
$entry2->setField("title", "bar");
|
||||||
|
$entry2->setField("year", "2013");
|
||||||
|
$entry2->setKey("tili");
|
||||||
|
$db->addEntry($entry2);
|
||||||
|
|
||||||
|
return $db;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</pre>
|
||||||
|
|
||||||
=====Related tools=====
|
=====Related tools=====
|
||||||
|
|
||||||
|
|||||||
+9
-1
@@ -1080,7 +1080,6 @@ class BibEntry {
|
|||||||
} else {
|
} else {
|
||||||
//echo "xx".$value."xx\n";
|
//echo "xx".$value."xx\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->fields[$name] = $value;
|
$this->fields[$name] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3379,6 +3378,15 @@ class BibDataBase {
|
|||||||
return $this->bibdb[$key];
|
return $this->bibdb[$key];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Adds a new bib entry to the database. */
|
||||||
|
function addEntry($entry) {
|
||||||
|
if (!$entry->hasField('key')) {
|
||||||
|
die('error: a bibliographic entry must have a key');
|
||||||
|
}
|
||||||
|
$this->bibdb[$entry->getKey()] = $entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an array containing all bib entries matching the given
|
* Returns an array containing all bib entries matching the given
|
||||||
* type.
|
* type.
|
||||||
|
|||||||
Reference in New Issue
Block a user