Browse Source

Added transformation for TeX characters

---, --, \%, \&
pull/35/head
Klaus-Hendrik Wolf 10 years ago
parent
commit
8f05c25a10
  1. 6
      bibtexbrowser.php

6
bibtexbrowser.php

@ -886,6 +886,9 @@ function latex2html($line) {
$line = preg_replace('/([^\\\\])~/','\\1 ', $line); $line = preg_replace('/([^\\\\])~/','\\1 ', $line);
$line = str_replace('---','—',$line);
$line = str_replace('--','–',$line);
// performance increases with this test // performance increases with this test
// bug found by Serge Barral: what happens if we have curly braces only (typically to ensure case in Latex) // bug found by Serge Barral: what happens if we have curly braces only (typically to ensure case in Latex)
// added && strpos($line,'{')===false // added && strpos($line,'{')===false
@ -905,6 +908,9 @@ function latex2html($line) {
// in order not to mix with the HTML entities coming after (just in case) // in order not to mix with the HTML entities coming after (just in case)
$line = str_replace('\\&','&', $line); $line = str_replace('\\&','&', $line);
$line = str_replace('\_','_',$line);
$line = str_replace('\%','%',$line);
// handling \url{....} // handling \url{....}
// often used in howpublished for @misc // often used in howpublished for @misc
$line = preg_replace('/\\\\url\{(.*)\}/U','<a href="\\1">\\1</a>', $line); $line = preg_replace('/\\\\url\{(.*)\}/U','<a href="\\1">\\1</a>', $line);

Loading…
Cancel
Save