about summary refs log tree commit diff
path: root/users/tazjin/predlozhnik/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'users/tazjin/predlozhnik/src/main.rs')
-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 dbb3708ff7..7e036f4364 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>
     }
 }