diff --git a/asklyphe-frontend/src/routes/search.rs b/asklyphe-frontend/src/routes/search.rs index 4e66275..96d8768 100644 --- a/asklyphe-frontend/src/routes/search.rs +++ b/asklyphe-frontend/src/routes/search.rs @@ -301,6 +301,11 @@ pub async fn search_nojs( if let Some(redirect) = bang_redirect { return Redirect::to(&redirect).into_response(); } + + let mut calc_query = query.clone().to_lowercase(); + calc_query = calc_query.replace("calculate", "").replace("what is", ""); + let math = math::calculate(&calc_query); + complications.math = math; } else { complications.disabled = true; query = query.replace("-complications", ""); diff --git a/asklyphe-frontend/templates/search.html b/asklyphe-frontend/templates/search.html index 12b4a44..ccae647 100644 --- a/asklyphe-frontend/templates/search.html +++ b/asklyphe-frontend/templates/search.html @@ -75,6 +75,13 @@ {% when None %} {% endmatch %} + {% match complications.math %} + {% when Some with (math) %} +
+

{{ math.equation }} = {{ math.result }}

+
+ {% when None %} + {% endmatch %}
    {% for result in search_results %}