Browse Source

explains how to use other bibliographic formats

pull/28/merge
Martin Monperrus 10 years ago
parent
commit
12f6cbd2b3
  1. 36
      bibtexbrowser-documentation.wiki
  2. 10
      bibtexbrowser.php

36
bibtexbrowser-documentation.wiki

@ -363,6 +363,42 @@ class DynamicDispatcher extends Dispatcher {
?>
</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>
&lt;?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=====

10
bibtexbrowser.php

@ -1080,7 +1080,6 @@ class BibEntry {
} else {
//echo "xx".$value."xx\n";
}
$this->fields[$name] = $value;
}
@ -3379,6 +3378,15 @@ class BibDataBase {
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
* type.

Loading…
Cancel
Save