Properly handle songs with only English title
This commit is contained in:
parent
a33a05a60a
commit
86f81ccc35
2 changed files with 4 additions and 1 deletions
|
@ -16,6 +16,9 @@ pub fn furigana_to_html(text: &str) -> String {
|
|||
}
|
||||
|
||||
pub fn furigana_filter(value: &Value, _args: &HashMap<String, Value>) -> tera::Result<Value> {
|
||||
if value.is_null() {
|
||||
return Ok(Value::String("".to_string()));
|
||||
}
|
||||
Ok(Value::String(furigana_to_html(value.as_str().expect("The furigana input must be a string"))))
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<a class="link" href="/{{ challenge + 1 }}"><svg class="svg-inline" aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path fill="currentColor" d="M342.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L274.7 256 105.4 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z"></path></svg></a>
|
||||
{% if content.song %}
|
||||
<div>
|
||||
<span>{{ content.song.japanese }}</span>
|
||||
<span>{% if content.song.japanese %}{{ content.song.japanese | furigana | safe }}{% else %}{{ content.song.english }}{% endif %}</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if user %}
|
||||
|
|
Loading…
Add table
Reference in a new issue