Update website

This commit is contained in:
Guilhem Lavaux 2024-11-23 21:06:10 +01:00
parent 266051acd2
commit 508406d89c
2 changed files with 32 additions and 3 deletions

View File

@ -6,12 +6,41 @@ use RenanBr\BibTexParser\Processor;
require dirname(__FILE__).'/common.php'; require dirname(__FILE__).'/common.php';
function removeBoundingBraces($str) {
// Trim whitespace first
$str = trim($str);
// Check if string starts with { and ends with }
if (strlen($str) >= 2) {
// Remove opening brace if it exists
if ($str[0] === '{') {
$str = substr($str, 1);
}
// After removing first brace, get new length
$length = strlen($str);
// Remove closing brace if it exists
if ($length > 0 && $str[$length - 1] === '}') {
$str = substr($str, 0, -1);
}
}
return $str;
}
$m = setup_mustache(); $m = setup_mustache();
// Create and configure a Listener // Create and configure a Listener
$listener = new Listener(); $listener = new Listener();
$listener->addProcessor(new Processor\TagNameCaseProcessor(CASE_LOWER)); $listener->addProcessor(new Processor\TagNameCaseProcessor(CASE_LOWER));
$listener->addProcessor(new NamesProcessor());
$listener->addProcessor(static function (array $entry) {
$entry['title'] = removeBoundingBraces($entry['title']);
return $entry;
});
// Create a Parser and attach the listener // Create a Parser and attach the listener
$parser = new Parser(); $parser = new Parser();

View File

@ -48,9 +48,9 @@ span.author:last-child::after {
<td> <td>
<b>{{{ title }}}</b><br/> <b>{{{ title }}}</b><br/>
<div class='authors'> <div class='authors'>
{{# authors }} {{# author }}
<span class="author">{{ . }}</span> <span class="author">{{ first }} {{ last }}</span>
{{/ authors }} {{/ author }}
</div> </div>
<div class='doi'><a href='https://dx.doi.org/{{doi}}' target="_blank">DOI: {{ doi }}</a></div> <div class='doi'><a href='https://dx.doi.org/{{doi}}' target="_blank">DOI: {{ doi }}</a></div>
{{#doi}}<div class='pubdetail'>{{journal}} ({{year}}) {{#volume}}<span class="publi-volume">{{.}}</span>{{/volume}}{{#page}}, {{.}}{{/page}}</div>{{/doi}} {{#doi}}<div class='pubdetail'>{{journal}} ({{year}}) {{#volume}}<span class="publi-volume">{{.}}</span>{{/volume}}{{#page}}, {{.}}{{/page}}</div>{{/doi}}