diff --git a/bibtexbrowser.php b/bibtexbrowser.php
index dfc61ec..ac31bbe 100755
--- a/bibtexbrowser.php
+++ b/bibtexbrowser.php
@@ -13,6 +13,7 @@ bibtexbrowser is a PHP script that creates publication lists from Bibtex files.
* **(04/2007)**: bibtexbrowser is easy to install: just a single file.
=====Other features=====
+* **(01/2010)** bibtexbrowser can handle user-defined bibliographic styles
* **(10/2009)** bibtexbrowser is able to generate a bibtex file containing only the selected entries (simply add &astext at the end of the link)
* **(10/2009)** bibtexbrowser is now independent of the configuration of register_globals
* **(01/2009)** bibtexbrowser allows multi criteria search, e.g. [[http://www.monperrus.net/martin/bibtexbrowser.php?bib=metrics.bib&type=inproceedings&year=2004|demo]]
@@ -31,7 +32,8 @@ bibtexbrowser is a PHP script that creates publication lists from Bibtex files.
=====Download=====
-**[[http://www.monperrus.net/martin/bibtexbrowser.php.txt|Download bibtexbrowser]]**
+**[[http://www.monperrus.net/martin/bibtexbrowser.php.txt|Download bibtexbrowser]]** (Try the release candidate!)';} ?>
+
Contact me to be added in the [[users|lists of bibtexbrowser users]] :-)
=====Demo and Screenshot=====
@@ -63,8 +65,8 @@ include( 'bibtexbrowser.php' );
<?php
$_GET['bib']='csgroup2008.bib';
-$_GET['all']=1;
-$_GET['academic']='';
+$_GET['all']=true;
+$_GET['academic']=true;
include( 'bibtexbrowser.php' );
?>
|
@@ -80,8 +82,7 @@ include( 'bibtexbrowser.php' );
<?php
$_GET['bib']='mybib.bib';
-$_GET['author']='Martin Monperrus';
-$_GET['academic']='';
+$_GET['academic']='Martin Monperrus';
include( 'bibtexbrowser.php' );
?>
@@ -93,7 +94,9 @@ 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;}
+.bibref { padding:3px; padding-left:15px; vertical-align:top;}
+.bibtitle { font-weight:bold; }
+.bibbooktitle { font-style:italic; }
</style>
=====How to add links to the slides of a conference/workshop paper?=====
@@ -108,13 +111,32 @@ booktitle="Proceedings of the BIB conference",
comment={<a href="myslides.pdf">slides</a>}
}
-=====How to modify the style?=====
+=====How to tailor bibtexbrowser?=====
+
+====By modiyfing the CSS====
+
+If bibtexbrowser.css exists, it will be used, otherwise bibtexbrowser uses the embedded CSS style (search for "embedded CSS", ~line 2060).
+
+====By modiyfing the configuration parameters====
+
+All configuration parameters are of the form ''define("PARAMETER_NAME","PARAMER_VALUE")'' at the beginning of the script. You can modify them by creating a file named "bibtexbrowser.local.php" containing the modified value. For instance:
+
+''@define("ENCODING","utf-8");'' if your bibtex file is utf-8 encoded
+
+
+====By modifying the bibliography style ====
+The bibliography style is encapsulated in a function. If you want to modify the bibliography style, you can copy the default style ([[bibtexbrowser-style-default.php.txt|source]]) in a new file, say ''bibtexbrowser-yourstyle.php'', and rename the function ''DefaultBibliographyStyle'' in say ''MyFancyBibliographyStyle''.
+Then, add in the file ''bibtexbrowser.local.php'':
+
+include( 'bibtexbrowser-yourstyle.php' );
+define('BIBLIOGRAPHYSTYLE','MyFancyBibliographyStyle');
+
+
+[[http://www.monperrus.net/martin/bibtexbrowser-style-janos.php.txt|János Tapolcai contributed with this style, which looks like IEEE references]].
+For contributing with a new style, [[http://www.monperrus.net/martin/|please drop me an email ]]
-You may modify the embedded CSS style.
-You may modify the main parameters (e.g. ENCODING, PAGE_SIZE, etc ~ line 120)
-You may modify the BibEntry::toString() method.
=====Related_tools=====
@@ -144,7 +166,7 @@ Misc:
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) 2006-2007-2008-2009-2010 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
@@ -153,57 +175,59 @@ License, or (at your option) any later version.
*/
+/** Release 2009-01-05
+
+* Added support for new bibliographic styles (users just have to create a function and change a configuration parameter, see documentation)
+* Packaged the IEEE-like bibliographic style of János Tapolcai (many thanks János), see http://www.monperrus.net/martin/bibtexbrowser-style-janos.php.txt
+* Added support for external CSS (if bibtexbrowser.css exists, it is used instead of the embedded one)
+* Added support for local configuration parameters in bibtexbrowser.local.php
+* Bug in RSS fixed (handling of &)
+* Bug found by Nelson fixed (the link to all bib entries)
+
+*/
+
// *************** CONFIGURATION
+// I recommend to put your changes in bibtexbrowser.local.php
+// it will help you to upgrade the script with a new version
+@include('bibtexbrowser.local.php');
// 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');
+@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('TYPES_SIZE',10); // number of entry types per table
-define('YEAR_SIZE',20); // number of years per table
-define('AUTHORS_SIZE',30); // number of authors per table
-define('TAGS_SIZE',30); // number of keywords per table
-
+@define('PAGE_SIZE',isset($_GET['nopage'])?10000:25);
+@define('BIBLIOGRAPHYSTYLE','DefaultBibliographyStyle');// this is the name of a function
+@define('COMMA_NAMES',false);// do have authors in a comma separated form?
+@define('TYPES_SIZE',10); // number of entry types per table
+@define('YEAR_SIZE',20); // number of years per table
+@define('AUTHORS_SIZE',30); // number of authors per table
+@define('TAGS_SIZE',30); // number of keywords per table
+@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');
// *************** 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
@@ -642,7 +666,7 @@ function xtrim($line) {
// we also replace tabs
$line = str_replace("\t",' ', $line);
// remove superfluous spaces e.g. John+++Bar
- $line = ereg_replace(' {2,}',' ', $line);
+ $line = preg_replace('/ {2,}/',' ', $line);
return $line;
}
@@ -664,7 +688,7 @@ function char2html($line,$latexmodifier,$char,$entitiyfragment) {
* just have this http://isdc.unige.ch/Newsletter/help.html
*/
function latex2html($line) {
- $line = ereg_replace('([^\\])~','\\1 ', $line);
+ $line = preg_replace('/([^\\\\])~/','\\1 ', $line);
// performance increases with this test
@@ -911,10 +935,10 @@ class BibEntry {
* Note that this method is NOT case sensitive */
function hasPhrase($phrase, $field = null) {
if (!$field) {
- return eregi($phrase,$this->getConstants().$this->getText());
+ return preg_match('/'.$phrase.'/i',$this->getConstants().$this->getText());
//return stripos($this->getText(), $phrase) !== false;
}
- if ($this->hasField($field) && (eregi($phrase,$this->getField($field)) ) ) {
+ if ($this->hasField($field) && (preg_match('/'.$phrase.'/i',$this->getField($field)) ) ) {
//if ($this->hasField($field) && (stripos($this->getField($field), $phrase) !== false) ) {
return true;
}
@@ -926,10 +950,10 @@ class BibEntry {
/** Outputs an HTML line ( | )with two TDS inside
*/
function toTR() {
- echo '
';
- echo '['.$this->getId().'] | ';
- echo '';
- echo $this->toString();
+ echo ' |
';
+ echo '['.$this->getId().'] | ';
+ echo '';
+ echo bib2html($this);
$href = 'href="'.basename(__FILE__).'?'.createQueryString(array(Q_KEY => $this->getKey())).'"';
echo " [bib]";
@@ -1008,97 +1032,6 @@ class BibEntry {
}
- /** Outputs an HTML string
- */
- function toString() {
- $title = $this->getTitle();
- $type = $this->getType();
-
- $entry=array();
-
- // title
- $title = ''.$title.'';
- if ($this->hasField('url')) $title = ' '.$title.'';
- $entry[] = $title;
-
-
- // author
- if ($this->hasField('author')) {
- $entry[0] .= ' ('.$this->formattedAuthors().')';
- }
-
- // now the origin of the publication is in italic
- $booktitle = '';
-
- if (($type=="misc") && $this->hasField("note")) {
- $booktitle = $this->getField("note");
- }
-
- if ($type=="inproceedings") {
- $booktitle = 'In '.$this->getField(BOOKTITLE);
- }
-
- if ($type=="incollection") {
- $booktitle = 'Chapter in '.$this->getField(BOOKTITLE);
- }
-
- if ($type=="article") {
- $booktitle = 'In '.$this->getField("journal");
- }
-
-
-
- //// ******* EDITOR
- $editor='';
- if ($this->hasField(EDITOR)) {
- $editors = array();
- foreach ($this->getEditors() as $ed) {
- $editors[]=formatAuthor($ed);
- }
- $editor = implode(', ',$editors).', '.(count($editors)>1?'eds.':'ed.');
- }
-
- if ($booktitle!='') {
- if ($editor!='') $booktitle .=' ('.$editor.')';
- $entry[] = ''.$booktitle.'';
- }
-
-
- $publisher='';
- if ($type=="phdthesis") {
- $publisher = 'PhD thesis, '.$this->getField(SCHOOL);
- }
-
- if ($type=="mastersthesis") {
- $publisher = 'Master\'s thesis, '.$this->getField(SCHOOL);
- }
- if ($type=="techreport") {
- $publisher = 'Technical report, '.$this->getField("institution");
- }
- if ($this->hasField("publisher")) {
- $publisher = $this->getField("publisher");
- }
-
- if ($publisher!='') $entry[] = $publisher;
-
-
- if ($this->hasField('volume')) $entry[] = "volume ".$this->getField("volume");
-
-
- if ($this->hasField(YEAR)) $entry[] = $this->getYear();
-
- $result = implode(", ",$entry).'.';
-
- // some comments (e.g. acceptance rate)?
- if ($this->hasField('comment')) {
- $result .= " (".$this->getField("comment").")";
- }
-
- // add the Coin URL
- $result .= "\n".$this->toCoins();
-
- return $result;
- }
/**
* rebuild the set of constants used if any as a string
@@ -1116,18 +1049,32 @@ class BibEntry {
* The object may be mutated to read the rest of the fields.
*/
function toEntryUnformatted() {
- echo '';
+ echo '';
echo $this->getConstants();
if ($this->hasField('url')) {
$url=$this->getField('url');
// this is not a parsing but a simple replacement
echo str_replace($url,' '.$url.'',$this->getText());
} else echo $this->getText();
- echo '';
+ echo ' ';
}
}
+
+/**bibtexbrowser uses this function which encapsulates the user-defined name*/
+function bib2html(&$bibentry) {
+ $function = BIBLIOGRAPHYSTYLE;
+ return $function($bibentry);
+}
+
+
+include('bibtexbrowser-style-default.php');
+
+
+
+
+
// ----------------------------------------------------------------------
// DISPLAY MANAGEMENT
// ----------------------------------------------------------------------
@@ -1216,6 +1163,33 @@ function formatAuthorCommaSeparated($author){
else return $lastname;
}
+/** New undocumented feature, used by Benoit Baudry
+ * see http://www.irisa.fr/triskell/perso_pro/bbaudry/publications.php
+ *
+ * $_GET['library']=1;
+ * $_GET['bib']='metrics.bib';
+ * $_GET['all']=1;
+ * include('bibtexbrowser.php');
+ * new IndependentYearMenu();
+ * new Dispatcher();
+ *
+ */
+class IndependentYearMenu {
+ function IndependentYearMenu() {
+ $yearIndex = $_GET[Q_DB]->yearIndex();
+ echo '';
+ }
+}
+
/**
* A class providing GUI controllers in a frame.
@@ -1346,16 +1320,18 @@ else $page = 1;
$startIndex = ($page - 1) * $pageSize;
$endIndex = $startIndex + $pageSize;
?>
-
|