=====Features=====
* **New (02/2009)** bibtexbrowser can display all entries for an author with an academic style [[http://www.monperrus.net/martin/bibtexbrowser.php?bib=metrics.bib&academic=Ducasse|demo]]
* **New (01/2009)** bibtexbrowser allows multi criteria search, e.g. [[http://www.monperrus.net/martin/bibtexbrowser.php?bib=metrics.bib&type=inproceedings&year=2004|demo]]
* **HOT: bibtexbrowser can be used to include your publication list into your home page** [[http://www.monperrus.net/martin/|demo]]
* bibtexbrowser can display the menu and all entries without filtering from the file name passed as parameter [[http://www.monperrus.net/martin/bibtexbrowser.php?bib=metrics.bib|demo]]
* bibtexbrowser can display all entries out of a bibtex file [[http://www.monperrus.net/martin/bibtexbrowser.php?bib=metrics.bib&all|demo]]
* bibtexbrowser can display all entries for a given year [[http://www.monperrus.net/martin/bibtexbrowser.php?bib=metrics.bib&year=2004|demo]]
* bibtexbrowser can display a single entry [[http://www.monperrus.net/martin/bibtexbrowser.php?bib=metrics.bib&key=monperrus08d|demo]]
* bibtexbrowser can display found entries with a search word (it can be in any bib field) [[http://www.monperrus.net/martin/bibtexbrowser.php?bib=metrics.bib&search=ocl|demo]]
* bibtexbrowser can display all entries with a bib keyword
* bibtexbrowser outputs valid XHTML 1.0 Transitional
* bibtexbrowser in designed to be search engine friendly.
* bibtexbrowser can display all entries for an author [[http://www.monperrus.net/martin/bibtexbrowser.php?bib=metrics.bib&author=Barbara+A.+Kitchenham|demo]]
* bibtexbrowser can be used with different encodings (change the default iso-8859-1 encoding if your bib file is in utf-8 ''define('ENCODING','utf-8')'' )
=====How to make a publication list for a research group/team/lab=====
1) Create a bib file with the publication records (e.g. csgroup2008.bib)
2a) Use the link ''bibtexbrowser.php?bib=csgroup2008.bib&academic'' (sorted by publication type, then by year)
or
2b) Use the link ''bibtexbrowser.php?bib=csgroup2008.bib&all'' (sorted by year)
=====How to include your publication list in your home page=====
Use this PHP snippet:
<?php
$_GET['bib']='mybib.bib';
$_GET['academic']='Martin Monperrus';
include('bibtexbrowser.php');
?>
And tailor it with a CSS style, for example:
<style>
.date { background-color: blue; }
.rheader { font-size: large }
.bibline { padding:3px; padding-left:15px; vertical-align:top;}
.bibtitle { font-weight:bold; }
</style>
=====Tailoring=====
There are two ways to tailor bibtexbrowser:
1/ change the CSS style in function printHTMLHeaders(), ~ line 1650
2/ change the parameters ENCODING, PAGE_SIZE and co at the end of this documentation ~ line 120
=====Related_tools=====
[[http://www.monperrus.net/martin/bibtex2latex|bibtex2latex is a layer on top of bibtexbrowser that generates publication lists in latex.]]
Old-fashioned:
[[http://nxg.me.uk/dist/bibhtml/|bibhtml]], [[http://www.litech.org/~wkiri/bib2html/|bib2html]], [[http://ilab.usc.edu/bibTOhtml/|bibtohtml]], [[http://people.csail.mit.edu/rahimi/bibtex/|bibtextohtml]], [[http://www.lri.fr/~filliatr/bibtex2html/|bibtex2html]], [[http://people.csail.mit.edu/mernst/software/bibtex2web.html |bibtex2web]], [[http://strategoxt.org/Stratego/BibtexTools|stratego bibtex module]]
Unlike them, **bibtexbrowser is dynamic**.i.e.; generates the HTML pages on the fly.
Thus, you do not need to regenerate the static HTML files each time the bib file is changed.
Furthermore you can search any string in it.
Heavyweight:
[[http://www.rennes.supelec.fr/ren/perso/etotel/PhpBibtexDbMng/|PHP BibTeX Database Manager]], [[http://gforge.inria.fr/projects/bibadmin/|bibadmin]], [[http://artis.imag.fr/Software/Basilic/|basilic]], [[http://phpbibman.sourceforge.net/|phpbibman]], [[http://www.aigaion.nl/|aigaion]], [[http://www.refbase.net/|refbase]], [[http://wikindx.sourceforge.net/|wikindx]]
Unlike them, **bibtexbrowser does not need a MySQL database** and does not need a tedious import step each time the bib file is changed.
Main competitors:
[[http://code.google.com/p/simplybibtex/|SimplyBibtex]] has the same spirit and makes different architectural and presentation choices
=> **bibtexbrowser is much more lightweight** (just one file!).
[[http://www.cs.toronto.edu/~fritz/bibbase/|BibBase]] is a nice and very similar script, but written in Perl
=> **bibtexbrowser does not require a CGI/Perl compliant webserver** .
Misc:
[[http://www.sat.ltu.se/publications/publications.m|This matlab ;-) script is similar ]]
=====Copyright=====
This script is a fork from an excellent script of the University of Texas at El Paso.
(C) 2006-2007-2008-2009 Martin Monperrus
(C) 2005-2006 The University of Texas at El Paso / Joel Garcia, Leonardo Ruiz, and Yoonsik Cheon
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
*/
// *************** CONFIGURATION
// there is no encoding transformation from the bibtex file to the html file
// if your bibtex file contains 8 bits characters in utf-8
// change the following parameter
define('ENCODING','iso-8859-1');//define('ENCODING','utf-8');
// number of bib items per page
define('PAGE_SIZE',isset($_GET['nopage'])?10000:25);
// do we transform names like "Dupont, Joe" in "Joe Dupont"
define('FLIP_NAMES',true);
// for the menu frame
define('YEAR_SIZE',10); // number of years per table
define('TAGS_SIZE',20); // number of keywords per table
define('AUTHORS_SIZE',20); // number of authors per table
// *************** END CONFIGURATION
define('READLINE_LIMIT',1024);
define('Q_YEAR', 'year');
define('Q_YEAR_PAGE', 'year_page');
define('Q_FILE', 'bib');
define('Q_AUTHOR', 'author');
define('Q_AUTHOR_PAGE', 'author_page');
define('Q_TAG', 'keywords');
define('Q_TAG_PAGE', 'keywords_page');
define('Q_TYPE', 'type');
define('Q_TYPE_PAGE', 'type_page');
define('Q_ALL', 'all');
define('Q_ENTRY', 'entry');
define('Q_KEY', 'key');
define('Q_SEARCH', 'search');
define('Q_EXCLUDE', 'exclude');
define('Q_RESULT', 'result');
define('Q_ACADEMIC', 'academic');
define('AUTHOR', 'author');
define('EDITOR', 'editor');
define('SCHOOL', 'school');
define('TITLE', 'title');
define('BOOKTITLE', 'booktitle');
define('YEAR', 'year');
// SCRIPT_NAME is used to create correct links when oncluding a publication list
// in another page
// this constant may have already been initialized
// when using include('')
@define('SCRIPT_NAME',basename(__FILE__));
// for clean search engine links
// we disable url rewriting
// ... and hope that your php configuration will accept one of these
@ini_set("session.use_only_cookies",1);
@ini_set("session.use_trans_sid",0);
@ini_set("url_rewriter.tags","");
// we ensure that the pages won't get polluted
// if future versions of PHP change warning mechanisms...
@error_reporting(E_ERROR);
// default bib file, if no file is specified in the query string.
global $filename;
if (isset($_GET[Q_FILE])) {
$filename = $_GET[Q_FILE];
} else die('No bibtex file passed as parameter '.Q_FILE);
if (!file_exists($filename)) {
// to automate dectection of faulty links with tools such as webcheck
header('HTTP/1.1 404 Not found');
die('the bib file '.$filename.' does not exist !');
}
// save bandwidth and server cpu
// (imagine the number of requests from search engine bots...)
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && (strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE'])>filemtime($filename))) {
header("HTTP/1.1 304 Not Modified");
exit;
}
// for sake of performance, once the bibtex file is parsed
// we try to save a "compiled" in a txt file
$compiledbib = $filename.'.txt';
// do we have a compiled version ?
if (is_file($compiledbib) && is_readable($compiledbib)) {
// is it up to date ?
if (filemtime($filename)>filemtime($compiledbib)) {
// no, then reparse
$bibdb = new BibDataBase($filename);
}
else {
// yes then take it
$bibdb = unserialize(file_get_contents($compiledbib));
}
}
// we don't have a compiled version
else {
// then parsing the file
$bibdb = new BibDataBase($filename);
// are we able to save the compiled version ?
if ((!is_file($compiledbib) && is_writable(dirname($compiledbib))) || (is_file($compiledbib) && is_writable($compiledbib)) ) {
// we can use file_put_contents
// but don't do it for compatibility with PHP 4.3
$f = fopen($compiledbib,'w');
fwrite($f,serialize(new BibDataBase($filename)));
fclose($f);
}
}
$displaymanager=new DisplayManager($bibdb);
////////////////////////////////////////////////////////
/** This class is a generic parser of bibtex files
* It has no dependencies, i.e. it can be used outside of bibtexbrowser
* To use it, simply instantiate it and pass it an object that will receive semantic events
* The delegate is expected to have some methods
* see classes BibtexbrowserBibDB and XMLPrettyPrinter
*/
class StateBasedBibtexParser {
function StateBasedBibtexParser($bibfilename, $delegate) {
$f=str_split(file_get_contents($bibfilename));
// STATE DEFINITIONS
define('NOTHING',1);
define('GETTYPE',2);
define('GETKEY',3);
define('GETVALUE',4);
define('GETVALUEDELIMITEDBYQUOTES',5);
define('GETVALUEDELIMITEDBYQUOTES_ESCAPED',6);
define('GETVALUEDELIMITEDBYCURLYBRACKETS',7);
define('GETVALUEDELIMITEDBYCURLYBRACKETS_ESCAPED',8);
define('GETVALUEDELIMITEDBYCURLYBRACKETS_1NESTEDLEVEL',9);
define('GETVALUEDELIMITEDBYCURLYBRACKETS_1NESTEDLEVEL_ESCAPED',10);
define('GETVALUEDELIMITEDBYCURLYBRACKETS_2NESTEDLEVEL',11);
define('GETVALUEDELIMITEDBYCURLYBRACKETS_2NESTEDLEVEL_ESCAPED',12);
define('GETVALUEDELIMITEDBYCURLYBRACKETS_3NESTEDLEVEL',11);
define('GETVALUEDELIMITEDBYCURLYBRACKETS_3NESTEDLEVEL_ESCAPED',12);
$state=NOTHING;
$entrytype='';
$entrykey='';
$entryvalue='';
$finalkey='';
$entrysource='';
// metastate
$isinentry = false;
$delegate->beginFile();
foreach($f as $s) {
if ($isinentry) $entrysource.=$s;
if ($state==NOTHING) {
// this is the beginning of an entry
if ($s=='@') {
$delegate->beginEntry();
$state = GETTYPE;
$isinentry = true;
$entrysource='@';
}
}
else if ($state==GETTYPE) {
// this is the beginning of a key
if ($s=='{') {
$state = GETKEY;
$delegate->setEntryType($entrytype);
$entrytype='';
}
else $entrytype=$entrytype.$s;
}
else if ($state==GETKEY) {
// now we get the value
if ($s=='=') {
$state = GETVALUE;
$finalkey=$entrykey;
$entrykey='';}
// oups we only have the key :-) anyway
else if ($s=='}') {
$state = NOTHING;$isinentry = false;$delegate->endEntry($entrysource);
$entrykey='';
}
// OK now we look for values
else if ($s==',') {
$state=GETKEY;
$delegate->setEntryKey($entrykey);
$entrykey='';}
else { $entrykey=$entrykey.$s; }
}
// we just got a =, we can now receive the value, but we don't now whether the value
// is delimited by curly brackets, double quotes or nothing
else if ($state==GETVALUE) {
// the value is delimited by double quotes
if ($s=='"') {
$state = GETVALUEDELIMITEDBYQUOTES;
$entryvalue='';}
// the value is delimited by curly brackets
else if ($s=='{') {
$state = GETVALUEDELIMITEDBYCURLYBRACKETS;
$entryvalue='';}
// the end of the key and no value found: it is the bibtex key e.g. \cite{Descartes1637}
else if ($s==',') {
$state = GETKEY;
$delegate->setEntryField(trim($finalkey),$entryvalue);
$entryvalue='';}
// this is the end of the value AND of the entry
else if ($s=='}') {
$state = NOTHING;$isinentry = false;
$delegate->setEntryField(trim($finalkey),$entryvalue);
$delegate->endEntry($entrysource);
$entryvalue='';}
else { $entryvalue=$entryvalue.$s;}
}
/* GETVALUEDELIMITEDBYCURLYBRACKETS* handle entries delimited by curly brackets and the possible nested curly brackets */
else if ($state==GETVALUEDELIMITEDBYCURLYBRACKETS) {
if ($s=='\\') {
$state = GETVALUEDELIMITEDBYCURLYBRACKETS_ESCAPED;
$entryvalue=$entryvalue.$s;}
else if ($s=='{') {
$state = GETVALUEDELIMITEDBYCURLYBRACKETS_1NESTEDLEVEL;}
else if ($s=='}') {
$state = GETVALUE;}
else { $entryvalue=$entryvalue.$s;}
}
// handle anti-slashed brackets
else if ($state==GETVALUEDELIMITEDBYCURLYBRACKETS_ESCAPED) {
$state = GETVALUEDELIMITEDBYCURLYBRACKETS;
$entryvalue=$entryvalue.$s;
}
// in first level of curly bracket
else if ($state==GETVALUEDELIMITEDBYCURLYBRACKETS_1NESTEDLEVEL) {
if ($s=='\\') {
$state = GETVALUEDELIMITEDBYCURLYBRACKETS_1NESTEDLEVEL_ESCAPED;
$entryvalue=$entryvalue.$s;}
else if ($s=='{') {
$state = GETVALUEDELIMITEDBYCURLYBRACKETS_2NESTEDLEVEL;}
else if ($s=='}') {
$state = GETVALUEDELIMITEDBYCURLYBRACKETS;}
else { $entryvalue=$entryvalue.$s;}
}
// handle anti-slashed brackets
else if ($state==GETVALUEDELIMITEDBYCURLYBRACKETS_1NESTEDLEVEL_ESCAPED) {
$state = GETVALUEDELIMITEDBYCURLYBRACKETS_1NESTEDLEVEL;
$entryvalue=$entryvalue.$s;
}
// in second level of curly bracket
else if ($state==GETVALUEDELIMITEDBYCURLYBRACKETS_2NESTEDLEVEL) {
if ($s=='\\') {
$state = GETVALUEDELIMITEDBYCURLYBRACKETS_2NESTEDLEVEL_ESCAPED;
$entryvalue=$entryvalue.$s;}
else if ($s=='{') {
$state = GETVALUEDELIMITEDBYCURLYBRACKETS_3NESTEDLEVEL;}
else if ($s=='}') {
$state = GETVALUEDELIMITEDBYCURLYBRACKETS_1NESTEDLEVEL;}
else { $entryvalue=$entryvalue.$s;}
}
// handle anti-slashed brackets
else if ($state==GETVALUEDELIMITEDBYCURLYBRACKETS_2NESTEDLEVEL_ESCAPED) {
$state = GETVALUEDELIMITEDBYCURLYBRACKETS_2NESTEDLEVEL;
$entryvalue=$entryvalue.$s;
}
// in third level of curly bracket
else if ($state==GETVALUEDELIMITEDBYCURLYBRACKETS_3NESTEDLEVEL) {
if ($s=='\\') {
$state = GETVALUEDELIMITEDBYCURLYBRACKETS_3NESTEDLEVEL_ESCAPED;
$entryvalue=$entryvalue.$s;}
else if ($s=='}') {
$state = GETVALUEDELIMITEDBYCURLYBRACKETS_2NESTEDLEVEL;}
else { $entryvalue=$entryvalue.$s;}
}
// handle anti-slashed brackets
else if ($state==GETVALUEDELIMITEDBYCURLYBRACKETS_3NESTEDLEVEL_ESCAPED) {
$state = GETVALUEDELIMITEDBYCURLYBRACKETS_3NESTEDLEVEL;
$entryvalue=$inentryvaluedelimitedA0.$s;
}
/* handles entries delimited by double quotes */
else if ($state==GETVALUEDELIMITEDBYQUOTES) {
if ($s=='\\') {
$state = GETVALUEDELIMITEDBYQUOTES_ESCAPED;
$inentryvaluedelimitedB=$inentryvaluedelimitedB.$s;}
else if ($s=='"') {
$state = GETVALUE;
$entryvalue=$entryvalue.$inentryvaluedelimitedB;
$inentryvaluedelimitedB='';}
else { $inentryvaluedelimitedB=$inentryvaluedelimitedB.$s;}
}
// handle anti-double quotes
else if ($state==GETVALUEDELIMITEDBYQUOTES_ESCAPED) {
$state = GETVALUEDELIMITEDBYQUOTES;
$inentryvaluedelimitedB=$inentryvaluedelimitedB.$s;
}
}
$delegate->endFile();
} // end function
} // end class
/** This class can be used together with StateBasedBibParser */
class XMLPrettyPrinter {
function beginFile() {
header('Content-type: text/xml;');
print '';
print ' tag.
* The object may be mutated to read the rest of the fields.
*/
function toEntryUnformatted() {
$text =$this->getText();
?>
$val) {
$qstring .= '&'. $key .'='. $val;
}
}
return 'href="'. SCRIPT_NAME .'?'. $qstring .'"';
}
/**
* Returns the last name of an author name.
*/
function getLastName($author){
list($firstname, $lastname) = splitFullName($author);
return $lastname;
}
/**
* Returns the splitted name of an author name. The argument is assumed to be
* | Generated from |
| List All |
| >By year |
|
||
| displayMenuItems($list, $startIndex, $endIndex, $targetKey); ?> |