Compare commits
5
Commits
latest
..
c0e8d54438
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c0e8d54438 | ||
|
|
e259e5e131 | ||
|
|
52b67afd92 | ||
|
|
7248783ff4 | ||
|
|
3a08ff063e |
@@ -0,0 +1,4 @@
|
||||
# ignore generated artifacts
|
||||
/artifacts
|
||||
# ignore temporary directory if it remains after testing or so
|
||||
/temp
|
||||
@@ -1403,6 +1403,123 @@ class BibtexbrowserTest extends PHPUnit_Framework_TestCase {
|
||||
$this->assertFalse($entry1->hasPhrase('')); // Empty phrase should not match
|
||||
}
|
||||
|
||||
function testMultiSearchWithSpecialChars() {
|
||||
// Create test entries with C/C++ related content
|
||||
$bibtex = "@article{cpp2023,
|
||||
title={Advances in C/C++ Programming Language},
|
||||
author={Jane Programmer},
|
||||
journal={Journal of Programming Languages},
|
||||
year=2023,
|
||||
keywords={C/C++, programming languages, compilers}
|
||||
}
|
||||
@inproceedings{java2023,
|
||||
title={Java vs Python: Performance Comparison},
|
||||
author={John Coder},
|
||||
booktitle={International Conference on Software Engineering},
|
||||
year=2023,
|
||||
keywords={Java, Python, performance}
|
||||
}";
|
||||
|
||||
$test_data = fopen('php://memory','x+');
|
||||
fwrite($test_data, $bibtex);
|
||||
fseek($test_data, 0);
|
||||
$db = new BibDataBase();
|
||||
$db->update_internal("inline", $test_data);
|
||||
|
||||
// Test searching for C/C++ (which contains special characters / and +)
|
||||
$q = array(Q_SEARCH => 'C/C++');
|
||||
$results = $db->multisearch($q);
|
||||
|
||||
// Should match only the first entry
|
||||
$this->assertEquals(1, count($results));
|
||||
$this->assertEquals('Advances in C/C++ Programming Language', $results[0]->getTitle());
|
||||
|
||||
// Test searching with escaped slashes
|
||||
$q = array(Q_SEARCH => 'C/C\+\+');
|
||||
$results = $db->multisearch($q);
|
||||
$this->assertEquals(1, count($results));
|
||||
|
||||
// Test with partial match
|
||||
$q = array(Q_SEARCH => 'C/C');
|
||||
$results = $db->multisearch($q);
|
||||
$this->assertEquals(1, count($results));
|
||||
|
||||
// Test with keywords field specifically
|
||||
$q = array(Q_TAG => 'C/C++');
|
||||
$results = $db->multisearch($q);
|
||||
$this->assertEquals(1, count($results));
|
||||
|
||||
// Test searching for something that doesn't exist
|
||||
$q = array(Q_SEARCH => 'Rust');
|
||||
$results = $db->multisearch($q);
|
||||
$this->assertEquals(0, count($results));
|
||||
}
|
||||
|
||||
function test_venuevc_pagination() {
|
||||
// Define the page size for pagination
|
||||
bibtexbrowser_configure('VENUE_SIZE', 2);
|
||||
|
||||
// Create a test BibTeX database with multiple entries
|
||||
$bibtex = "@article{paper1,title={Paper One},journal={Journal A},year=2020}
|
||||
@article{paper2,title={Paper Two},journal={Journal A},year=2020}
|
||||
@article{paper3,title={Paper Three},journal={Journal B},year=2020}
|
||||
@article{paper4,title={Paper Four},journal={Journal B},year=2020}
|
||||
@article{paper5,title={Paper Five},journal={Journal C},year=2020}
|
||||
@article{paper6,title={Paper Six},journal={Journal C},year=2020}";
|
||||
|
||||
$test_data = fopen('php://memory','r+');
|
||||
fwrite($test_data, $bibtex);
|
||||
fseek($test_data, 0);
|
||||
|
||||
$db = new BibDataBase();
|
||||
$db->update_internal("inline", $test_data);
|
||||
|
||||
// Create VenueVC display
|
||||
$display = new MenuManager();
|
||||
$display->setDB($db);
|
||||
|
||||
// First, test without pagination parameter
|
||||
$_GET["venue_page"] = '1';
|
||||
ob_start();
|
||||
$display->display();
|
||||
$output = ob_get_clean();
|
||||
|
||||
// Verify all entries are shown when no pagination is specified
|
||||
$this->assertStringContainsString('Journal A', $output);
|
||||
$this->assertStringContainsString('Journal B', $output);
|
||||
|
||||
// Test with pagination parameter
|
||||
$_GET["venue_page"] = '1';
|
||||
|
||||
ob_start();
|
||||
$display->display();
|
||||
$output1 = ob_get_clean();
|
||||
|
||||
// Create XML parser to properly analyze the HTML structure
|
||||
$xml = new SimpleXMLElement("<doc>".$output1."</doc>");
|
||||
|
||||
// Count number of entries displayed on first page
|
||||
//$result = $xml->xpath('//tr[contains(@class, "btb-menu-items")]');
|
||||
//$this->assertEquals($PAGE_SIZE, count($result));
|
||||
|
||||
// Verify pagination links existence
|
||||
$this->assertStringContainsString('venue_page=2', $output1);
|
||||
|
||||
// Test second page
|
||||
$_GET["venue_page"] = '2';
|
||||
ob_start();
|
||||
$display->display();
|
||||
$output2 = ob_get_clean();
|
||||
|
||||
// Verify navigation links
|
||||
$this->assertStringContainsString('venue_page=1', $output2); // Link to previous page
|
||||
|
||||
// Verify different entries on second page
|
||||
$this->assertStringContainsString('Journal C', $output2);
|
||||
|
||||
// Clean up
|
||||
unset($_GET["venue_page"]);
|
||||
}
|
||||
} // end class
|
||||
|
||||
// Test implementation that records events
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* A helper Display class that is just like SimpleDisplay but just never
|
||||
* outputs section headers (i.e. year numbers). Used by YearCatDisplay.
|
||||
**/
|
||||
class NoHeaderDisplay extends SimpleDisplay {
|
||||
function changeSection($pred, $bib) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* A modified "Academic" display, with reversed grouping. First grouping is by
|
||||
* year, then by category. Uses NoHeaderDisplay to not have year numbers within
|
||||
* categories.
|
||||
*/
|
||||
class YearCatDisplay extends AcademicDisplay {
|
||||
/** an array of strings representing years */
|
||||
var $yearIndex;
|
||||
|
||||
/** transforms a query to HTML
|
||||
* $ query is an array (e.g. array(Q_YEAR=>'2005'))
|
||||
* $title is a string, the title of the section
|
||||
*/
|
||||
function search2html($query, $title) {
|
||||
$entries = $this->db->multisearch($query);
|
||||
if (count($entries)>0) {
|
||||
echo "\n".'<div class="theader">'.$title.'</div>'."\n";
|
||||
}
|
||||
$display = new NoHeaderDisplay();
|
||||
$display->setEntries($entries);
|
||||
$display->display();
|
||||
|
||||
}
|
||||
|
||||
function display() {
|
||||
$this->db = createBibDataBase();
|
||||
$this->db->bibdb = $this->entries;
|
||||
$this->yearIndex = $this->db->yearIndex();
|
||||
|
||||
foreach($this->yearIndex as $year) {
|
||||
echo "\n".'<div class="sheader">'.$year.'</div>'."\n";
|
||||
foreach (_DefaultBibliographySections() as $section) {
|
||||
$this->search2html(array_merge(array(Q_YEAR=>$year), $section['query']),$section['title']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
global $BIBTEXBROWSER_LANG;
|
||||
$BIBTEXBROWSER_LANG=array();
|
||||
$BIBTEXBROWSER_LANG['Bachelor\'s thesis'] = "Bachelorarbeit";
|
||||
$BIBTEXBROWSER_LANG['Books'] = 'Bücher';
|
||||
$BIBTEXBROWSER_LANG['Book Chapters'] = "Buchbeiträge";
|
||||
$BIBTEXBROWSER_LANG['Chapter in'] = "Kapitel in";
|
||||
$BIBTEXBROWSER_LANG['In'] = "In";
|
||||
$BIBTEXBROWSER_LANG['Master\'s thesis'] = "Masterarbeit";
|
||||
$BIBTEXBROWSER_LANG['No date'] = "Kein Datum";
|
||||
$BIBTEXBROWSER_LANG['No publications present'] = "Keine Publikationen vorhanden";
|
||||
$BIBTEXBROWSER_LANG['Other Publications'] = "Andere Veröffentlichungen";
|
||||
$BIBTEXBROWSER_LANG['PhD thesis'] = "Dissertation";
|
||||
$BIBTEXBROWSER_LANG['Refereed Articles'] = "Zeitschriftenbeiträge";
|
||||
$BIBTEXBROWSER_LANG['Refereed Conference Papers'] = "Konferenzbeiträge";
|
||||
$BIBTEXBROWSER_LANG['Refereed Workshop Papers'] = "Workshopbeiträge";
|
||||
$BIBTEXBROWSER_LANG['Technical report'] = "Technischer Bericht";
|
||||
@define('LAST_AUTHOR_SEPARATOR',' und ');
|
||||
?>
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
bibtexbrowser_configure('ABBRV_TYPE','key');
|
||||
// use tabular layout (HTML tables)
|
||||
bibtexbrowser_configure('BIBTEXBROWSER_LAYOUT','table');
|
||||
// URL to individual files
|
||||
bibtexbrowser_configure('BIBTEXBROWSER_URL',"https://publications.zrd-saar.de/");
|
||||
// target for links
|
||||
bibtexbrowser_configure('BIBTEXBROWSER_LINKS_TARGET','_blank');
|
||||
// use IEEE Transactions-like style, e.g. puts authors in front of title
|
||||
bibtexbrowser_configure('BIBLIOGRAPHYSTYLE', 'JanosBibliographyStyle');
|
||||
//bibtexbrowser_configure('BIBLIOGRAPHYSECTIONS','AGSorgeBibliographySections');
|
||||
// Allow "Firstname Lastname" as well as "Lastname, Firstname" for authors
|
||||
bibtexbrowser_configure('USE_FIRST_THEN_LAST',true);
|
||||
|
||||
// Enable all metadata generation
|
||||
bibtexbrowser_configure('METADATA_COINS',true); // see https://en.wikipedia.org/wiki/COinS
|
||||
bibtexbrowser_configure('METADATA_GS',true); // metadata google scholar
|
||||
bibtexbrowser_configure('METADATA_DC',true); // see http://dublincore.org/
|
||||
bibtexbrowser_configure('METADATA_OPENGRAPH',true); // see http://ogp.me/
|
||||
bibtexbrowser_configure('METADATA_EPRINTS',true); // see https://wiki.eprints.org/w/Category:EPrints_Metadata_Fields
|
||||
|
||||
// include language config
|
||||
if(isset($_GET['language']))
|
||||
{
|
||||
include(preg_replace('/local\.php$/',$_GET['language'].'.php',__FILE__));
|
||||
}
|
||||
|
||||
// Order entries by year, but reverse the order (newest on top)
|
||||
bibtexbrowser_configure('ORDER_FUNCTION','compare_bib_entry_by_year_reverse');
|
||||
function compare_bib_entry_by_year_reverse($a, $b)
|
||||
{
|
||||
return 0 - compare_bib_entry_by_year($a, $b);
|
||||
}
|
||||
|
||||
// A custom URL builder for the static files we create
|
||||
bibtexbrowser_configure('BIBTEXBROWSER_URL_BUILDER', 'url_builder_static');
|
||||
function url_builder_static($bibentry) {
|
||||
return BIBTEXBROWSER_URL.'keys/'.$bibentry->getKey().'.html';
|
||||
}
|
||||
?>
|
||||
+16
-14
@@ -181,6 +181,7 @@ if (defined('ENCODING')) {
|
||||
@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('VENUE_SIZE',30); // number of venues per table
|
||||
@define('READLINE_LIMIT',1024);
|
||||
@define('Q_YEAR', 'year');
|
||||
@define('Q_YEAR_PAGE', 'year_page');
|
||||
@@ -2874,7 +2875,6 @@ usage:
|
||||
$db = zetDB('bibacid-utf8.bib');
|
||||
$menu = new MenuManager();
|
||||
$menu->setDB($db);
|
||||
$menu->year_size=100;// should display all years :)
|
||||
$menu->display();
|
||||
</pre>
|
||||
*/
|
||||
@@ -2883,11 +2883,6 @@ class MenuManager {
|
||||
/** The bibliographic database, an instance of class BibDataBase. */
|
||||
var $db;
|
||||
|
||||
var $type_size = TYPES_SIZE;
|
||||
var $year_size = YEAR_SIZE;
|
||||
var $author_size = AUTHORS_SIZE;
|
||||
var $tag_size = TAGS_SIZE;
|
||||
|
||||
function __construct() {
|
||||
}
|
||||
|
||||
@@ -2952,17 +2947,24 @@ class MenuManager {
|
||||
}
|
||||
else $page = 1;
|
||||
|
||||
$this->displayMenu('Types', $types, $page, $this->type_size, Q_TYPE_PAGE, Q_INNER_TYPE);
|
||||
$this->displayMenu('Types', $types, $page, bibtexbrowser_configuration("TYPES_SIZE"), Q_TYPE_PAGE, Q_INNER_TYPE);
|
||||
}
|
||||
|
||||
|
||||
/** Displays and controls the venues. */
|
||||
function venueVC() {
|
||||
// retrieve authors list to display
|
||||
$data = $this->db->venueIndex();
|
||||
// retrieve venues list to display
|
||||
$venues = $this->db->venueIndex();
|
||||
|
||||
$this->displayMenu('Venues', $data, 1, 100000, Q_SEARCH,
|
||||
Q_SEARCH);
|
||||
// determine the venues page to display
|
||||
if (isset($_GET['venue_page'])) {
|
||||
$page = $_GET['venue_page'];
|
||||
} else $page = 1;
|
||||
|
||||
if (count($venues) > 0) {
|
||||
$this->displayMenu('Venues', $venues, $page, bibtexbrowser_configuration("VENUE_SIZE"), 'venue_page',
|
||||
Q_SEARCH);
|
||||
}
|
||||
}
|
||||
|
||||
/** Displays and controls the authors menu in a table. */
|
||||
@@ -2977,7 +2979,7 @@ class MenuManager {
|
||||
else $page = 1;
|
||||
|
||||
|
||||
$this->displayMenu('Authors', $authors, $page, $this->author_size, Q_AUTHOR_PAGE,
|
||||
$this->displayMenu('Authors', $authors, $page, bibtexbrowser_configuration("AUTHORS_SIZE"), Q_AUTHOR_PAGE,
|
||||
Q_AUTHOR);
|
||||
}
|
||||
|
||||
@@ -2992,7 +2994,7 @@ class MenuManager {
|
||||
} else $page = 1;
|
||||
|
||||
|
||||
if (count($tags)>0) $this->displayMenu('Keywords', $tags, $page, $this->tag_size, Q_TAG_PAGE,
|
||||
if (count($tags)>0) $this->displayMenu('Keywords', $tags, $page, bibtexbrowser_configuration("MENU_SIZE"), Q_TAG_PAGE,
|
||||
Q_TAG);
|
||||
}
|
||||
|
||||
@@ -3008,7 +3010,7 @@ class MenuManager {
|
||||
else $page = 1;
|
||||
|
||||
|
||||
$this->displayMenu('Years', $years, $page, $this->year_size, Q_YEAR_PAGE,
|
||||
$this->displayMenu('Years', $years, $page, bibtexbrowser_configuration("YEAR_SIZE"), Q_YEAR_PAGE,
|
||||
Q_YEAR);
|
||||
}
|
||||
|
||||
|
||||
Executable
+57
@@ -0,0 +1,57 @@
|
||||
#!/bin/bash
|
||||
|
||||
# set some paths/binary names depending on the OS
|
||||
case "$(uname -s)" in
|
||||
"Darwin")
|
||||
PHP="php83"
|
||||
;;
|
||||
# "Linux" is Linux
|
||||
*)
|
||||
PHP="php"
|
||||
;;
|
||||
esac
|
||||
|
||||
# URL of the Bibtex file
|
||||
BIBTEX_URL="https://cloud.hiz-saarland.de/public.php/dav/files/Yj8FtZsTS9TkFWG"
|
||||
# command to run BibtexBrowser
|
||||
BIBTEXBROWSER="${PHP} -c \"php_cli.ini\" -f \"bibtexbrowser.php\""
|
||||
|
||||
# DELETEME
|
||||
rm -rf "artifacts" "temp"
|
||||
# create output directories and download bibtex file
|
||||
mkdir -p "artifacts/keys" "temp"
|
||||
wget -O "temp/zrd.bib" "$BIBTEX_URL"
|
||||
|
||||
# if `bibtool` is available, sanitize the bibtex file
|
||||
if which bibtool >/dev/null 2>&1
|
||||
then
|
||||
bibtool "temp/zrd.bib" > "temp/zrd.new.bib"
|
||||
echo "Bibtool successful!"
|
||||
mv -f "temp/zrd.new.bib" "temp/zrd.bib"
|
||||
fi
|
||||
|
||||
# copy static files
|
||||
cp -fR "static" "artifacts/"
|
||||
|
||||
for WEBSITE_LANGUAGE in german
|
||||
do :
|
||||
# generate full index
|
||||
eval "$BIBTEXBROWSER \"bib=temp/zrd.bib\" all display=YearCatDisplay language=$WEBSITE_LANGUAGE > \"artifacts/all.${WEBSITE_LANGUAGE}.html\""
|
||||
# generate index for each person
|
||||
while read LINE
|
||||
do :
|
||||
ALIAS="$(echo "$LINE" | cut -d ':' -f 1)"
|
||||
SEARCHSTRING="$(echo "$LINE" | cut -d ':' -f 2)"
|
||||
eval "$BIBTEXBROWSER \"bib=temp/zrd.bib\" \"author=$SEARCHSTRING\" academic=1 language=$WEBSITE_LANGUAGE > \"artifacts/${ALIAS}.${WEBSITE_LANGUAGE}.html\""
|
||||
done < "persons.txt"
|
||||
done
|
||||
|
||||
# generate page for each key
|
||||
egrep '^@' "temp/zrd.bib" | sed -e 's/.*\t \(.*\),/\1/' | while read KEY
|
||||
do :
|
||||
eval "$BIBTEXBROWSER \"bib=temp/zrd.bib\" \"key=$KEY\" > \"artifacts/keys/${KEY}.html\""
|
||||
done
|
||||
|
||||
# Clean up
|
||||
rm -rf "temp"
|
||||
rm bibtexbrowser_*.dat
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
ajla:Ajla Hajric
|
||||
anastasiia:Anastasiia Babych
|
||||
andreas:Andreas Rebmann
|
||||
anna:Anna Zichler
|
||||
frederik:Frederik Möllers
|
||||
greta:Greta Böttcher
|
||||
jochen:Jochen Krüger
|
||||
lina:Lina Nauerz
|
||||
max:Maximilian Eichacker
|
||||
natascha:Natascha Schliwinski
|
||||
niklas:Niklas Dahlem
|
||||
piotr:Piotr Rataj
|
||||
simone:Simone Salemi
|
||||
stephanie:Stephanie Vogelgesang
|
||||
theresa:Theresa Moll
|
||||
tim:Tim Schneider
|
||||
@@ -0,0 +1 @@
|
||||
auto_prepend_file = "prepend.php"
|
||||
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
parse_str(implode('&', array_slice($argv, 1)), $_GET);
|
||||
?>
|
||||
Reference in New Issue
Block a user