Sorted by year | Sorted by publication type | |
---|---|---|
For a group/team/lab | <?php $_GET['bib']='csgroup2008.bib'; $_GET['all']=1; include('bibtexbrowser.php'); ?> | <?php $_GET['bib']='csgroup2008.bib'; $_GET['all']=1; $_GET['academic']=''; include('bibtexbrowser.php'); ?> |
For an individual | <?php $_GET['bib']='mybib.bib'; $_GET['author']='Martin Monperrus'; include('bibtexbrowser.php'); ?> | <?php $_GET['bib']='mybib.bib'; $_GET['author']='Martin Monperrus'; $_GET['academic']=''; include('bibtexbrowser.php'); ?> |
@inproceedings{foo,
author="Jean Dupont",
title="Bibtexbrowser",
year=2009,
booktitle="Proceedings of the BIB conference",
comment={<a href="myslides.pdf">slides</a>}
}
=====Tailoring=====
There are two ways to tailor bibtexbrowser:
1/ change the embedded CSS style
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 have authors in a comma separated form?
define('COMMA_NAMES',false);
// 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('Q_DB', 'bibdb');
define('AUTHOR', 'author');
define('EDITOR', 'editor');
define('SCHOOL', 'school');
define('TITLE', 'title');
define('BOOKTITLE', 'booktitle');
define('YEAR', 'year');
// 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.
if (!isset($_GET[Q_FILE])) {
header('HTTP/1.1 404 Not found');
header('Content-type: text/plain');// to be validated by W3
die('No bibtex file passed as parameter (e.g. bibtexbrowser.php?bib=mybib.php)');
}
if (!file_exists($_GET[Q_FILE])) {
// to automate dectection of faulty links with tools such as webcheck
header('HTTP/1.1 404 Not found');
die('the bib file '.$_GET[Q_FILE].' does not exist !');
}
// PHP version
// 20091010: bibtexbrowser is again PHP4 compatible :-)
/*if (ereg('^4',phpversion())) {
?>
You are using PHP v=phpversion()?>
SetEnv PHP_VER 5
exit;
}*/
// 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($_GET[Q_FILE]))) {
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 = $_GET[Q_FILE].'.txt';
// do we have a compiled version ?
if (is_file($compiledbib) && is_readable($compiledbib)) {
// is it up to date ?
if (filemtime($_GET[Q_FILE])>filemtime($compiledbib)) {
// no, then reparse
$db = new BibDataBase();
$db->load($_GET[Q_FILE]);
$_GET[Q_DB]=$db;
}
else {
// yes then take it
$_GET[Q_DB] = unserialize(file_get_contents($compiledbib));
}
}
// we don't have a compiled version
else {
// then parsing the file
$db = new BibDataBase();
$db->load($_GET[Q_FILE]);
$_GET[Q_DB]=$db;
// 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($_GET[Q_DB]));
fclose($f);
}
}
////////////////////////////////////////////////////////
/** 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 BibDBBuilder and XMLPrettyPrinter
*/
class StateBasedBibtexParser {
function StateBasedBibtexParser($bibfilename, &$delegate) {
// 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();
$handle = fopen($bibfilename, "r");
// if you encounter this errir "Allowed memory size of xxxxx bytes exhausted"
// then decrease the size of the temp buffer below
$bufsize=min(filesize($bibfilename),100000);
while (!feof($handle)) {
$sread=fread($handle,$bufsize);
//foreach(str_split($sread) as $s) {
for ( $i=0; $i < strlen( $sread ); $i++) { $s=$sread[$i];
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;
}
} // end for
} // end while
$delegate->endFile();
fclose($handle);
} // 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();
// Note this is exactly the initial formatting thanks to the PRE tag
?>
$val) {
$array_param[$key]=$key .'='. $val;
}
return $qstring.implode("&",$array_param);
}
/**
* Given a query, an array of key value pairs, returns a href string
* of the form: href="?bib=testing.bib&search=JML.
*/
function makeHref($query = NULL) {
return 'href="?'. createQueryString($query) .'"';
}
/**
* 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 |
|
||
displayMenuItems($list, $startIndex, $endIndex, $targetKey); ?> |