Improvements to Document Structure and Page Formatting in favor of Metatron
As I began working on Metatron, I identified the need for more robust document structures. Specifically, the ability to define page formats, margins, and other layout-related parameters became essential. I also recognized the importance of report bands like title, header, footer, custom bands, and summary to generate more the one page and respect the sections.
These reporting bands are fundamental and already exist, but in a very simple way. The new concept had good adaptability to existing code, as demonstrated by the passing tests, the system now supports these structures efficiently (there are two fails, but it is some bug in Markdown generate, not related with this feature).
Convention Over Configuration for Page Formats
In an effort to adopt more Convention Over Configuration, I've introduced a default page format/orientation structure (page_format,page_orientation) for the Document class. Users are no longer required (though they still can) to specify page dimensions manually. By default, documents will assume an A4 page size unless otherwise specified the correct type at any moment in generate or parse function.
This change not only simplifies the document creation process but also future-proofs the system by allowing different file types to have predefined page formats and dimensions based on their specific needs.
In the example below, if the user's XML file does not explicitly define the page dimensions, it will automatically fall back to the default A4 dimensions:
// Initialize dimensions
let PageDimensions {
mut page_width,
mut page_height,
mut page_margin_top,
mut page_margin_bottom,
mut page_margin_left,
mut page_margin_right,
} = PageFormat::default().dimensions();
for child in element_data.unwrap().children.iter() {
match child.name.as_str() {
"page_width" => {
if let Some(value) = &child.text {
page_width = value.parse()?;
}
}
"page_height" => {
if let Some(value) = &child.text {
page_height = value.parse()?;
}
}
}
}
It is worth mentioning that I tried to do this in Metatron without having to change it in Shiva, but it doesn't work well, Shiva is the one who has the document structure.
Improvements to Document Structure and Page Formatting in favor of Metatron
As I began working on Metatron, I identified the need for more robust document structures. Specifically, the ability to define page formats, margins, and other layout-related parameters became essential. I also recognized the importance of report bands like title, header, footer, custom bands, and summary to generate more the one page and respect the sections.
These reporting bands are fundamental and already exist, but in a very simple way. The new concept had good adaptability to existing code, as demonstrated by the passing tests, the system now supports these structures efficiently (there are two fails, but it is some bug in Markdown generate, not related with this feature).
Convention Over Configuration for Page Formats
In an effort to adopt more Convention Over Configuration, I've introduced a default page format/orientation structure (
page_format,page_orientation
) for theDocument
class. Users are no longer required (though they still can) to specify page dimensions manually. By default, documents will assume an A4 page size unless otherwise specified the correct type at any moment in generate or parse function.This change not only simplifies the document creation process but also future-proofs the system by allowing different file types to have predefined page formats and dimensions based on their specific needs.
In the example below, if the user's XML file does not explicitly define the page dimensions, it will automatically fall back to the default A4 dimensions: