fix: add support for progressive enhancement in included mode (#100)

This commit is contained in:
Martin Monperrus
2019-12-15 16:59:21 +00:00
committed by GitHub
parent c6464f9cec
commit f48e78d5c8
2 changed files with 6 additions and 2 deletions
+2 -1
View File
@@ -66,6 +66,7 @@ class BTBTest extends PHPUnit_Framework_TestCase {
// resetting the default link style // resetting the default link style
bibtexbrowser_configure('BIBTEXBROWSER_LINK_STYLE','bib2links_default'); bibtexbrowser_configure('BIBTEXBROWSER_LINK_STYLE','bib2links_default');
bibtexbrowser_configure('ABBRV_TYPE','index'); bibtexbrowser_configure('ABBRV_TYPE','index');
bibtexbrowser_configure('BIBTEXBROWSER_USE_PROGRESSIVE_ENHANCEMENT', false);
} }
function test_checkdoc() { function test_checkdoc() {
@@ -759,7 +760,7 @@ class BTBTest extends PHPUnit_Framework_TestCase {
$d = new SimpleDisplay(); $d = new SimpleDisplay();
$d->setDB($db); $d->setDB($db);
ob_start(); ob_start();
$d->display(); NoWrapper($d);
$output = ob_get_clean(); $output = ob_get_clean();
$res = eval("return ".file_get_contents('reference-output-wp-publications.txt').";"); $res = eval("return ".file_get_contents('reference-output-wp-publications.txt').";");
$this->assertEquals(strip_tags($res['rendered']), "[wp-publications bib=sample.bib all=1] gives:\n".strip_tags($output)."\n"); $this->assertEquals(strip_tags($res['rendered']), "[wp-publications bib=sample.bib all=1] gives:\n".strip_tags($output)."\n");
+4 -1
View File
@@ -4210,7 +4210,7 @@ if (method_exists($content, 'getTitle')) {
$content->display(); $content->display();
echo poweredby(); echo poweredby();
if (BIBTEXBROWSER_USE_PROGRESSIVE_ENHANCEMENT) { if (c('BIBTEXBROWSER_USE_PROGRESSIVE_ENHANCEMENT')) {
javascript(); javascript();
} }
@@ -4235,6 +4235,9 @@ usage:
*/ */
function NoWrapper($content) { function NoWrapper($content) {
echo $content->display(); echo $content->display();
if (c('BIBTEXBROWSER_USE_PROGRESSIVE_ENHANCEMENT')) {
javascript();
}
} }
/** is used to create an subset of a bibtex file. /** is used to create an subset of a bibtex file.