Skip to content

Commit

Permalink
feat(proc): render_references, render_renderence
Browse files Browse the repository at this point in the history
Not yet done ...

Add Processor.render_references and render_renderence.

Return an AST.

Close: #16

Signed-off-by: Bruce D'Arcus <bdarcus@gmail.com>
  • Loading branch information
bdarcus committed Jun 2, 2023
1 parent d71e4a1 commit 40c5307
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions processor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,33 @@ impl Default for ProcHints {
}

impl Processor {
/// Render references to AST.
pub fn render_references(&self) -> Vec<ProcTemplateComponent> {
let sorted_references = self.sort_references(self.get_references());
sorted_references
.iter()
.map(|reference| {
// TODO
let hints = self.get_proc_hints(reference);
// TODO
let rendered = self.render_reference(reference, &hints);
rendered
})
.collect()
}

/// Render a reference to AST.
/// This is the main function that does the work.
/// It takes a reference and returns a vector of ProcTemplateComponent items.
/// Each ProcTemplateComponent item contains a StyleTemplateComponent and a String.
/// The StyleTemplateComponent provides rendering instructions.
/// The String is the rendered output.
/// The vector of ProcTemplateComponent items is the rendered output.
/// The vector will have one item for each StyleTemplateComponent in the style.
fn render_reference(&self, reference: &InputReference) -> Vec<ProcTemplateComponent> {
// TODO
}

/// Get references from the bibliography.
pub fn get_references(&self) -> Vec<InputReference> {
let mut references = Vec::new();
Expand Down

0 comments on commit 40c5307

Please sign in to comment.