Skip to content

Commit

Permalink
Bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
TCA166 committed May 15, 2024
1 parent 4b82016 commit 3933d4c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/jinja_env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ fn determine_auto_escape(_value: &str) -> AutoEscape {
/// May be used in the templates as filter(using [Environment::add_filter]) or function(using [Environment::add_function]) to render a reference to another object.
/// If the reference is shallow, it will render just the name, otherwise render it as a link.
/// The function must be rendered without html escape.
/// Calling this on an undefined reference will fail.
fn render_ref(reference: Value, subdir:Option<String>) -> String{
//FIXME why can reference be undefined here? where are we calling render_ref on undefined?
if reference.is_none() || reference.is_undefined() {
if reference.is_none() {
return "none".to_string();
}
let n = reference.get_attr("name").unwrap();
Expand Down
10 changes: 8 additions & 2 deletions src/structures/title.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,16 @@ impl Cullable for Title {
}
self.depth = depth;
if self.de_jure.is_some(){
self.de_jure.as_ref().unwrap().get_internal_mut().set_depth(depth-1);
let c = self.de_jure.as_ref().unwrap().try_get_internal_mut();
if c.is_ok(){
c.unwrap().set_depth(depth-1);
}
}
if self.de_facto.is_some(){
self.de_facto.as_ref().unwrap().get_internal_mut().set_depth(depth-1);
let c = self.de_facto.as_ref().unwrap().try_get_internal_mut();
if c.is_ok(){
c.unwrap().set_depth(depth-1);
}
}
for v in &self.vassals{
v.get_internal_mut().set_depth(depth-1);
Expand Down
4 changes: 2 additions & 2 deletions templates/charTemplate.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
Date of death: {{character.date}}<br />
Reason of death: {%if character.reason != none%}{{character.reason}}{%else%}Natural causes{%endif%}<br />
{%endif%}
{%if character.culture != none%}
{%if character.culture is defined%}
Culture: {{character.culture|render_ref("cultures")}} <br>
{%endif%}
{%if character.faith != none%}
{%if character.faith is defined%}
Faith: {{character.faith|render_ref("faiths")}} <br>
{%endif%}
Dynastic House: {%if character.house is defined%}{{character.house|render_ref("dynasties")}}{%else%}Lowborn{%endif%}<br />
Expand Down

0 comments on commit 3933d4c

Please sign in to comment.