Merge branch 'lpirl-pr_math'
This commit is contained in:
+29
-7
@@ -56,6 +56,11 @@ function bibtexbrowser_configure($key, $value) {
|
||||
@define('BIBLIOGRAPHYSTYLE','DefaultBibliographyStyle');// this is the name of a function
|
||||
@define('BIBLIOGRAPHYSECTIONS','DefaultBibliographySections');// this is the name of a function
|
||||
@define('BIBLIOGRAPHYTITLE','DefaultBibliographyTitle');// this is the name of a function
|
||||
|
||||
// shall we load MathJax to render math in $…$ in HTML?
|
||||
@define('BIBTEXBROWSER_RENDER_MATH', true);
|
||||
@define('MATHJAX_URI', '//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML.js');
|
||||
|
||||
// can we load bibtex files on external servers?
|
||||
@define('BIBTEXBROWSER_LOCAL_BIB_ONLY', true);
|
||||
|
||||
@@ -879,6 +884,13 @@ function char2html_case_sensitive($line,$latexmodifier,$char,$entitiyfragment) {
|
||||
*/
|
||||
function latex2html($line) {
|
||||
|
||||
$line = preg_replace('/([^\\\\])~/','\\1 ', $line);
|
||||
|
||||
// performance increases with this test
|
||||
// bug found by Serge Barral: what happens if we have curly braces only (typically to ensure case in Latex)
|
||||
// added && strpos($line,'{')===false
|
||||
if (strpos($line,'\\')===false && strpos($line,'{')===false) return $line;
|
||||
|
||||
$maths = array();
|
||||
$index = 0;
|
||||
// first we escape the math env
|
||||
@@ -889,13 +901,6 @@ function latex2html($line) {
|
||||
$index++;
|
||||
}
|
||||
|
||||
$line = preg_replace('/([^\\\\])~/','\\1 ', $line);
|
||||
|
||||
// performance increases with this test
|
||||
// bug found by Serge Barral: what happens if we have curly braces only (typically to ensure case in Latex)
|
||||
// added && strpos($line,'{')===false
|
||||
if (strpos($line,'\\')===false && strpos($line,'{')===false) return $line;
|
||||
|
||||
// we should better replace this before the others
|
||||
// in order not to mix with the HTML entities coming after (just in case)
|
||||
$line = str_replace('\\&','&', $line);
|
||||
@@ -2318,6 +2323,19 @@ $('a.biburl').each(function() { // for each url "[bibtex]"
|
||||
} // end function javascript
|
||||
|
||||
|
||||
if (!function_exists('javascript_math')) {
|
||||
function javascript_math() {
|
||||
?>
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
tex2jax: {inlineMath: [["$","$"]]}
|
||||
});
|
||||
</script>
|
||||
<script src="<?php echo MATHJAX_URI ?>"></script>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** is used for creating menus (by type, by year, by author, etc.).
|
||||
usage:
|
||||
@@ -3703,6 +3721,10 @@ if (method_exists($content, 'getTitle')) {
|
||||
if (BIBTEXBROWSER_USE_PROGRESSIVE_ENHANCEMENT) {
|
||||
javascript();
|
||||
}
|
||||
|
||||
if (BIBTEXBROWSER_RENDER_MATH) {
|
||||
javascript_math();
|
||||
}
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user