Skip to content

Commit

Permalink
Order archive
Browse files Browse the repository at this point in the history
  • Loading branch information
reknih committed Oct 30, 2023
1 parent a217517 commit 7670172
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/csl/archive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use citationberg::{Locale, Style};
use rkyv::{Archive, Deserialize, Serialize};
use serde::de::DeserializeOwned;
use std::collections::HashMap;
use std::collections::{BTreeMap, HashMap};

#[repr(align(8))]
struct Data<T: ?Sized>(T);
Expand All @@ -14,7 +14,7 @@ static ARCHIVE: &Data<[u8]> = &Data(*include_bytes!("../../styles.cbor.rkyv"));
#[derive(Debug, Clone, Archive, Serialize, Deserialize)]
pub struct Lookup {
/// Maps from a CSL style name to an index into the `styles` vector.
pub map: HashMap<String, StyleMatch>,
pub map: BTreeMap<String, StyleMatch>,
/// Maps from a CSL ID to an index into the `styles` vector.
pub id_map: HashMap<String, usize>,
/// The CSL styles in the archive as CBOR-encoded bytes.
Expand Down
Binary file modified styles.cbor.rkyv
Binary file not shown.
8 changes: 5 additions & 3 deletions tests/archiver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use citationberg::{Locale, LocaleFile, XmlError};
use rkyv::Archive;
use serde::de::DeserializeOwned;
use serde::Serialize;
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::{BTreeMap, HashMap};
use std::fmt;
use std::fs;
use std::io;
Expand Down Expand Up @@ -65,7 +65,7 @@ fn create_archive() -> Result<(), ArchivalError> {
let style_path = PathBuf::from(CACHE_PATH).join(STYLES_REPO_NAME);
let own_style_path = PathBuf::from(OWN_STYLES);
let mut res = Lookup {
map: HashMap::new(),
map: BTreeMap::new(),
id_map: HashMap::new(),
styles: Vec::new(),
locales: retrieve_locales()?,
Expand Down Expand Up @@ -411,13 +411,15 @@ impl Override {
}
}

const OVERRIDES: [Override; 17] = [
const OVERRIDES: [Override; 19] = [
Override::alias("apa", "american-psychological-association", &["apa"]),
Override::alias("bmj", "british-medical-journal", &["bmj"]),
Override::first(
"china-national-standard-gb-t-7714-2015-author-date",
"gb-7114-2015-author-date",
),
Override::first("chicago-fullnote-bibliography", "chicago-fullnotes"),
Override::first("chicago-note-bibliography", "chicago-notes"),
Override::first("china-national-standard-gb-t-7714-2015-note", "gb-7114-2015-note"),
Override::first(
"china-national-standard-gb-t-7714-2015-numeric",
Expand Down

0 comments on commit 7670172

Please sign in to comment.