summaryrefslogtreecommitdiff
path: root/library
diff options
context:
space:
mode:
authorSung Jeon <basix@basix.tech>2023-05-31 01:42:24 +0900
committerGitHub <noreply@github.com>2023-05-30 18:42:24 +0200
commit08b49291bc876d948bfd2c90cb05796efc1254a6 (patch)
treed165347722106c62bd0905f3d87b974a6f802d8e /library
parentb805c5f10080912cbfb1fd2fd2733c48a92ce4f9 (diff)
Add NumberingKind variants for Korean (#1360)
Co-authored-by: Laurenz <laurmaedje@gmail.com>
Diffstat (limited to 'library')
-rw-r--r--library/src/meta/numbering.rs28
1 files changed, 26 insertions, 2 deletions
diff --git a/library/src/meta/numbering.rs b/library/src/meta/numbering.rs
index 7ba27aaa..fbe7306c 100644
--- a/library/src/meta/numbering.rs
+++ b/library/src/meta/numbering.rs
@@ -38,7 +38,7 @@ pub fn numbering(
/// Defines how the numbering works.
///
/// **Counting symbols** are `1`, `a`, `A`, `i`, `I`, `い`, `イ`,
- /// `א`, and `*`. They are replaced by the number in the sequence,
+ /// `א`, `가`, `ㄱ`, and `*`. They are replaced by the number in the sequence,
/// in the given case.
///
/// The `*` character means that symbols should be used to count, in the
@@ -132,7 +132,7 @@ cast_to_value! {
/// How to turn a number into text.
///
/// A pattern consists of a prefix, followed by one of `1`, `a`, `A`, `i`,
-/// `I`, `い`, `イ`, `א`, or `*`, and then a suffix.
+/// `I`, `い`, `イ`, `א`, `가`, `ㄱ`, or `*`, and then a suffix.
///
/// Examples of valid patterns:
/// - `1)`
@@ -269,6 +269,8 @@ enum NumberingKind {
TraditionalChinese,
HiraganaIroha,
KatakanaIroha,
+ KoreanJamo,
+ KoreanSyllable,
}
impl NumberingKind {
@@ -283,6 +285,8 @@ impl NumberingKind {
'一' | '壹' => NumberingKind::SimplifiedChinese,
'い' => NumberingKind::HiraganaIroha,
'イ' => NumberingKind::KatakanaIroha,
+ 'ㄱ' => NumberingKind::KoreanJamo,
+ '가' => NumberingKind::KoreanSyllable,
_ => return None,
})
}
@@ -299,6 +303,8 @@ impl NumberingKind {
Self::TraditionalChinese => '一',
Self::HiraganaIroha => 'い',
Self::KatakanaIroha => 'イ',
+ Self::KoreanJamo => 'ㄱ',
+ Self::KoreanSyllable => '가',
}
}
@@ -464,6 +470,24 @@ impl NumberingKind {
Err(_) => '-'.into(),
}
}
+ Self::KoreanJamo => zeroless::<14>(
+ |x| {
+ [
+ 'ㄱ', 'ㄴ', 'ㄷ', 'ㄹ', 'ㅁ', 'ㅂ', 'ㅅ', 'ㅇ', 'ㅈ', 'ㅊ', 'ㅋ',
+ 'ㅌ', 'ㅍ', 'ㅎ',
+ ][x]
+ },
+ n,
+ ),
+ Self::KoreanSyllable => zeroless::<14>(
+ |x| {
+ [
+ '가', '나', '다', '라', '마', '바', '사', '아', '자', '차', '카',
+ '타', '파', '하',
+ ][x]
+ },
+ n,
+ ),
}
}
}