diff --git a/BibtexbrowserTest.php b/BibtexbrowserTest.php
index daff67b..33fb60e 100755
--- a/BibtexbrowserTest.php
+++ b/BibtexbrowserTest.php
@@ -141,7 +141,7 @@ class BibtexbrowserTest extends PHPUnit_Framework_TestCase {
// IEEE style
bibtexbrowser_configure('BIBLIOGRAPHYSTYLE','JanosBibliographyStyle');
- $this->assertEquals("Foo Bar and Jane Doe, \"An Article\", In New Results, vol. 5, pp. 1-2, 2009.\n ",strip_tags($first_entry->toHTML()));
+ $this->assertEquals("Foo Bar and Jane Doe, \"An Article\", New Results, vol. 5, pp. 1-2, 2009.\n ",strip_tags($first_entry->toHTML()));
$css_classes_after = $this->extract_css_classes($first_entry->toHTML());
// contract: make sure the Janos style and default style use the same CSS classes
$this->assertEquals($css_classes_before, $css_classes_after);
@@ -846,6 +846,20 @@ class BibtexbrowserTest extends PHPUnit_Framework_TestCase {
$this->assertEquals($expected,$entry->toCFF());
}
+
+ function test_uppercase() {
+ print(preg_replace_callback('/\\\\uppercase\{(.*)\}/',"strtolowercallback", "$\uppercase{B}"));
+
+ $bibtex = "@article{doe2000,title={Preferential polarization and its reversal in polycrystalline $\uppercase{B}i\uppercase{F}e\uppercase{O}_{3}$/$\uppercase{L}a_{0. 5}\uppercase{S}r_{0.5} \uppercase{C}o\uppercase{O}_{3}$ heterostructures},author={Jane Doe},journal={The Wordpress Journal},year=2000}";
+ $test_data = fopen('php://memory','x+');
+ fwrite($test_data, $bibtex);
+ fseek($test_data,0);
+ $db = new BibDataBase();
+ $_GET[Q_FILE] = 'sample.bib';
+ $db->update_internal("inline", $test_data);
+ $this->assertEquals('Preferential polarization and its reversal in polycrystalline $BiFeO_{3}$/$La_{0. 5}Sr_{0.5} CoO_{3}$ heterostructures', $db->bibdb['doe2000']->getTitle());
+ }
+
} // end class
diff --git a/bibtexbrowser.php b/bibtexbrowser.php
index d5551f4..f79f2bc 100755
--- a/bibtexbrowser.php
+++ b/bibtexbrowser.php
@@ -997,6 +997,21 @@ function latex2html($line, $do_clean_extra_bracket=true) {
// added && strpos($line,'{')===false
if (strpos($line,'\\')===false && strpos($line,'{')===false) return $line;
+ // handling uppercase
+ // echo preg_replace_callback('!\b[a-z]!', 'upper', strtolower($str));
+ if (!function_exists("strtolowercallback")) {
+ function strtolowercallback($array) {
+ return strtolower($array[1]);
+ }
+ }
+ if (!function_exists("strtouppercallback")) {
+ function strtouppercallback($array) {
+ return strtoupper($array[1]);
+ }
+ }
+ $line = preg_replace_callback('/\\\\uppercase\{(.*)\}/U',"strtouppercallback", $line);
+ $line = preg_replace_callback('/\\\\lowercase\{(.*)\}/U',"strtolowercallback", $line);
+
$maths = array();
$index = 0;
// first we escape the math env
@@ -1087,6 +1102,8 @@ function latex2html($line, $do_clean_extra_bracket=true) {
// handling \textsubscript{....} FAILS if there still are nested {}
$line = preg_replace('/\\\\textsubscript\{(.*)\}/U','\\1', $line);
+
+
if ($do_clean_extra_bracket) {
// clean extra tex curly brackets, usually used for preserving capitals
// must come before the final math replacement
@@ -2452,7 +2469,7 @@ function JanosBibliographyStyle($bibentry) {
}
if ($type=="article" && $bibentry->hasField("journal")) {
- $booktitle = ''.'In '.$bibentry->getField("journal").'';
+ $booktitle = ''.''.$bibentry->getField("journal").'';
}
@@ -2774,12 +2791,16 @@ $('a.biburl').each(function() { // for each url "[bibtex]"
if (!function_exists('javascript_math')) {
function javascript_math() {
?>
-
-
+
+