Create a render ast node type.
This commit is contained in:
@@ -5,7 +5,7 @@ use super::registry::Registry;
|
||||
use super::IElement;
|
||||
use super::IObject;
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Clone)]
|
||||
pub(crate) struct IFootnoteDefinition {}
|
||||
|
||||
impl IFootnoteDefinition {
|
||||
@@ -22,8 +22,8 @@ impl IFootnoteDefinition {
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct IRealFootnoteDefinition {
|
||||
footnote_id: usize,
|
||||
contents: Vec<IAstNode>,
|
||||
pub(crate) footnote_id: usize,
|
||||
pub(crate) contents: Vec<IAstNode>,
|
||||
}
|
||||
|
||||
impl IRealFootnoteDefinition {
|
||||
@@ -37,4 +37,22 @@ impl IRealFootnoteDefinition {
|
||||
contents,
|
||||
})
|
||||
}
|
||||
|
||||
pub(crate) fn get_display_label(&self) -> String {
|
||||
format!("{}", self.footnote_id + 1)
|
||||
}
|
||||
|
||||
/// Get an ID to refer to the first reference to this footnote definition.
|
||||
///
|
||||
/// This ID could, for example, be used for the id attribute in HTML for the reference anchor tag.
|
||||
pub(crate) fn get_reference_id(&self) -> String {
|
||||
format!("fnr.{}", self.get_display_label())
|
||||
}
|
||||
|
||||
/// Get an ID to refer to the footnote definition.
|
||||
///
|
||||
/// This ID could, for example, be used for the id attribute in HTML for the definition anchor tag.
|
||||
pub(crate) fn get_definition_id(&self) -> String {
|
||||
format!("fn.{}", self.get_display_label())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user