lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master d77620f 100/156: Factor out dollar_units temp


From: Greg Chicares
Subject: [lmi-commits] [lmi] master d77620f 100/156: Factor out dollar_units template from the existing ones
Date: Tue, 30 Jan 2018 17:22:21 -0500 (EST)

branch: master
commit d77620fa6109281f43420ff43928d8bdcedc9583
Author: Vadim Zeitlin <address@hidden>
Commit: Vadim Zeitlin <address@hidden>

    Factor out dollar_units template from the existing ones
    
    The fragment defined in this template is used in more than a few places,
    so put it in a reusable file instead of duplicating it.
    
    Also move "HasScaleUnit" variable definition to the base illustration
    class to allow reusing this template (which references this variable) in
    illustrations of other types.
---
 dollar_units.mustache       | 10 ++++++++++
 ledger_pdf_generator_wx.cpp | 10 +++++-----
 numeric_summary.mustache    | 12 ++----------
 tabular_details.mustache    |  8 +-------
 4 files changed, 18 insertions(+), 22 deletions(-)

diff --git a/dollar_units.mustache b/dollar_units.mustache
new file mode 100644
index 0000000..9158691
--- /dev/null
+++ b/dollar_units.mustache
@@ -0,0 +1,10 @@
+{{! Define a fragment common to several pages. }}
+<p align="center">
+<font size="-1">
+Values shown are in
+{{#HasScaleUnit}}
+{{ScaleUnit}}s of
+{{/HasScaleUnit}}
+dollars
+</font>
+</p>
diff --git a/ledger_pdf_generator_wx.cpp b/ledger_pdf_generator_wx.cpp
index 539738d..0bd03e1 100644
--- a/ledger_pdf_generator_wx.cpp
+++ b/ledger_pdf_generator_wx.cpp
@@ -792,6 +792,11 @@ class pdf_illustration : protected html_interpolator
         add_abbreviated_variable("ContractNumber", full_abbrev_length / 2);
 
         add_variable
+            ("HasScaleUnit"
+            ,!invar.ScaleUnit().empty()
+            );
+
+        add_variable
             ("UWTypeIsMedical"
             ,invar.UWType == "Medical"
             );
@@ -1810,11 +1815,6 @@ class pdf_illustration_regular : public pdf_illustration
             );
 
         add_variable
-            ("HasScaleUnit"
-            ,!invar.ScaleUnit().empty()
-            );
-
-        add_variable
             ("DefnLifeInsIsGPT"
             ,invar.DefnLifeIns == "GPT"
             );
diff --git a/numeric_summary.mustache b/numeric_summary.mustache
index 01a7779..b783e6a 100644
--- a/numeric_summary.mustache
+++ b/numeric_summary.mustache
@@ -2,17 +2,9 @@
 
 <p align="center">Numeric Summary</p>
 
-<font size="-1">
+{{>dollar_units}}
 
-<p align="center">
-Values shown are in
-{{^HasScaleUnit}}
-dollars
-{{/HasScaleUnit}}
-{{#HasScaleUnit}}
-{{HasScaleUnit}}s of dollars
-{{/HasScaleUnit}}
-</p>
+<font size="-1">
 
 <br></br>
 <br></br>
diff --git a/tabular_details.mustache b/tabular_details.mustache
index fef605c..b611b36 100644
--- a/tabular_details.mustache
+++ b/tabular_details.mustache
@@ -2,13 +2,7 @@
 
 <p align="center">Tabular Detail</p>
 
-<p align="center"><font size="-1">
-Values shown are in
-{{#HasScaleUnit}}
-{{ScaleUnit}}s of
-{{/HasScaleUnit}}
-dollars
-</font></p>
+{{>dollar_units}}
 
 <br></br>
 <br></br>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]