From a8c24dab1864437d3b145d53820c30b605ae2f87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frederik=20M=C3=B6llers?= Date: Mon, 8 Sep 2025 04:59:13 +0000 Subject: [PATCH 1/4] Add internationalization for third-party styles (#137) --- bibtexbrowser.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/bibtexbrowser.php b/bibtexbrowser.php index c91a18e..a5b04ff 100755 --- a/bibtexbrowser.php +++ b/bibtexbrowser.php @@ -2524,11 +2524,11 @@ function JanosBibliographyStyle($bibentry) { } if ($type=="inproceedings" && $bibentry->hasField(BOOKTITLE)) { - $booktitle = ''.'In '.$bibentry->getField(BOOKTITLE).''; + $booktitle = ''.__('In').' '.$bibentry->getField(BOOKTITLE).''; } if ($type=="incollection" && $bibentry->hasField(BOOKTITLE)) { - $booktitle = ''.'Chapter in '.$bibentry->getField(BOOKTITLE).''; + $booktitle = ''.__('Chapter in').' '.$bibentry->getField(BOOKTITLE).''; } if ($type=="article" && $bibentry->hasField("journal")) { @@ -2551,14 +2551,14 @@ function JanosBibliographyStyle($bibentry) { $publisher=''; if ($type=="phdthesis") { - $publisher = 'PhD thesis, '.$bibentry->getField(SCHOOL); + $publisher = __('PhD thesis').', '.$bibentry->getField(SCHOOL); } if ($type=="mastersthesis") { - $publisher = 'Master\'s thesis, '.$bibentry->getField(SCHOOL); + $publisher = __('Master\'s thesis').', '.$bibentry->getField(SCHOOL); } if ($type=="techreport") { - $publisher = 'Technical report, '; + $publisher = __('Technical report').', '; $publisher .=$bibentry->getField("institution"); if ($bibentry->hasField("number")) { $publisher .= ' '.$bibentry->getField("number"); @@ -2571,13 +2571,13 @@ function JanosBibliographyStyle($bibentry) { if ($publisher!='') $entry[] = $publisher; if ($type=="article") { - if ($bibentry->hasField('volume')) $entry[] = "vol. ".$bibentry->getField("volume"); - if ($bibentry->hasField('number')) $entry[] = 'no. '.$bibentry->getField("number"); + if ($bibentry->hasField('volume')) $entry[] = __("vol.")." ".$bibentry->getField("volume"); + if ($bibentry->hasField('number')) $entry[] = __('no.').' '.$bibentry->getField("number"); } if ($bibentry->hasField('address')) $entry[] = $bibentry->getField("address"); - if ($bibentry->hasField('pages')) $entry[] = str_replace("--", "-", "pp. ".$bibentry->getField("pages")); + if ($bibentry->hasField('pages')) $entry[] = str_replace("--", "-", __("pp.")." ".$bibentry->getField("pages")); if ($bibentry->hasField(YEAR)) $entry[] = $bibentry->getYear(); @@ -2641,9 +2641,9 @@ function VancouverBibliographyStyle($bibentry) { $booktitle = $editor; $booktitle = $bibentry->getField("note"); } else if ($type=="inproceedings") { - $booktitle = 'In: ' . $editor . $bibentry->getField(BOOKTITLE); + $booktitle = __('In').': ' . $editor . $bibentry->getField(BOOKTITLE); } else if ($type=="incollection") { - $booktitle = 'Chapter in '; + $booktitle = __('Chapter in').' '; if ($editor!='') $booktitle .= $editor; $booktitle .= $bibentry->getField(BOOKTITLE); } else if ($type=="article") { @@ -2656,11 +2656,11 @@ function VancouverBibliographyStyle($bibentry) { $publisher=''; if ($type=="phdthesis") { - $publisher = 'PhD thesis, '.$bibentry->getField(SCHOOL); + $publisher = __('PhD thesis').', '.$bibentry->getField(SCHOOL); } else if ($type=="mastersthesis") { - $publisher = 'Master\'s thesis, '.$bibentry->getField(SCHOOL); + $publisher = __('Master\'s thesis').', '.$bibentry->getField(SCHOOL); } else if ($type=="techreport") { - $publisher = 'Technical report, '.$bibentry->getField("institution"); + $publisher = __('Technical report').', '.$bibentry->getField("institution"); } if ($bibentry->hasField("publisher")) { $publisher = $bibentry->getField("publisher"); From 2867059f685e49a5195b08bb55619bec2cd5be6d Mon Sep 17 00:00:00 2001 From: Martin Monperrus Date: Tue, 9 Sep 2025 07:13:11 +0200 Subject: [PATCH 2/4] fix https://github.com/monperrus/bibtexbrowser/issues/136 --- BibtexbrowserTest.php | 66 +++++++++++++++++++++++++++++++++++++++++++ bibtexbrowser.php | 2 +- 2 files changed, 67 insertions(+), 1 deletion(-) diff --git a/BibtexbrowserTest.php b/BibtexbrowserTest.php index cca6d4a..4cd0d27 100755 --- a/BibtexbrowserTest.php +++ b/BibtexbrowserTest.php @@ -1455,6 +1455,72 @@ class BibtexbrowserTest extends PHPUnit_Framework_TestCase { $this->assertEquals(0, count($results)); } + function test_tags_pagination() { + // Define the page size for pagination + bibtexbrowser_configure('TAGS_SIZE', 2); + + // Create a test BibTeX database with multiple entries and keywords + $bibtex = "@article{paper1,title={Paper One},keywords={tagA, tagB},year=2020} + @article{paper2,title={Paper Two},keywords={tagC},year=2020} + @article{paper3,title={Paper Three},keywords={tagD},year=2020} + @article{paper4,title={Paper Four},keywords={tagE},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 MenuManager display + $display = new MenuManager(); + $display->setDB($db); + + // Test the first page + $_GET["tags_page"] = '1'; + ob_start(); + $display->display(); + $output1 = ob_get_clean(); + + // Tags are sorted alphabetically. + $this->assertStringContainsString('tagA', $output1); + $this->assertStringContainsString('tagB', $output1); + $this->assertStringNotContainsString('tagC', $output1); + + // Verify pagination link to the next page + $this->assertStringContainsString('keywords_page=2', $output1); + + // Test the second page + $_GET["keywords_page"] = '2'; + ob_start(); + $display->display(); + $output2 = ob_get_clean(); + + $this->assertStringContainsString('tagC', $output2); + $this->assertStringContainsString('tagD', $output2); + $this->assertStringNotContainsString('tagA', $output2); + $this->assertStringNotContainsString('tagE', $output2); + + // Verify navigation links to previous and next pages + $this->assertStringContainsString('keywords_page=1', $output2); + $this->assertStringContainsString('keywords_page=3', $output2); + + // Test the third page + $_GET["keywords_page"] = '3'; + ob_start(); + $display->display(); + $output3 = ob_get_clean(); + + $this->assertStringContainsString('tagE', $output3); + $this->assertStringNotContainsString('tagD', $output3); + + // Verify navigation link to the previous page + $this->assertStringContainsString('keywords_page=2', $output3); + $this->assertStringNotContainsString('keywords_page=4', $output3); // No next page + + // Clean up + unset($_GET["keywords_page"]); + } function test_venuevc_pagination() { // Define the page size for pagination bibtexbrowser_configure('VENUE_SIZE', 2); diff --git a/bibtexbrowser.php b/bibtexbrowser.php index a5b04ff..dcc05d3 100755 --- a/bibtexbrowser.php +++ b/bibtexbrowser.php @@ -2994,7 +2994,7 @@ class MenuManager { } else $page = 1; - if (count($tags)>0) $this->displayMenu('Keywords', $tags, $page, bibtexbrowser_configuration("MENU_SIZE"), Q_TAG_PAGE, + if (count($tags)>0) $this->displayMenu('Keywords', $tags, $page, bibtexbrowser_configuration("TAGS_SIZE"), Q_TAG_PAGE, Q_TAG); } From 2381e7c412d616db80d9f93aa99d86ac87b9a4ed Mon Sep 17 00:00:00 2001 From: Hans-Nikolai Viessmann Date: Wed, 1 Oct 2025 14:00:10 +0200 Subject: [PATCH 3/4] add DokuWiki bb2dw plugin reference to readme file (#138) --- README.wiki | 1 + 1 file changed, 1 insertion(+) diff --git a/README.wiki b/README.wiki index eeb5b3c..cd90d51 100755 --- a/README.wiki +++ b/README.wiki @@ -60,6 +60,7 @@ The following uses bibtexbrowser under the hood: * [[http://www.monperrus.net/martin/feeding-mysql-database-with-bibtexbrowser|Feeding a MySQL database from the content of a bibtex file]] * Publication lists in Wordpress with [[http://www.monperrus.net/martin/wp-publications|wp-publications]] * [[http://www.monperrus.net/martin/publication-lists-with-hal-and-bibtexbrowser|Publication lists with HAL and bibtexbrowser]] +* Generating publication lists in DokuWiki using the [[https://www.dokuwiki.org/plugin:bb4dw|bb4dw plugin]] =====Demo and screenshot===== From 95fe89312145c6b6f5817307f621fbe0792855e9 Mon Sep 17 00:00:00 2001 From: Martin Monperrus Date: Wed, 1 Oct 2025 14:04:59 +0200 Subject: [PATCH 4/4] Update README.wiki --- README.wiki | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.wiki b/README.wiki index cd90d51..4dac4f2 100755 --- a/README.wiki +++ b/README.wiki @@ -64,7 +64,7 @@ The following uses bibtexbrowser under the hood: =====Demo and screenshot===== -Demo: [[http://bibtexbrowser.sourceforge.net/bibtexbrowser.php?bib=metrics.bib|Here, you can browse a bibtex file dedicated to software metrics]] +Demo: [[https://www.monperrus.net/martin/bibtexbrowser.php|Here, you can browse a bibtex file of Martin's papers.]] bibtexbrowser screenshot