fix: When definition doesn't conform don't error out, return null
This commit is contained in:
parent
576816fa03
commit
28bcff1667
|
@ -67,7 +67,12 @@ class Term
|
||||||
$term->kanji = mb_substr($vocabDefLine, 0, $enStart);
|
$term->kanji = mb_substr($vocabDefLine, 0, $enStart);
|
||||||
$def = mb_substr($vocabDefLine, $enStart + 1, null);
|
$def = mb_substr($vocabDefLine, $enStart + 1, null);
|
||||||
$enStart = 0;
|
$enStart = 0;
|
||||||
|
} else {
|
||||||
|
// Can't extract term from definition, it doesn't conform to the
|
||||||
|
// established pattern.
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert 「this」 into [this]
|
// Convert 「this」 into [this]
|
||||||
$term->kanji = mb_trim(strtr($term->kanji, [
|
$term->kanji = mb_trim(strtr($term->kanji, [
|
||||||
'「' => '[',
|
'「' => '[',
|
||||||
|
|
Loading…
Reference in New Issue