Implement the new fields for radio link.
This commit is contained in:
parent
4753f4c7c6
commit
68dccd54b1
@ -39,7 +39,7 @@ pub(crate) fn radio_link<'b, 'g, 'r, 's>(
|
|||||||
let rematched_target = rematch_target(context, radio_target, input);
|
let rematched_target = rematch_target(context, radio_target, input);
|
||||||
if let Ok((remaining, rematched_target)) = rematched_target {
|
if let Ok((remaining, rematched_target)) = rematched_target {
|
||||||
let path = get_consumed(input, remaining);
|
let path = get_consumed(input, remaining);
|
||||||
let (remaining, _) = space0(remaining)?;
|
let (remaining, post_blank) = space0(remaining)?;
|
||||||
let source = get_consumed(input, remaining);
|
let source = get_consumed(input, remaining);
|
||||||
return Ok((
|
return Ok((
|
||||||
remaining,
|
remaining,
|
||||||
@ -47,6 +47,11 @@ pub(crate) fn radio_link<'b, 'g, 'r, 's>(
|
|||||||
source: source.into(),
|
source: source.into(),
|
||||||
children: rematched_target,
|
children: rematched_target,
|
||||||
path: path.into(),
|
path: path.into(),
|
||||||
|
post_blank: if post_blank.len() > 0 {
|
||||||
|
Some(Into::<&str>::into(post_blank))
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
},
|
||||||
},
|
},
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -128,6 +128,7 @@ pub struct RadioTarget<'s> {
|
|||||||
pub struct RadioLink<'s> {
|
pub struct RadioLink<'s> {
|
||||||
pub source: &'s str,
|
pub source: &'s str,
|
||||||
pub path: &'s str,
|
pub path: &'s str,
|
||||||
|
pub post_blank: Option<&'s str>,
|
||||||
pub children: Vec<Object<'s>>,
|
pub children: Vec<Object<'s>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -671,11 +672,15 @@ impl<'s> StandardProperties<'s> for RadioLink<'s> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn get_contents<'b>(&'b self) -> Option<&'s str> {
|
fn get_contents<'b>(&'b self) -> Option<&'s str> {
|
||||||
todo!()
|
Some(self.path)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_post_blank(&self) -> PostBlank {
|
fn get_post_blank(&self) -> PostBlank {
|
||||||
todo!()
|
self.post_blank
|
||||||
|
.map(|post_blank| post_blank.chars().count())
|
||||||
|
.unwrap_or(0)
|
||||||
|
.try_into()
|
||||||
|
.expect("Too much post-blank to fit into a PostBlank.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user