[TEM #2] - Update Args::from_capture() comments

pull/4/head
sgoudham 3 years ago
parent a10fba9607
commit 843021a0ca
Signed by: hammy
GPG Key ID: 44E818FD5457EEA4

@ -244,15 +244,15 @@ impl<'a> Args<'a> {
} }
fn from_capture(cap: Captures<'a>) -> Option<Args<'a>> { fn from_capture(cap: Captures<'a>) -> Option<Args<'a>> {
// https://regex101.com/r/lKSOOl/3 // https://regex101.com/r/lKSOOl/4
let arg_type = match (cap.get(0), cap.get(1), cap.get(2), cap.get(3)) { let arg_type = match (cap.get(0), cap.get(1), cap.get(2), cap.get(3)) {
// This looks like {{$path}} // This looks like [[#path]]
(_, Some(argument), None, None) => Some(ArgsType::Plain(argument.as_str())), (_, Some(argument), None, None) => Some(ArgsType::Plain(argument.as_str())),
// This looks like {{$path ../images}} // This looks like [[#path ../images]]
(_, _, Some(argument), Some(default_value)) => { (_, _, Some(argument), Some(default_value)) => {
Some(ArgsType::Default(argument.as_str(), default_value.as_str())) Some(ArgsType::Default(argument.as_str(), default_value.as_str()))
} }
// This looks like \{{$any string}} // This looks like \[[#any string]]
(Some(mat), _, _, _) if mat.as_str().starts_with(ESCAPE_CHAR) => { (Some(mat), _, _, _) if mat.as_str().starts_with(ESCAPE_CHAR) => {
Some(ArgsType::Escaped) Some(ArgsType::Escaped)
} }

Loading…
Cancel
Save