Skip to content

Commit 6175e8f

Browse files
committed
fix(templ): fix listsubpages order
1 parent 561e925 commit 6175e8f

File tree

3 files changed

+5
-18
lines changed

3 files changed

+5
-18
lines changed

crates/rari-doc/src/templ/parser.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -136,15 +136,6 @@ pub fn parse(input: &str) -> Result<Vec<Token>, DocError> {
136136
Ok(tokens)
137137
}
138138

139-
fn _strip_escape_residues(s: &str) -> &str {
140-
let s = s.strip_prefix("&gt;").or(s.strip_prefix('>')).unwrap_or(s);
141-
let s = s
142-
.strip_suffix("!&lt;")
143-
.or(s.strip_suffix("!<"))
144-
.unwrap_or(s);
145-
s
146-
}
147-
148139
#[cfg(test)]
149140
mod test {
150141
use super::*;

crates/rari-doc/src/templ/templs/listsubpages.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub fn list_sub_pages(
3131
&mut out,
3232
url,
3333
env.locale,
34-
Some(SubPagesSorter::SlugNatural),
34+
Some(SubPagesSorter::TitleNatural),
3535
&[],
3636
)?;
3737
} else {
@@ -40,7 +40,7 @@ pub fn list_sub_pages(
4040
url,
4141
env.locale,
4242
Some(depth),
43-
Some(SubPagesSorter::SlugNatural),
43+
Some(SubPagesSorter::TitleNatural),
4444
&[],
4545
false,
4646
)?;

crates/rari-md/src/p.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
11
use comrak::nodes::{AstNode, NodeValue};
2-
use itertools::Itertools;
32

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

65
fn only_escaped_templ(b: &[u8], start: usize) -> bool {
7-
let b = &b[..b
8-
.iter()
9-
.rev()
10-
.find_position(|c| *c != &b'\n')
11-
.map(|(i, _)| b.len() - i)
12-
.unwrap_or(0)];
6+
let b = b.trim_ascii_end();
137
if b[start..].starts_with(DELIM_START.as_bytes()) {
148
let start = start + DELIM_START.as_bytes().len();
159
if let Some(end) = b[start..]
@@ -58,5 +52,7 @@ mod test {
5852
assert!(only_escaped_templ(b, 0));
5953
let b = "⟬0⟭⟬1⟭".as_bytes();
6054
assert!(only_escaped_templ(b, 0));
55+
let b = "⟬0⟭,⟬1⟭".as_bytes();
56+
assert!(!only_escaped_templ(b, 0));
6157
}
6258
}

0 commit comments

Comments
 (0)