Get post blank for footnote references.
This commit is contained in:
parent
645d9abf9c
commit
b1773ac90e
@ -116,12 +116,10 @@ fn assert_bounds<'b, 's, S: StandardProperties<'s> + ?Sized>(
|
|||||||
if rust_begin_char_offset != begin || rust_end_char_offset != end {
|
if rust_begin_char_offset != begin || rust_end_char_offset != end {
|
||||||
Err(format!("Rust contents bounds (in chars) ({rust_begin}, {rust_end}) do not match emacs contents bounds ({emacs_begin}, {emacs_end})", rust_begin = rust_begin_char_offset, rust_end = rust_end_char_offset, emacs_begin=begin, emacs_end=end))?;
|
Err(format!("Rust contents bounds (in chars) ({rust_begin}, {rust_end}) do not match emacs contents bounds ({emacs_begin}, {emacs_end})", rust_begin = rust_begin_char_offset, rust_end = rust_end_char_offset, emacs_begin=begin, emacs_end=end))?;
|
||||||
}
|
}
|
||||||
} else {
|
} else if standard_properties.contents_begin.is_some()
|
||||||
if standard_properties.contents_begin.is_some()
|
|| standard_properties.contents_end.is_some()
|
||||||
|| standard_properties.contents_end.is_some()
|
{
|
||||||
{
|
Err(format!("Rust contents is None but emacs contents bounds are ({emacs_begin:?}, {emacs_end:?})", emacs_begin=standard_properties.contents_begin, emacs_end=standard_properties.contents_end))?;
|
||||||
Err(format!("Rust contents is None but emacs contents bounds are ({emacs_begin:?}, {emacs_end:?})", emacs_begin=standard_properties.contents_begin, emacs_end=standard_properties.contents_end))?;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,6 +82,7 @@ fn anonymous_footnote<'b, 'g, 'r, 's>(
|
|||||||
FootnoteReference {
|
FootnoteReference {
|
||||||
source: source.into(),
|
source: source.into(),
|
||||||
contents: Some(contents.into()),
|
contents: Some(contents.into()),
|
||||||
|
post_blank: _trailing_whitespace.map(Into::<&str>::into),
|
||||||
label: None,
|
label: None,
|
||||||
definition: children,
|
definition: children,
|
||||||
},
|
},
|
||||||
@ -130,6 +131,7 @@ fn inline_footnote<'b, 'g, 'r, 's>(
|
|||||||
FootnoteReference {
|
FootnoteReference {
|
||||||
source: source.into(),
|
source: source.into(),
|
||||||
contents: Some(contents.into()),
|
contents: Some(contents.into()),
|
||||||
|
post_blank: _trailing_whitespace.map(Into::<&str>::into),
|
||||||
label: Some(label_contents.into()),
|
label: Some(label_contents.into()),
|
||||||
definition: children,
|
definition: children,
|
||||||
},
|
},
|
||||||
@ -155,6 +157,7 @@ fn footnote_reference_only<'b, 'g, 'r, 's>(
|
|||||||
FootnoteReference {
|
FootnoteReference {
|
||||||
source: source.into(),
|
source: source.into(),
|
||||||
contents: None,
|
contents: None,
|
||||||
|
post_blank: _trailing_whitespace.map(Into::<&str>::into),
|
||||||
label: Some(label_contents.into()),
|
label: Some(label_contents.into()),
|
||||||
definition: Vec::with_capacity(0),
|
definition: Vec::with_capacity(0),
|
||||||
},
|
},
|
||||||
|
@ -193,6 +193,7 @@ pub struct ExportSnippet<'s> {
|
|||||||
pub struct FootnoteReference<'s> {
|
pub struct FootnoteReference<'s> {
|
||||||
pub source: &'s str,
|
pub source: &'s str,
|
||||||
pub contents: Option<&'s str>,
|
pub contents: Option<&'s str>,
|
||||||
|
pub post_blank: Option<&'s str>,
|
||||||
pub label: Option<&'s str>,
|
pub label: Option<&'s str>,
|
||||||
pub definition: Vec<Object<'s>>,
|
pub definition: Vec<Object<'s>>,
|
||||||
}
|
}
|
||||||
@ -736,7 +737,11 @@ impl<'s> StandardProperties<'s> for FootnoteReference<'s> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn get_post_blank<'b>(&'b self) -> PostBlank {
|
fn get_post_blank<'b>(&'b self) -> PostBlank {
|
||||||
todo!()
|
self.post_blank
|
||||||
|
.map(|text| text.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