Skip to content

Commit

Permalink
fix(templ): fix listsubpages order
Browse files Browse the repository at this point in the history
  • Loading branch information
fiji-flo committed Nov 6, 2024
1 parent 561e925 commit 6175e8f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 18 deletions.
9 changes: 0 additions & 9 deletions crates/rari-doc/src/templ/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,6 @@ pub fn parse(input: &str) -> Result<Vec<Token>, DocError> {
Ok(tokens)
}

fn _strip_escape_residues(s: &str) -> &str {
let s = s.strip_prefix("&gt;").or(s.strip_prefix('>')).unwrap_or(s);
let s = s
.strip_suffix("!&lt;")
.or(s.strip_suffix("!<"))
.unwrap_or(s);
s
}

#[cfg(test)]
mod test {
use super::*;
Expand Down
4 changes: 2 additions & 2 deletions crates/rari-doc/src/templ/templs/listsubpages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub fn list_sub_pages(
&mut out,
url,
env.locale,
Some(SubPagesSorter::SlugNatural),
Some(SubPagesSorter::TitleNatural),
&[],
)?;
} else {
Expand All @@ -40,7 +40,7 @@ pub fn list_sub_pages(
url,
env.locale,
Some(depth),
Some(SubPagesSorter::SlugNatural),
Some(SubPagesSorter::TitleNatural),
&[],
false,
)?;
Expand Down
10 changes: 3 additions & 7 deletions crates/rari-md/src/p.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
use comrak::nodes::{AstNode, NodeValue};
use itertools::Itertools;

use crate::ext::{DELIM_END, DELIM_START};

fn only_escaped_templ(b: &[u8], start: usize) -> bool {
let b = &b[..b
.iter()
.rev()
.find_position(|c| *c != &b'\n')
.map(|(i, _)| b.len() - i)
.unwrap_or(0)];
let b = b.trim_ascii_end();
if b[start..].starts_with(DELIM_START.as_bytes()) {
let start = start + DELIM_START.as_bytes().len();
if let Some(end) = b[start..]
Expand Down Expand Up @@ -58,5 +52,7 @@ mod test {
assert!(only_escaped_templ(b, 0));
let b = "⟬0⟭⟬1⟭".as_bytes();
assert!(only_escaped_templ(b, 0));
let b = "⟬0⟭,⟬1⟭".as_bytes();
assert!(!only_escaped_templ(b, 0));
}
}

0 comments on commit 6175e8f

Please sign in to comment.