mirror of
https://github.com/danbulant/cushy
synced 2026-06-14 20:11:04 +00:00
Added Chinese ListStyles
This may seem like a lot of options, but here's the reasoning: - The CSS spec offers four variations: Simplified/Traditional and Formal/Informal. This spec defines a character set for all for variations, and it also associates rules for omitting digits in the informal variants. - The chinese_number crate does not implement a variant that includes the tens digit, as required by the cSS spec for the formal variants. To be able to provide the enumerations that the CSS spec offers *and* to provide the variations that the chinese_number crate supports, I've aded 8 total list styles for selecting a specific Chinese variation. Technically nominals supports even more options, but the myriad counting scale coveres u128::MAX and seems to be the most common counting style.
This commit is contained in:
parent
e2e5085b1f
commit
3f8fed65c3
2 changed files with 68 additions and 7 deletions
12
Cargo.lock
generated
12
Cargo.lock
generated
|
|
@ -1482,9 +1482,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "nominals"
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8c1ae56aa93d00075cffa92cf1a4f525bfb6664fe70c062cf793b642e352414f"
|
||||
checksum = "35ffff2a517ba57162302185e0b8f485f6f74111c44229ec8f5273b45b3555b8"
|
||||
|
||||
[[package]]
|
||||
name = "nu-ansi-term"
|
||||
|
|
@ -2199,9 +2199,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "1.12.0"
|
||||
version = "1.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2593d31f82ead8df961d8bd23a64c2ccf2eb5dd34b0a34bfb4dd54011c72009e"
|
||||
checksum = "3b187f0231d56fe41bfb12034819dd2bf336422a5866de41bc3fec4b2e3883e8"
|
||||
|
||||
[[package]]
|
||||
name = "smithay-client-toolkit"
|
||||
|
|
@ -2532,9 +2532,9 @@ checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f"
|
|||
|
||||
[[package]]
|
||||
name = "unicode-properties"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c7f91c8b21fbbaa18853c3d0801c78f4fc94cdb976699bb03e832e75f7fd22f0"
|
||||
checksum = "e4259d9d4425d9f0661581b804cb85fe66a4c631cadd8f490d1c13a35d5d9291"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-script"
|
||||
|
|
|
|||
|
|
@ -10,7 +10,8 @@ use nominals::{
|
|||
HangeulSyllable, HanjaFormal, Hebrew, HexLower, HexUpper, Hiragana, HiraganaIroha,
|
||||
JapaneseFormal, JapaneseInformal, Kannada, Katakana, KatakanaIroha, Lao, LetterLower,
|
||||
LetterUpper, Malayalam, Mongolian, Myanmar, NominalSystem, Oriya, Persian, RomanLower,
|
||||
RomanUpper, Tamil, Telugu, Thai, Tibetan,
|
||||
RomanUpper, SimplifiedChineseFormal, SimplifiedChineseInformal, Tamil, Telugu, Thai, Tibetan,
|
||||
TraditionalChineseFormal, TraditionalChineseInformal,
|
||||
};
|
||||
|
||||
use super::grid::GridWidgets;
|
||||
|
|
@ -134,6 +135,22 @@ pub enum ListStyle {
|
|||
HexLower,
|
||||
/// Hexadecimal uppercase digits (0-9A-F)
|
||||
HexUpper,
|
||||
/// Informal Traditional Chinese with ordinary characters.
|
||||
ChineseTraditional,
|
||||
/// Informal Traditional Chinese with financial characters.
|
||||
ChineseTraditionalFinancial,
|
||||
/// Formal Traditional Chinese with ordinary characters.
|
||||
ChineseTraditionalFormal,
|
||||
/// Formal Traditional Chinese with financial characters.
|
||||
ChineseTraditionalFormalFinancial,
|
||||
/// Informal Simplified Chinese with ordinary characters.
|
||||
ChineseSimplified,
|
||||
/// Informal Simplified Chinese with financial characters.
|
||||
ChineseSimplifiedFinancial,
|
||||
/// Formal Simplified Chinese with ordinary characters.
|
||||
ChineseSimplifiedFormal,
|
||||
/// Formal Simplified Chinese with financial characters.
|
||||
ChineseSimplifiedFormalFinancial,
|
||||
/// Greek lowercase alphabet.
|
||||
GreekUpper,
|
||||
/// Greek uppercase alphabet.
|
||||
|
|
@ -176,6 +193,14 @@ impl ListStyle {
|
|||
ListStyle::ArmenianUpper,
|
||||
ListStyle::Bengali,
|
||||
ListStyle::Cambodian,
|
||||
ListStyle::ChineseSimplified,
|
||||
ListStyle::ChineseSimplifiedFinancial,
|
||||
ListStyle::ChineseSimplifiedFormal,
|
||||
ListStyle::ChineseSimplifiedFormalFinancial,
|
||||
ListStyle::ChineseTraditional,
|
||||
ListStyle::ChineseTraditionalFinancial,
|
||||
ListStyle::ChineseTraditionalFormal,
|
||||
ListStyle::ChineseTraditionalFormalFinancial,
|
||||
ListStyle::CjkDecimal,
|
||||
ListStyle::CjkEarthlyBranch,
|
||||
ListStyle::CjkHeavenlyStem,
|
||||
|
|
@ -380,6 +405,42 @@ impl ListIndicator for ListStyle {
|
|||
ListStyle::Tibetan => Some(Indicator::delimited(String::from(
|
||||
Tibetan.one_based().format_nominal(index),
|
||||
))),
|
||||
ListStyle::ChineseTraditional => Some(Indicator::delimited(String::from(
|
||||
TraditionalChineseInformal::default().format_nominal(index),
|
||||
))),
|
||||
ListStyle::ChineseTraditionalFinancial => Some(Indicator::delimited(String::from(
|
||||
TraditionalChineseInformal::default()
|
||||
.financial()
|
||||
.format_nominal(index),
|
||||
))),
|
||||
ListStyle::ChineseTraditionalFormal => Some(Indicator::delimited(String::from(
|
||||
TraditionalChineseFormal::default().format_nominal(index),
|
||||
))),
|
||||
ListStyle::ChineseTraditionalFormalFinancial => {
|
||||
Some(Indicator::delimited(String::from(
|
||||
TraditionalChineseFormal::default()
|
||||
.financial()
|
||||
.format_nominal(index),
|
||||
)))
|
||||
}
|
||||
ListStyle::ChineseSimplified => Some(Indicator::delimited(String::from(
|
||||
SimplifiedChineseInformal::default().format_nominal(index),
|
||||
))),
|
||||
ListStyle::ChineseSimplifiedFinancial => Some(Indicator::delimited(String::from(
|
||||
SimplifiedChineseInformal::default()
|
||||
.financial()
|
||||
.format_nominal(index),
|
||||
))),
|
||||
ListStyle::ChineseSimplifiedFormal => Some(Indicator::delimited(String::from(
|
||||
SimplifiedChineseFormal::default().format_nominal(index),
|
||||
))),
|
||||
ListStyle::ChineseSimplifiedFormalFinancial => {
|
||||
Some(Indicator::delimited(String::from(
|
||||
SimplifiedChineseFormal::default()
|
||||
.financial()
|
||||
.format_nominal(index),
|
||||
)))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue