From fa4e80bbabef618d7f3b3e5ee1e5ca9abdafd277 Mon Sep 17 00:00:00 2001 From: Martin Monperrus Date: Fri, 27 Oct 2017 22:15:29 +0200 Subject: [PATCH] fix #74 --- bibtexbrowser-test.php | 6 +++--- bibtexbrowser.php | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/bibtexbrowser-test.php b/bibtexbrowser-test.php index 2d7c72d..e69c2a4 100755 --- a/bibtexbrowser-test.php +++ b/bibtexbrowser-test.php @@ -527,7 +527,7 @@ class BTBTest extends PHPUnit_Framework_TestCase { function test_homepage_link() { bibtexbrowser_configure('USE_COMMA_AS_NAME_SEPARATOR_IN_OUTPUT', false); bibtexbrowser_configure('USE_FIRST_THEN_LAST', false); - $bibtex = "@string{hp_MartinMonperrus={http://www.monperrus.net/martin},hp_FooAcé={http://example.net/}},@article{aKey61,title={An article Book},author = {Martin Monperrus and Foo Acé and Monperrus, Martin}}\n"; + $bibtex = "@string{hp_MartinMonperrus={http://www.monperrus.net/~martin},hp_FooAcé={http://example.net/}},@article{aKey61,title={An article Book},author = {Martin Monperrus and Foo Acé and Monperrus, Martin}}\n"; $test_data = fopen('php://memory','x+'); fwrite($test_data, $bibtex); fseek($test_data,0); @@ -535,9 +535,9 @@ class BTBTest extends PHPUnit_Framework_TestCase { $db->update_internal("inline", $test_data); $entry = $db->getEntryByKey('aKey61'); $authors = $entry->getFormattedAuthorsArray(); - $this->assertEquals('Martin Monperrus', $authors[0]); + $this->assertEquals('Martin Monperrus', $authors[0]); $this->assertEquals('Foo Acé', $authors[1]); - $this->assertEquals('Monperrus, Martin', $authors[2]); + $this->assertEquals('Monperrus, Martin', $authors[2]); } function test_author_index() { diff --git a/bibtexbrowser.php b/bibtexbrowser.php index f37fe11..d98523d 100755 --- a/bibtexbrowser.php +++ b/bibtexbrowser.php @@ -1226,7 +1226,9 @@ class BibEntry { // we assume that "comment" is never latex code // but instead could contain HTML code (with links using the character "~" for example) // so "comment" is not transformed too - if ($name!='url' && $name!='comment') { + if ($name!='url' && $name!='comment' + && !preg_match('/^hp_/',$name) // homepage links should not be transformed with latex2html + ) { $value = $this->transformValue($value); // 4. transform existing encoded character in the new format