about summary refs log tree commit diff
path: root/users/tazjin
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-07-28T18·20+0300
committertazjin <tazjin@tvl.su>2022-07-28T18·47+0000
commit1a5e62c0763859c30dd5c5a641b1485d8ae9a664 (patch)
tree33554a182a615a7c99c2f28014a2a3f539dbf17a /users/tazjin
parentbcf301d1be46a6103b165796d82d517f8e3af5d7 (diff)
feat(predlozhnik): add mechanism for displaying exceptions r/4340
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>
Diffstat (limited to 'users/tazjin')
-rw-r--r--users/tazjin/predlozhnik/src/main.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/users/tazjin/predlozhnik/src/main.rs b/users/tazjin/predlozhnik/src/main.rs
index dbb3708ff705..7e036f436430 100644
--- a/users/tazjin/predlozhnik/src/main.rs
+++ b/users/tazjin/predlozhnik/src/main.rs
@@ -106,6 +106,15 @@ lazy_static! {
 
         s
     };
+    static ref EXCEPTIONS: HashMap<(&'static str, Падеж), &'static str> = {
+        use Падеж::*;
+
+        hashmap! {
+            ("в", Винительный) => "Во что? В кого?",
+            ("о", Винительный) => "О кого? Обо что? (редко используется)"
+
+        }
+    };
 }
 
 enum Сообщение {
@@ -126,11 +135,16 @@ struct Вывод {
 }
 
 fn объясни(падеж: Падеж, предлог: &str) -> Html {
+    let exp = match EXCEPTIONS.get(&(предлог, падеж)) {
+        Some(exp) => html! { exp },
+        None => html! { format!("{} {}", предлог, падеж.вопрос()) },
+    };
+
     html! {
         <div id="obyasnenie">
           <hr/>
           <h2>{"Пример:"}</h2>
-          {format!("{} {}", предлог, падеж.вопрос())}
+          {exp}
         </div>
     }
 }