Skip to content

Commit

Permalink
fix(HTML encoding): Use an ordered map to avoid re-ording of affiliat…
Browse files Browse the repository at this point in the history
…ions
  • Loading branch information
nokome committed Aug 31, 2021
1 parent c158436 commit 7cc1dea
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions rust/src/methods/encode/html.rs
Expand Up @@ -4,7 +4,6 @@ use eyre::Result;
use html_escape::{encode_double_quoted_attribute, encode_safe};
use itertools::Itertools;
use std::cmp::min;
use std::collections::HashMap;
use std::fs;
use std::{collections::BTreeMap, path::PathBuf};
use stencila_schema::*;
Expand Down Expand Up @@ -976,7 +975,7 @@ impl ToHtml for Article {

// Create a map of organization name to Organization, in the order
// they appear in affiliations.
let orgs: HashMap<String, &Organization> = match &self.authors {
let orgs: BTreeMap<String, &Organization> = match &self.authors {
Some(authors) => authors
.iter()
.filter_map(|author| match author {
Expand All @@ -991,7 +990,7 @@ impl ToHtml for Article {
})
.flatten()
.collect(),
None => HashMap::new(),
None => BTreeMap::new(),
};
let orgs = orgs.values().cloned().collect();

Expand Down

0 comments on commit 7cc1dea

Please sign in to comment.