Use macros for creating the intermediate stage.
This is to make it easier to change function signatures by consolidating the places where the signatures exist.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use crate::error::CustomError;
|
||||
|
||||
use super::macros::intermediate;
|
||||
use super::registry::Registry;
|
||||
use crate::error::CustomError;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub(crate) struct IFootnoteReference {
|
||||
@@ -8,11 +8,10 @@ pub(crate) struct IFootnoteReference {
|
||||
duplicate_offset: usize,
|
||||
}
|
||||
|
||||
impl IFootnoteReference {
|
||||
pub(crate) async fn new<'b, 'parse>(
|
||||
registry: &'b mut Registry<'parse>,
|
||||
original: &'b organic::types::FootnoteReference<'parse>,
|
||||
) -> Result<IFootnoteReference, CustomError> {
|
||||
intermediate!(
|
||||
IFootnoteReference,
|
||||
FootnoteReference,
|
||||
|registry, original| async {
|
||||
let footnote_id = registry
|
||||
.get_footnote_reference_id(original.label, &original.definition)
|
||||
.await?;
|
||||
@@ -21,7 +20,9 @@ impl IFootnoteReference {
|
||||
duplicate_offset: 0, // TODO
|
||||
})
|
||||
}
|
||||
);
|
||||
|
||||
impl IFootnoteReference {
|
||||
pub(crate) fn get_display_label(&self) -> String {
|
||||
format!("{}", self.footnote_id + 1)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user