Skip to content

Commit

Permalink
feat(templ): new unicode escape delimiter
Browse files Browse the repository at this point in the history
And fix hp.
  • Loading branch information
fiji-flo committed Oct 15, 2024
1 parent 0a41adc commit 5740118
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion crates/rari-doc/src/pages/types/contributors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ impl PageLike for ContributorSpotlight {
}

fn locale(&self) -> Locale {
Locale::EnUs
self.meta.locale
}

fn content(&self) -> &str {
Expand Down
4 changes: 2 additions & 2 deletions crates/rari-md/src/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ pub(crate) enum Flag {
None,
}

pub static DELIM_START: &str = ";!::::";
pub static DELIM_END: &str = ";!::::";
pub static DELIM_START: &str = "";
pub static DELIM_END: &str = "";
6 changes: 2 additions & 4 deletions crates/rari-md/src/p.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,9 @@ mod test {

#[test]
fn test_only_escaped_templ() {
let b = b";!::::0;!::::";
let b = "⟬0⟭".as_bytes();
assert!(only_escaped_templ(b, 0));
let b = b";!::::0;!::::;!::::1;!::::";
let b = "⟬0⟭⟬1⟭".as_bytes();
assert!(only_escaped_templ(b, 0));
let b = b"foo ;!::::0;!::::;!::::1::::!;";
assert!(!only_escaped_templ(b, 0));
}
}
8 changes: 6 additions & 2 deletions crates/rari-types/src/locale.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use serde::{Deserialize, Serialize};
use serde_variant::to_variant_name;
use thiserror::Error;

use crate::globals::settings;
use crate::globals::{content_translated_root, settings};

#[derive(PartialEq, Debug, Clone, Copy, Deserialize, Serialize, Default, PartialOrd, Eq, Ord)]
pub enum Native {
Expand Down Expand Up @@ -138,7 +138,11 @@ impl Locale {
}

pub fn for_generic_and_spas() -> &'static [Self] {
&LOCALES_FOR_GENERICS_AND_SPAS
if content_translated_root().is_none() {
[Locale::EnUs].as_slice()
} else {
&LOCALES_FOR_GENERICS_AND_SPAS
}
}
}

Expand Down

0 comments on commit 5740118

Please sign in to comment.