Merge branch 'lpirl-pr_math'
This commit is contained in:
+43
-21
@@ -56,6 +56,11 @@ function bibtexbrowser_configure($key, $value) {
|
|||||||
@define('BIBLIOGRAPHYSTYLE','DefaultBibliographyStyle');// this is the name of a function
|
@define('BIBLIOGRAPHYSTYLE','DefaultBibliographyStyle');// this is the name of a function
|
||||||
@define('BIBLIOGRAPHYSECTIONS','DefaultBibliographySections');// 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
|
@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?
|
// can we load bibtex files on external servers?
|
||||||
@define('BIBTEXBROWSER_LOCAL_BIB_ONLY', true);
|
@define('BIBTEXBROWSER_LOCAL_BIB_ONLY', true);
|
||||||
|
|
||||||
@@ -879,6 +884,13 @@ function char2html_case_sensitive($line,$latexmodifier,$char,$entitiyfragment) {
|
|||||||
*/
|
*/
|
||||||
function latex2html($line) {
|
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();
|
$maths = array();
|
||||||
$index = 0;
|
$index = 0;
|
||||||
// first we escape the math env
|
// first we escape the math env
|
||||||
@@ -889,13 +901,6 @@ function latex2html($line) {
|
|||||||
$index++;
|
$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
|
// we should better replace this before the others
|
||||||
// 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);
|
||||||
@@ -1699,7 +1704,7 @@ function get_HTML_tag_for_layout() {
|
|||||||
*/
|
*/
|
||||||
function bib2links_default(&$bibentry) {
|
function bib2links_default(&$bibentry) {
|
||||||
$links = array();
|
$links = array();
|
||||||
|
|
||||||
if (BIBTEXBROWSER_BIBTEX_LINKS) {
|
if (BIBTEXBROWSER_BIBTEX_LINKS) {
|
||||||
$link = $bibentry->getBibLink();
|
$link = $bibentry->getBibLink();
|
||||||
if ($link != '') { $links[] = $link; };
|
if ($link != '') { $links[] = $link; };
|
||||||
@@ -1719,7 +1724,7 @@ function bib2links_default(&$bibentry) {
|
|||||||
$link = $bibentry->getGSLink();
|
$link = $bibentry->getGSLink();
|
||||||
if ($link != '') { $links[] = $link; };
|
if ($link != '') { $links[] = $link; };
|
||||||
}
|
}
|
||||||
|
|
||||||
return '<span class="bibmenu">'.implode(" ",$links).'</span>';
|
return '<span class="bibmenu">'.implode(" ",$links).'</span>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1963,7 +1968,7 @@ return
|
|||||||
.bibbooktitle { font-style:italic; }
|
.bibbooktitle { font-style:italic; }
|
||||||
.bibauthor { }
|
.bibauthor { }
|
||||||
.bibpublisher { }
|
.bibpublisher { }
|
||||||
|
|
||||||
See http://schema.org/ScholarlyArticle for the metadata
|
See http://schema.org/ScholarlyArticle for the metadata
|
||||||
*/
|
*/
|
||||||
function DefaultBibliographyStyle(&$bibentry) {
|
function DefaultBibliographyStyle(&$bibentry) {
|
||||||
@@ -2198,7 +2203,7 @@ function createQueryString($array_param) {
|
|||||||
if($key == Q_INNER_KEYS_INDEX) {continue;}
|
if($key == Q_INNER_KEYS_INDEX) {continue;}
|
||||||
$array_param[$key]=$key .'='. urlencode($val);
|
$array_param[$key]=$key .'='. urlencode($val);
|
||||||
}
|
}
|
||||||
|
|
||||||
// adding the bibtex file name is not already there
|
// adding the bibtex file name is not already there
|
||||||
if (isset($_GET[Q_FILE]) && !isset($array_param[Q_FILE])) {
|
if (isset($_GET[Q_FILE]) && !isset($array_param[Q_FILE])) {
|
||||||
// first we add the name of the bib file
|
// first we add the name of the bib file
|
||||||
@@ -2318,6 +2323,19 @@ $('a.biburl').each(function() { // for each url "[bibtex]"
|
|||||||
} // end function javascript
|
} // 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.).
|
/** is used for creating menus (by type, by year, by author, etc.).
|
||||||
usage:
|
usage:
|
||||||
@@ -2355,7 +2373,7 @@ class MenuManager {
|
|||||||
function metadata() {
|
function metadata() {
|
||||||
return array(array('robots','noindex'));
|
return array(array('robots','noindex'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** function called back by HTMLTemplate */
|
/** function called back by HTMLTemplate */
|
||||||
function display() {
|
function display() {
|
||||||
echo $this->searchView().'<br/>';
|
echo $this->searchView().'<br/>';
|
||||||
@@ -2700,7 +2718,7 @@ class SimpleDisplay {
|
|||||||
return array(array('robots','noindex'));
|
return array(array('robots','noindex'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** sets the entries to be shown */
|
/** sets the entries to be shown */
|
||||||
function setEntries(&$entries) {
|
function setEntries(&$entries) {
|
||||||
$this->entries = $entries;
|
$this->entries = $entries;
|
||||||
@@ -2729,8 +2747,8 @@ class SimpleDisplay {
|
|||||||
function setQuery($query) {
|
function setQuery($query) {
|
||||||
$this->query = $query;
|
$this->query = $query;
|
||||||
}
|
}
|
||||||
function getTitle() {
|
function getTitle() {
|
||||||
return _DefaultBibliographyTitle($this->query);
|
return _DefaultBibliographyTitle($this->query);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Displays a set of bibtex entries in an HTML table */
|
/** Displays a set of bibtex entries in an HTML table */
|
||||||
@@ -2893,7 +2911,7 @@ class AcademicDisplay {
|
|||||||
$display->incHeadingLevel();
|
$display->incHeadingLevel();
|
||||||
$display->setEntries($entries);
|
$display->setEntries($entries);
|
||||||
$display->headerCSS = 'theader';
|
$display->headerCSS = 'theader';
|
||||||
|
|
||||||
$sections[] = array (
|
$sections[] = array (
|
||||||
'display' => $display,
|
'display' => $display,
|
||||||
'anchor' => $anchor,
|
'anchor' => $anchor,
|
||||||
@@ -3384,7 +3402,7 @@ class BibDataBase {
|
|||||||
|
|
||||||
$result[$key] = $year;
|
$result[$key] = $year;
|
||||||
}
|
}
|
||||||
|
|
||||||
krsort($result);
|
krsort($result);
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
@@ -3703,6 +3721,10 @@ if (method_exists($content, 'getTitle')) {
|
|||||||
if (BIBTEXBROWSER_USE_PROGRESSIVE_ENHANCEMENT) {
|
if (BIBTEXBROWSER_USE_PROGRESSIVE_ENHANCEMENT) {
|
||||||
javascript();
|
javascript();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (BIBTEXBROWSER_RENDER_MATH) {
|
||||||
|
javascript_math();
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -3753,7 +3775,7 @@ class BibtexDisplay {
|
|||||||
foreach($this->entries as $bibentry) { echo $bibentry->getText()."\n"; }
|
foreach($this->entries as $bibentry) { echo $bibentry->getText()."\n"; }
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** creates paged output, e.g: [[http://localhost/bibtexbrowser/testPagedDisplay.php?page=1]]
|
/** creates paged output, e.g: [[http://localhost/bibtexbrowser/testPagedDisplay.php?page=1]]
|
||||||
@@ -3974,20 +3996,20 @@ class Dispatcher {
|
|||||||
|
|
||||||
/** The BibDataBase object */
|
/** The BibDataBase object */
|
||||||
var $db = null;
|
var $db = null;
|
||||||
|
|
||||||
function Dispatcher() {}
|
function Dispatcher() {}
|
||||||
|
|
||||||
/** returns the underlying BibDataBase object */
|
/** returns the underlying BibDataBase object */
|
||||||
function getDB() {
|
function getDB() {
|
||||||
// by default set it from $_GET[Q_FILE]
|
// by default set it from $_GET[Q_FILE]
|
||||||
// first we set the database (load from disk or parse the bibtex file)
|
// first we set the database (load from disk or parse the bibtex file)
|
||||||
if ($this->db == null) {
|
if ($this->db == null) {
|
||||||
list($db, $parsed, $updated, $saved) = _zetDB($_GET[Q_FILE]);
|
list($db, $parsed, $updated, $saved) = _zetDB($_GET[Q_FILE]);
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
}
|
}
|
||||||
return $this->db;
|
return $this->db;
|
||||||
}
|
}
|
||||||
|
|
||||||
function main() {
|
function main() {
|
||||||
// are we in test mode, or libray mode
|
// are we in test mode, or libray mode
|
||||||
// then this file is just a library
|
// then this file is just a library
|
||||||
|
|||||||
Reference in New Issue
Block a user