andreozzi gmail com)
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.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
function bib2htmlProcess($data, $filterType, $filter) {
$OSBiBPath = dirname(__FILE__) . '/OSBiB/';
include_once($OSBiBPath.'format/bibtexParse/PARSEENTRIES.php');
include_once($OSBiBPath.'format/BIBFORMAT.php');
// parse the content of bib string and generate associative array with valid entries
$parse = NEW PARSEENTRIES();
$parse->expandMacro = TRUE;
$parse->fieldExtract = TRUE;
$parse->removeDelimit = TRUE;
$parse->loadBibtexString($data);
$parse->extractEntries();
list($preamble, $strings, $entries) = $parse->returnArrays();
/* Format the entries array for html output */
$bibformat = NEW BIBFORMAT($OSBiBPath, TRUE); // TRUE implies that the input data is in bibtex format
$bibformat->cleanEntry=TRUE; // convert BibTeX (and LaTeX) special characters to UTF-8
list($info, $citation, $styleCommon, $styleTypes) = $bibformat->loadStyle($OSBiBPath."styles/bibliography/", "IEEE");
$bibformat->getStyle($styleCommon, $styleTypes);
$i=0;
$citations = '
';
foreach ($entries as $entry) {
// Get the resource type ('book', 'article', 'inbook' etc.)
$resourceType = $entry['bibtexEntryType'];
// adds all the resource elements automatically to the BIBFORMAT::item array
$bibformat->preProcess($resourceType, $entry);
// apply filters
$pos = strpos($filter, $resourceType);
$bibkey = $entry['bibtexCitation'];
if ( ( (strcmp($filterType, "allow") === 0) && ($pos === false) ) or
( (strcmp($filterType, "deny") === 0) && ($pos !== false) ) or
( (strcmp($filterType, "key") === 0) && (strcmp($filter, $bibkey) != 0) ) ) continue;
$i++;
$biblogo = 'bibtex";
// get the formatted resource string ready for printing to the web browser
// the str_replace is used to remove the { } parentheses possibly present in title
// to enforce uppercase, TODO: check if it can be done only on title
$citations.= '