Compare commits
No commits in common. "ef2c3516966a65e81f475a08dadfb06254c8adc4" and "e4c6ca288041eecc3e16301b00c77b586cf35567" have entirely different histories.
ef2c351696
...
e4c6ca2880
1
build.rs
1
build.rs
@ -81,7 +81,6 @@ fn is_expect_fail(name: &str) -> Option<&str> {
|
||||
"paragraphs_paragraph_with_backslash_line_breaks" => Some("The text we're getting out of the parse tree is already processed to remove line breaks, so our comparison needs to take that into account."),
|
||||
"radio_link_before_and_after" => Some("Matching the contents of radio targets not yet implemented."),
|
||||
"radio_link_simple" => Some("Matching the contents of radio targets not yet implemented."),
|
||||
"radio_link_identical_or_semantically_identical" => Some("Would require having the 2-pass parsing implemented."),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
@ -58,11 +58,6 @@ pub fn rematch_target<'x, 'r, 's>(
|
||||
for original_object in target {
|
||||
match original_object {
|
||||
// TODO: The rest of the minimal set of objects.
|
||||
Object::Bold(bold) => {
|
||||
let (new_remaining, new_match) = bold.rematch_object(context, remaining)?;
|
||||
remaining = new_remaining;
|
||||
new_matches.push(new_match);
|
||||
}
|
||||
Object::PlainText(plaintext) => {
|
||||
let (new_remaining, new_match) = plaintext.rematch_object(context, remaining)?;
|
||||
remaining = new_remaining;
|
||||
@ -125,7 +120,6 @@ mod tests {
|
||||
use crate::parser::parser_context::ContextTree;
|
||||
use crate::parser::parser_with_context::parser_with_context;
|
||||
use crate::parser::source::Source;
|
||||
use crate::parser::Bold;
|
||||
use crate::parser::PlainText;
|
||||
|
||||
#[test]
|
||||
@ -157,40 +151,4 @@ mod tests {
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bold_radio_target() {
|
||||
let input = "foo *bar* baz";
|
||||
let initial_context: ContextTree<'_, '_> = ContextTree::new();
|
||||
let document_context = initial_context
|
||||
.with_additional_node(ContextElement::DocumentRoot(input))
|
||||
.with_additional_node(ContextElement::RadioTarget(vec![vec![Object::Bold(
|
||||
Bold {
|
||||
source: "*bar*",
|
||||
children: vec![Object::PlainText(PlainText { source: "bar" })],
|
||||
},
|
||||
)]]));
|
||||
let paragraph_matcher = parser_with_context!(element(true))(&document_context);
|
||||
let (remaining, first_paragraph) = paragraph_matcher(input).expect("Parse first paragraph");
|
||||
let first_paragraph = match first_paragraph {
|
||||
crate::parser::Element::Paragraph(paragraph) => paragraph,
|
||||
_ => panic!("Should be a paragraph!"),
|
||||
};
|
||||
assert_eq!(remaining, "");
|
||||
assert_eq!(first_paragraph.get_source(), "foo *bar* baz");
|
||||
assert_eq!(first_paragraph.children.len(), 3);
|
||||
assert_eq!(
|
||||
first_paragraph
|
||||
.children
|
||||
.get(1)
|
||||
.expect("Len already asserted to be 3"),
|
||||
&Object::RadioLink(RadioLink {
|
||||
source: "*bar* ",
|
||||
children: vec![Object::Bold(Bold {
|
||||
source: "*bar* ",
|
||||
children: vec![Object::PlainText(PlainText { source: "bar" })]
|
||||
})]
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -291,5 +291,5 @@ fn _rematch_text_markup_object<'r, 's, 'x>(
|
||||
|
||||
let (remaining, _close) = text_markup_end_specialized(context, remaining)?;
|
||||
let (remaining, _trailing_whitespace) = space0(remaining)?;
|
||||
Ok((remaining, children))
|
||||
Ok((remaining, Vec::new()))
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user