[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 1229745 020/156: Make add_body_paragraph() ev
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 1229745 020/156: Make add_body_paragraph() even more convenient to use |
Date: |
Tue, 30 Jan 2018 17:21:53 -0500 (EST) |
branch: master
commit 1229745e4da17b4fc7eefbd237b84547f4e1c1d1
Author: Vadim Zeitlin <address@hidden>
Commit: Vadim Zeitlin <address@hidden>
Make add_body_paragraph() even more convenient to use
Fold interpolate_html() call inside it while keeping a separate
add_body_paragraph_html() which can be used if we need to construct HTML
manually.
---
ledger_pdf_generator_wx.cpp | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/ledger_pdf_generator_wx.cpp b/ledger_pdf_generator_wx.cpp
index d27dfea..cc77bde 100644
--- a/ledger_pdf_generator_wx.cpp
+++ b/ledger_pdf_generator_wx.cpp
@@ -89,6 +89,11 @@ class html_interpolator
);
}
+ text operator()(std::string const& s) const
+ {
+ return (*this)(s.c_str());
+ }
+
// Add a variable, providing either its raw text or already escaped HTML
// representation. Boolean values are converted to strings "0" or "1" as
// expected.
@@ -459,11 +464,16 @@ class narrative_summary_page : public page
;
// Just a helper performing a common operation.
- auto const add_body_paragraph = [](text const& t) -> text
+ auto const add_body_paragraph_html = [](text const& t) -> text
{
return tag::p(tag::font[attr::size("-1")](t));
};
+ auto const add_body_paragraph = [=](std::string const& s) -> text
+ {
+ return add_body_paragraph_html(interpolate_html(s));
+ };
+
std::string description;
if(!interpolate_html.test_variable("SinglePremium"))
{
@@ -500,14 +510,12 @@ adjustable benefits, and single premium.
)";
}
- summary_html += add_body_paragraph
- (interpolate_html(description.c_str())
- );
+ summary_html += add_body_paragraph(description);
if(!invar.IsInforce)
{
summary_html += add_body_paragraph
- (interpolate_html(R"(
+ (R"(
Coverage may be available on a Guaranteed Standard Issue basis.
All proposals are based on case characteristics and must
be approved by the ${InsCoShortName}
@@ -515,7 +523,7 @@ Home Office. For details regarding underwriting
and coverage limitations refer to your offer letter
or contact your ${InsCoShortName} representative.
)"
- ));
+ );
}
writer.output_html
- [lmi-commits] [lmi] master de5a5c7 151/156: Fix interpolate_string_test build, (continued)
- [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
- [lmi-commits] [lmi] master 0c85a7a 154/156: Avoid using directive for the "html" namespace, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 463e8ca 138/156: Fix bug with page numbers in subsequent illustrations, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 830e1fd 130/156: Manually break column titles into lines, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 43859a6 053/156: Add support for "measure only" output mode to wx_table_generator, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 772f4a4 139/156: Refactor: use get_fixed_page_contents_template_name(), Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 81ccdc8 129/156: Remove the never used elements of the columns title map, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 2478fbc 010/156: Start implementing PDF illustrations directly, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 9d24cd9 024/156: Compilation fix for C++11 but not C++14 compilers, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 1229745 020/156: Make add_body_paragraph() even more convenient to use,
Greg Chicares <=
- [lmi-commits] [lmi] master 14aca9e 142/156: Replace underscores in title map with explicit line breaks, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 5241f0f 045/156: Fix some typos in wx_table_generator::add_column() comment, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 47bddbf 155/156: Merge branch 'vz-no-xslfo' into gwc-no-xslfo, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master a1342a9 106/156: Fix supplemental NASD illustration page for split premiums, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master ec0b298 110/156: Add NASD illustration second explanatory notes page, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 80423d2 134/156: Improve appearance of lower header part in NASD illustrations, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 408ba18 156/156: Merge branch 'gwc-no-xslfo' [387], Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master de5d0b8 060/156: Inline output_and_check_for_page_break() function, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 5421d85 002/156: Factor out pdf_writer_wx from group_quote_pdf_gen_wx, Greg Chicares, 2018/01/30