Handle 4 more unwraps

This commit is contained in:
spikecodes 2021-02-20 12:14:32 -08:00
parent 2091f26bda
commit a606e48435
No known key found for this signature in database
GPG key ID: 004CECFF9B463BCB
4 changed files with 58 additions and 22 deletions

View file

@ -1,7 +1,7 @@
{% macro options(current, values, default) -%}
{% for value in values %}
<option value="{{ value }}" {% if current == value || (current == "" && value == default) %}selected{% endif %}>
{{ format!("{}{}", value.get(0..1).unwrap().to_uppercase(), value.get(1..).unwrap()) }}
{{ format!("{}{}", value.get(0..1).unwrap_or_default().to_uppercase(), value.get(1..).unwrap_or_default()) }}
</option>
{% endfor %}
{%- endmacro %}
@ -9,7 +9,7 @@
{% macro sort(root, methods, selected) -%}
{% for method in methods %}
<a {% if method == selected %}class="selected"{% endif %} href="{{ root }}/{{ method }}">
{{ format!("{}{}", method.get(0..1).unwrap().to_uppercase(), method.get(1..).unwrap()) }}
{{ format!("{}{}", method.get(0..1).unwrap_or_default().to_uppercase(), method.get(1..).unwrap_or_default()) }}
</a>
{% endfor %}
{%- endmacro %}