Enable time splitter to deal with some roman numbers
This commit is contained in:
@ -54,6 +54,14 @@ final class NodaTimeSplitter {
|
||||
"vor Christus" => "v. Chr.",
|
||||
];
|
||||
|
||||
const STRINGS_TO_CLEAN_START = [
|
||||
"V. " => "5. ",
|
||||
"IV. " => "4. ",
|
||||
"III. " => "3. ",
|
||||
"II. " => "2. ",
|
||||
"I. " => "1. ",
|
||||
];
|
||||
|
||||
const STOP_STRINGS_GERMAN = [
|
||||
"-",
|
||||
",",
|
||||
@ -118,6 +126,11 @@ final class NodaTimeSplitter {
|
||||
while (strpos($input, " -") !== false) $input = str_replace(" -", "-", $input);
|
||||
while (strpos($input, "- ") !== false) $input = str_replace("- ", "-", $input);
|
||||
$input = strtr($input, self::STRINGS_TO_CLEAN);
|
||||
foreach (self::STRINGS_TO_CLEAN_START as $toCleanFrom => $toCleanTo) {
|
||||
if (strpos($input, $toCleanFrom) === 0) {
|
||||
$input = str_replace($toCleanFrom, $toCleanTo, $input);
|
||||
}
|
||||
}
|
||||
while (strpos($input, "..") !== false) $input = str_replace("..", ".", $input);
|
||||
|
||||
return trim($input, ", [](){}");
|
||||
@ -752,7 +765,6 @@ final class NodaTimeSplitter {
|
||||
|
||||
// 1. Jahrhundert
|
||||
if (preg_match("/^[0-9]\.\ (Jh\.|Jahrhundert|sz|század)$/", $datum)) {
|
||||
echo "HI";
|
||||
if ($centuryNo = intval(substr($datum, 0, 1))) {
|
||||
$centuryNo--;
|
||||
return [(string)$centuryNo . "01", strval($centuryNo + 1) . "00", "00", "00", $bcBceIndicator, ""];
|
||||
|
Reference in New Issue
Block a user