Improve forced flanking node rendering
This commit is contained in:
parent
a09ddc35b9
commit
bfd22bb6fa
1 changed files with 14 additions and 0 deletions
|
|
@ -124,6 +124,12 @@ fn lex(text: &str, map: LexMap, config: &Config) -> Vec<Token> {
|
|||
if candidate.leading && lexeme.text() == "|" {
|
||||
// third pipe immediately after second: forcing flanking
|
||||
if lexeme.match_next_first_char('|') {
|
||||
candidate.destination =
|
||||
Some(candidate.text.clone());
|
||||
let token = Token::Anchor(candidate.clone());
|
||||
tokens.push(token);
|
||||
state.context.inline = InlineContext::None;
|
||||
iterator.next();
|
||||
continue;
|
||||
// whitespace or punctuation after pipe: flanking anchor
|
||||
} else if lexeme.is_next_whitespace()
|
||||
|
|
@ -295,6 +301,14 @@ mod tests {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn force_flanking_with_trailing_letter() {
|
||||
assert_eq!(
|
||||
read_noconfig("|Node||s"),
|
||||
r#"<p><a href="/node/Node">Node</a>s</p>"#
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn flanking_with_trailing_pipe() {
|
||||
assert_eq!(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue