gl-website-deployer/publi_bib.php
2024-11-23 21:01:37 +01:00

52 lines
1.1 KiB
PHP

<?php
use RenanBr\BibTexParser\Listener;
use RenanBr\BibTexParser\Parser;
use RenanBr\BibTexParser\Processor;
require dirname(__FILE__).'/common.php';
$m = setup_mustache();
// Create and configure a Listener
$listener = new Listener();
$listener->addProcessor(new Processor\TagNameCaseProcessor(CASE_LOWER));
// Create a Parser and attach the listener
$parser = new Parser();
$parser->addListener($listener);
// Parse the content, then read processed data from the Listener
try {
$parser->parseFile('assets/bib/export-bibtex.bib');
$entries = $listener->export();
$tpl = $m->loadTemplate("publi_bib_html");
echo $tpl->render(
array(
'ROOT_URL' => $iap_root,
'title'=>'Guilhem Lavaux\'s publications',
'publi'=>$entries,
'configure_script'=>[
'MathJax = {
tex: {
inlineMath: [[\'$\', \'$\'], [\'\\\\(\', \'\\\\)\']]
}
};
'
],
'external_scripts'=>[
'src="https://polyfill.io/v3/polyfill.min.js?features=es6"',
'id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"'
],
'bar' => 'baz'));
} catch (Exception $e) {
echo $e->getMessage()) . "<br/>";
}