Update website
This commit is contained in:
parent
6cb4218b95
commit
ab776352fb
@ -30,6 +30,89 @@ function removeBoundingBraces($str) {
|
|||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function expandJournalAbbreviation($abbrev) {
|
||||||
|
// Define mapping of abbreviations (including LaTeX macros) to full journal names
|
||||||
|
$journalMap = [
|
||||||
|
// Standard abbreviations
|
||||||
|
'AJ' => 'The Astronomical Journal',
|
||||||
|
'ApJ' => 'The Astrophysical Journal',
|
||||||
|
'ApJL' => 'The Astrophysical Journal Letters',
|
||||||
|
'ApJS' => 'The Astrophysical Journal Supplement Series',
|
||||||
|
'ARA&A' => 'Annual Review of Astronomy and Astrophysics',
|
||||||
|
'ARAA' => 'Annual Review of Astronomy and Astrophysics',
|
||||||
|
'ARAP' => 'Annual Review of Astronomy and Astrophysics',
|
||||||
|
'MNRAS' => 'Monthly Notices of the Royal Astronomical Society',
|
||||||
|
'PASP' => 'Publications of the Astronomical Society of the Pacific',
|
||||||
|
'PASJ' => 'Publications of the Astronomical Society of Japan',
|
||||||
|
'A&A' => 'Astronomy & Astrophysics',
|
||||||
|
'A&AS' => 'Astronomy & Astrophysics Supplement Series',
|
||||||
|
|
||||||
|
// LaTeX macros
|
||||||
|
'\aj' => 'The Astronomical Journal',
|
||||||
|
'\apj' => 'The Astrophysical Journal',
|
||||||
|
'\apjl' => 'The Astrophysical Journal Letters',
|
||||||
|
'\apjlett' => 'The Astrophysical Journal Letters',
|
||||||
|
'\apjs' => 'The Astrophysical Journal Supplement Series',
|
||||||
|
'\apjsupp' => 'The Astrophysical Journal Supplement Series',
|
||||||
|
'\araa' => 'Annual Review of Astronomy and Astrophysics',
|
||||||
|
'\mnras' => 'Monthly Notices of the Royal Astronomical Society',
|
||||||
|
'\pasp' => 'Publications of the Astronomical Society of the Pacific',
|
||||||
|
'\pasj' => 'Publications of the Astronomical Society of Japan',
|
||||||
|
'\aap' => 'Astronomy & Astrophysics',
|
||||||
|
'\aaps' => 'Astronomy & Astrophysics Supplement Series',
|
||||||
|
'\aapr' => 'Astronomy & Astrophysics Reviews',
|
||||||
|
'\solphys' => 'Solar Physics',
|
||||||
|
'\pasa' => 'Publications of the Astronomical Society of Australia',
|
||||||
|
'\jcap' => 'Journal of Cosmology and Astroparticle Physics',
|
||||||
|
'\nat' => 'Nature',
|
||||||
|
'\science' => 'Science',
|
||||||
|
'\icarus' => 'Icarus',
|
||||||
|
'\prd' => 'Physical Review D',
|
||||||
|
'\prl' => 'Physical Review Letters',
|
||||||
|
'\grl' => 'Geophysical Research Letters',
|
||||||
|
'\jgr' => 'Journal of Geophysical Research',
|
||||||
|
'\baas' => 'Bulletin of the American Astronomical Society',
|
||||||
|
'\physrep' => 'Physics Reports',
|
||||||
|
'\apss' => 'Astrophysics and Space Science'
|
||||||
|
];
|
||||||
|
|
||||||
|
// Clean the input
|
||||||
|
$abbrev = trim($abbrev);
|
||||||
|
|
||||||
|
// Handle case sensitivity for standard abbreviations
|
||||||
|
if (!str_starts_with($abbrev, '\\') && isset($journalMap[strtoupper($abbrev)])) {
|
||||||
|
$abbrev = strtoupper($abbrev);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the full name if found, otherwise return original abbreviation
|
||||||
|
return $journalMap[$abbrev] ?? $abbrev;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Function to process text that might contain multiple journal references
|
||||||
|
function expandJournalReferences($text) {
|
||||||
|
// First handle LaTeX macros that might be followed by spaces or punctuation
|
||||||
|
$pattern = '/\\\\[a-zA-Z]+/';
|
||||||
|
$text = preg_replace_callback($pattern, function($matches) {
|
||||||
|
return expandJournalAbbreviation($matches[0]);
|
||||||
|
}, $text);
|
||||||
|
|
||||||
|
// Then handle standard abbreviations
|
||||||
|
$words = explode(' ', $text);
|
||||||
|
$result = [];
|
||||||
|
|
||||||
|
foreach ($words as $word) {
|
||||||
|
if (!str_starts_with($word, 'The ')) { // Avoid re-processing already expanded journals
|
||||||
|
$result[] = expandJournalAbbreviation($word);
|
||||||
|
} else {
|
||||||
|
$result[] = $word;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return implode(' ', $result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$m = setup_mustache();
|
$m = setup_mustache();
|
||||||
|
|
||||||
|
|
||||||
@ -40,6 +123,7 @@ $listener->addProcessor(new Processor\TagNameCaseProcessor(CASE_LOWER));
|
|||||||
$listener->addProcessor(new NamesProcessor());
|
$listener->addProcessor(new NamesProcessor());
|
||||||
$listener->addProcessor(static function (array $entry) {
|
$listener->addProcessor(static function (array $entry) {
|
||||||
$entry['title'] = removeBoundingBraces($entry['title']);
|
$entry['title'] = removeBoundingBraces($entry['title']);
|
||||||
|
$entry['journal'] = expandJournalReferences($entry['journal']);
|
||||||
return $entry;
|
return $entry;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user