[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 46a7442 068/156: Factor out helper render_tem
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 46a7442 068/156: Factor out helper render_template() method |
Date: |
Tue, 30 Jan 2018 17:22:13 -0500 (EST) |
branch: master
commit 46a74427621938c7639cc863544c1c0b3a23dd72
Author: Vadim Zeitlin <address@hidden>
Commit: Vadim Zeitlin <address@hidden>
Factor out helper render_template() method
This is used by many pages to render all, or almost all, of their
content.
---
ledger_pdf_generator_wx.cpp | 34 ++++++++++++++++++++++------------
1 file changed, 22 insertions(+), 12 deletions(-)
diff --git a/ledger_pdf_generator_wx.cpp b/ledger_pdf_generator_wx.cpp
index ce9bcc0..0115c47 100644
--- a/ledger_pdf_generator_wx.cpp
+++ b/ledger_pdf_generator_wx.cpp
@@ -355,6 +355,26 @@ class page
,pdf_writer_wx& writer
,html_interpolator const& interpolate_html
) = 0;
+
+ protected:
+ // Helper method for rendering the contents of the given external template,
+ // which is expected to be found in the file with the provided name and
+ // ".mustache" extension in the data directory.
+ //
+ // Return the height of the page contents.
+ int render_page_template
+ (std::string const& template_name
+ ,pdf_writer_wx& writer
+ ,html_interpolator const& interpolate_html
+ )
+ {
+ return writer.output_html
+ (writer.get_horz_margin()
+ ,writer.get_vert_margin()
+ ,writer.get_page_width()
+ ,interpolate_html("{{>" + template_name + "}}")
+ );
+ }
};
// This is just a container for the illustration-global data.
@@ -1683,12 +1703,7 @@ class column_headings_page : public numbered_page
{
numbered_page::render(ledger, writer, interpolate_html);
- writer.output_html
- (writer.get_horz_margin()
- ,writer.get_vert_margin()
- ,writer.get_page_width()
- ,interpolate_html("{{>column_headings}}")
- );
+ render_page_template("column_headings", writer, interpolate_html);
}
};
@@ -2071,12 +2086,7 @@ class numeric_summary_or_attachment_page
numeric_summary_table_cell::pdf_context_setter
set_pdf_context(ledger, writer, interpolate_html);
- writer.output_html
- (writer.get_horz_margin()
- ,writer.get_vert_margin()
- ,writer.get_page_width()
- ,interpolate_html("{{>numeric_summary}}")
- );
+ this->render_page_template("numeric_summary", writer,
interpolate_html);
}
};
- [lmi-commits] [lmi] master e00ab7d 080/156: Hide "attained age" column for composite illustrations, (continued)
- [lmi-commits] [lmi] master e00ab7d 080/156: Hide "attained age" column for composite illustrations, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 29e63d6 117/156: Add basic illustration page of group placement illustration, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 1a9bfb3 137/156: Factor out standard_supplemental_report class, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 7c0ff88 145/156: Add copyright notices to all .mst template files, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 2fd6a11 147/156: Use shorter and more consistent names for external templates, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master b09a25f 026/156: Implement numbering pages in the PDF output, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master bb75971 033/156: Implement the second part of the narrative summary page, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 964db82 067/156: Rename columns_headings_page to column_headings_page, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 2a94469 074/156: Use Mustache template files from the data directory, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 01be23a 103/156: Automatically squeeze table columns to make them fit if necessary, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 46a7442 068/156: Factor out helper render_template() method,
Greg Chicares <=
- [lmi-commits] [lmi] master d77620f 100/156: Factor out dollar_units template from the existing ones, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 833eef5 086/156: Use std::make_unique<> instead of raw "new", Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 34c088c 073/156: Move footer contents into an external template too, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 0ba1c32 146/156: Consistently use "curr" as abbreviation of "current", Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 29865fc 133/156: Add supplemental report to NASD illustrations too, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 919d796 001/156: Remove old XSL-FO-based PDF generation code, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master cc7fc05 143/156: Change template file extension from .mustache to .mst, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 08984bb 148/156: Recognize Mustache files in the coding rules test, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master de5a5c7 151/156: Fix interpolate_string_test build, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master bb5693e 136/156: Harmonize spacing in header in reg_d_group illustrations too, Greg Chicares, 2018/01/30