6 Commits
Author SHA1 Message Date
Frederik Möllers b9f9c07fbd Fix Bibtexbrowser URL
Was: staging
Now: production
2026-03-27 00:37:55 +01:00
Frederik Möllers f20af8f28f Fix JanosBibliographyStyle and add notes
Fix missing brace in if-statement for comments in JanosBibliographyStyle
Add notes to entries (in addition to comments)
2026-03-27 00:35:16 +01:00
Frederik Möllers a796f4c284 Don't fail makehtml.sh if no *.dat file exists 2026-03-27 00:25:19 +01:00
Frederik Möllers 38d4e12d37 Merge remote-tracking branch 'upstream'
Pull latest upstream changes
2026-03-27 00:23:49 +01:00
Martin Monperrus 6d0b3c8493 fix: improve caching feature usability 2026-01-24 06:33:48 +01:00
Martin Monperrus d15355b65c fix syntactic bug 2025-11-12 22:09:08 +01:00
4 changed files with 67 additions and 6 deletions
+55
View File
@@ -1586,6 +1586,61 @@ class BibtexbrowserTest extends PHPUnit_Framework_TestCase {
// Clean up
unset($_GET["venue_page"]);
}
function test_AcademicDisplay() {
// Create test BibTeX database with entries from different categories
$bibtex = "@article{journal1,title={Journal Article},author={John Doe},journal={Nature},year=2023,type={Journal Articles}}
@inproceedings{conf1,title={Conference Paper},author={Jane Smith},booktitle={ICSE},year=2023,type={Refereed Conference Papers}}
@book{book1,title={A Book},author={Bob Johnson},publisher={Springer},year=2022,type={Books}}
@techreport{tech1,title={Technical Report},author={Alice Brown},institution={MIT},year=2023,type={Technical Reports}}";
$test_data = fopen('php://memory','x+');
fwrite($test_data, $bibtex);
fseek($test_data,0);
$db = new BibDataBase();
$db->update_internal("inline", $test_data);
// Test with BIBTEXBROWSER_ACADEMIC_TOC = true
bibtexbrowser_configure('BIBTEXBROWSER_ACADEMIC_TOC', true);
$display = new AcademicDisplay();
$display->setDB($db);
ob_start();
$display->display();
$output_with_toc = ob_get_clean();
// Verify TOC is present
// $this->assertStringContainsString('class="btb-menu-toc"', $output_with_toc);
$this->assertStringContainsString('Refereed Articles', $output_with_toc);
// Verify HTML structure for both cases
$xml1 = new SimpleXMLElement("<doc>".$output_with_toc."</doc>");
$headers1 = $xml1->xpath('//div[@class="sheader"]');
$this->assertEquals(0, count($headers1));
$anchors = $xml1->xpath('//h2');
$this->assertGreaterThan(3, count($anchors));
// Test with BIBTEXBROWSER_ACADEMIC_TOC = false
bibtexbrowser_configure('BIBTEXBROWSER_ACADEMIC_TOC', false);
$display2 = new AcademicDisplay();
$display2->setDB($db);
ob_start();
$display2->display();
$output_without_toc = ob_get_clean();
// Verify TOC is not present
$this->assertStringNotContainsString('class="btb-menu-toc"', $output_without_toc);
// But category headers should still be present
$this->assertStringContainsString('Refereed Articles', $output_without_toc);
$xml2 = new SimpleXMLElement("<doc>".$output_without_toc."</doc>");
$headers2 = $xml2->xpath('//div[@class="sheader"]');
$this->assertGreaterThan(0, count($headers2));
}
} // end class
// Test implementation that records events
+1 -1
View File
@@ -3,7 +3,7 @@ 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-staging.zrd-saar.de/");
bibtexbrowser_configure('BIBTEXBROWSER_URL',"https://publications.zrd-saar.de/");
// URL to jQuery
bibtexbrowser_configure('JQUERY_URI', '/static/jquery-3.6.4.min.js');
// URL to MathJax
+10 -4
View File
@@ -236,7 +236,7 @@ if (defined('ENCODING')) {
@define('BIBTEXBROWSER_URL',basename(__FILE__));
// Specify the location of the cache file for servers that need temporary files written in a specific location
@define('CACHE_DIR','');
@define('CACHE_DIR','.');
// Specify the location of the bib file for servers that need do not allow slashes in URLs,
// where the bib file and bibtexbrowser.php are in different directories.
@@ -368,7 +368,7 @@ function _zetDB($bibtex_filenames) {
// ---------------------------- HANDLING caching of compiled bibtex files
// for sake of performance, once the bibtex file is parsed
// we try to save a "compiled" in a txt file
$compiledbib = CACHE_DIR.'bibtexbrowser_'.md5($bibtex_filenames).'.dat';
$compiledbib = c("CACHE_DIR").'/bibtexbrowser_'.md5($bibtex_filenames).'.dat';
$parse=filemtime(__FILE__)>@filemtime($compiledbib);
@@ -2587,6 +2587,12 @@ function JanosBibliographyStyle($bibentry) {
// some comments (e.g. acceptance rate)?
if ($bibentry->hasField('comment')) {
$result .= " (".$bibentry->getField("comment").")";
}
// some notes (e.g. "accepted for publishing")?
if (($type!="misc") && $bibentry->hasField('note')) {
$result .= " (".$bibentry->getField("note").")";
}
// add the Coin URL
$result .= "\n".$bibentry->toCoins();
@@ -3481,7 +3487,7 @@ class AcademicDisplay {
$this->db = createBibDataBase();
$this->db->bibdb = $this->entries;
if (BIBTEXBROWSER_ACADEMIC_TOC != true) {
if (c("BIBTEXBROWSER_ACADEMIC_TOC") == false) {
foreach (_DefaultBibliographySections() as $section) {
$this->search2html($section['query'],$section['title']);
}
@@ -3515,7 +3521,7 @@ class AcademicDisplay {
echo "\n<a name=\"".$section['anchor']."\"></a>";
echo "<h".BIBTEXBROWSER_HTMLHEADINGLEVEL.">";
echo $section['title']." (".$section['count'].")";
echo "</h".BIBTEXBROWSER_HTMLHEADINGLEVEL.">\n",
echo "</h".BIBTEXBROWSER_HTMLHEADINGLEVEL.">\n";
$section['display']->display();
}
}
+1 -1
View File
@@ -54,4 +54,4 @@ done
# Clean up
rm -rf "temp"
rm bibtexbrowser_*.dat
rm -f bibtexbrowser_*.dat