feat(predlozhnik): add mechanism for displaying exceptions
basically these override the auto-generated explanations for pairings Change-Id: Ib98f3b7bce005ba4af26cfc850862300177c5175 Reviewed-on: https://cl.tvl.fyi/c/depot/+/5995 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
This commit is contained in:
parent
bcf301d1be
commit
1a5e62c076
1 changed files with 15 additions and 1 deletions
|
@ -106,6 +106,15 @@ lazy_static! {
|
||||||
|
|
||||||
s
|
s
|
||||||
};
|
};
|
||||||
|
static ref EXCEPTIONS: HashMap<(&'static str, Падеж), &'static str> = {
|
||||||
|
use Падеж::*;
|
||||||
|
|
||||||
|
hashmap! {
|
||||||
|
("в", Винительный) => "Во что? В кого?",
|
||||||
|
("о", Винительный) => "О кого? Обо что? (редко используется)"
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Сообщение {
|
enum Сообщение {
|
||||||
|
@ -126,11 +135,16 @@ struct Вывод {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn объясни(падеж: Падеж, предлог: &str) -> Html {
|
fn объясни(падеж: Падеж, предлог: &str) -> Html {
|
||||||
|
let exp = match EXCEPTIONS.get(&(предлог, падеж)) {
|
||||||
|
Some(exp) => html! { exp },
|
||||||
|
None => html! { format!("{} {}", предлог, падеж.вопрос()) },
|
||||||
|
};
|
||||||
|
|
||||||
html! {
|
html! {
|
||||||
<div id="obyasnenie">
|
<div id="obyasnenie">
|
||||||
<hr/>
|
<hr/>
|
||||||
<h2>{"Пример:"}</h2>
|
<h2>{"Пример:"}</h2>
|
||||||
{format!("{} {}", предлог, падеж.вопрос())}
|
{exp}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue