lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 2bd38fa 12/15: Use standard <img> tag instead


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 2bd38fa 12/15: Use standard <img> tag instead of <scaled_image> in templates
Date: Fri, 27 Jul 2018 17:23:17 -0400 (EDT)

branch: master
commit 2bd38fa791fe55b57a7fd47ff5410db04ed95ad8
Author: Vadim Zeitlin <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Use standard <img> tag instead of <scaled_image> in templates
    
    We can replace the standard <img> wxHTML tag handler with our own one
    for the same tag instead of defining a custom tag and this looks
    preferable, as, even if we still use a non-standard attribute, the <img>
    tag is still understood by browsers and other programs working with HTML
    (e.g. syntax-highlighting editors), unlike <scaled_image>.
    
    There are no changes to the generated illustrations.
---
 cover.mst                    |  2 +-
 ill_reg_column_headings.mst  |  2 +-
 ill_reg_header.mst           |  2 +-
 ill_reg_narr_summary2.mst    |  2 +-
 ledger_pdf_generator_wx.cpp  | 15 +++++++++------
 nasd_header_upper.mst        |  2 +-
 reg_d_group_header_upper.mst |  2 +-
 reg_d_indiv_header.mst       |  2 +-
 reg_d_indiv_notes1.mst       |  2 +-
 reg_d_indiv_notes2.mst       |  2 +-
 10 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/cover.mst b/cover.mst
index f99f76d..7fd1344 100644
--- a/cover.mst
+++ b/cover.mst
@@ -133,7 +133,7 @@ it roughly where we want it to appear.
 <br></br>
 <br></br>
 
-<p align="center"><scaled_image inv_factor="0.6" 
src="company_logo.png"></scaled_image></p>
+<p align="center"><img inv_factor="0.6" src="company_logo.png"></img></p>
 
 <br></br>
 <br></br>
diff --git a/ill_reg_column_headings.mst b/ill_reg_column_headings.mst
index 79191f5..1ebfd97 100644
--- a/ill_reg_column_headings.mst
+++ b/ill_reg_column_headings.mst
@@ -20,7 +20,7 @@
 }}
 
 <!-- No header for this page, just the logo -->
-<scaled_image inv_factor="0.36" src="company_logo.png"></scaled_image>
+<img inv_factor="0.36" src="company_logo.png"></img>
 
 <p align="center">
 Column Headings and Key Terms Used in This Illustration
diff --git a/ill_reg_header.mst b/ill_reg_header.mst
index 5921e0a..d97b2de 100644
--- a/ill_reg_header.mst
+++ b/ill_reg_header.mst
@@ -19,7 +19,7 @@
     snail: Chicares, 186 Belle Woods Drive, Glastonbury CT 06033, USA
 }}
 
-<scaled_image inv_factor="0.36" src="company_logo.png"></scaled_image>
+<img inv_factor="0.36" src="company_logo.png"></img>
 
 <font size=-1>
 <p align="center">
diff --git a/ill_reg_narr_summary2.mst b/ill_reg_narr_summary2.mst
index 60dfd74..e372a12 100644
--- a/ill_reg_narr_summary2.mst
+++ b/ill_reg_narr_summary2.mst
@@ -20,7 +20,7 @@
 }}
 
 <!-- No header for this page, just the logo -->
-<scaled_image inv_factor="0.36" src="company_logo.png"></scaled_image>
+<img inv_factor="0.36" src="company_logo.png"></img>
 
 <p align="center">NARRATIVE SUMMARY (Continued)</p>
 
diff --git a/ledger_pdf_generator_wx.cpp b/ledger_pdf_generator_wx.cpp
index 2d74736..b599a04 100644
--- a/ledger_pdf_generator_wx.cpp
+++ b/ledger_pdf_generator_wx.cpp
@@ -504,10 +504,10 @@ class html_cell_for_pdf_output : public wxHtmlCell
 html_cell_for_pdf_output::pdf_context
 html_cell_for_pdf_output::pdf_context_for_html_output;
 
-// Define scaffolding for a custom HTML "scaled_image" tag which must be used
-// instead of the standard "a" in order to allow specifying the scaling factor
+// Define scaffolding for a custom HTML "img" tag which must be used
+// instead of the standard one in order to allow specifying the scaling factor
 // that we want to use for the image in the PDF. Unfortunately this can't be
-// achieved by simply using "width" and/or "height" attributes of the "a" tag
+// achieved by simply using "width" and/or "height" attributes of the "img" tag
 // because their values can only be integers which is not precise enough to
 // avoid (slightly but noticeably) distorting the image due to the aspect ratio
 // being not quite right.
@@ -554,14 +554,17 @@ class scaled_image_cell : public html_cell_for_pdf_output
     double const scale_factor_;
 };
 
-TAG_HANDLER_BEGIN(scaled_image, "SCALED_IMAGE")
+// Note that defining this handler replaces the standard <img> tag handler
+// defined in wxHTML itself, which also handles <map> and <area> tags, but as
+// we don't use either of those and all our images are scaled, this is fine.
+TAG_HANDLER_BEGIN(scaled_image, "IMG")
     TAG_HANDLER_PROC(tag)
     {
         wxString src;
         if (!tag.GetParamAsString("SRC", &src))
             {
             throw std::runtime_error
-                ("missing mandatory \"src\" attribute of \"scaled_image\" tag"
+                ("missing mandatory \"src\" attribute of \"img\" tag"
                 );
             }
 
@@ -583,7 +586,7 @@ TAG_HANDLER_BEGIN(scaled_image, "SCALED_IMAGE")
                 {
                 throw std::runtime_error
                     ( "invalid value for \"inv_factor\" attribute of "
-                      "\"scaled_image\" tag: \""
+                      "\"img\" tag: \""
                     + inv_factor_str.ToStdString()
                     + "\""
                     );
diff --git a/nasd_header_upper.mst b/nasd_header_upper.mst
index b7fd5ae..dfe65d5 100644
--- a/nasd_header_upper.mst
+++ b/nasd_header_upper.mst
@@ -19,7 +19,7 @@
     snail: Chicares, 186 Belle Woods Drive, Glastonbury CT 06033, USA
 }}
 
-<scaled_image inv_factor="0.36" src="company_logo.png"></scaled_image>
+<img inv_factor="0.36" src="company_logo.png"></img>
 
 <br></br>
 <br></br>
diff --git a/reg_d_group_header_upper.mst b/reg_d_group_header_upper.mst
index 4dd5b04..6fc72c8 100644
--- a/reg_d_group_header_upper.mst
+++ b/reg_d_group_header_upper.mst
@@ -19,7 +19,7 @@
     snail: Chicares, 186 Belle Woods Drive, Glastonbury CT 06033, USA
 }}
 
-<scaled_image inv_factor="0.36" src="company_logo.png"></scaled_image>
+<img inv_factor="0.36" src="company_logo.png"></img>
 
 <br></br>
 <br></br>
diff --git a/reg_d_indiv_header.mst b/reg_d_indiv_header.mst
index 3bb9a39..da6b8ab 100644
--- a/reg_d_indiv_header.mst
+++ b/reg_d_indiv_header.mst
@@ -19,7 +19,7 @@
     snail: Chicares, 186 Belle Woods Drive, Glastonbury CT 06033, USA
 }}
 
-<scaled_image inv_factor="0.36" src="company_logo.png"></scaled_image>
+<img inv_factor="0.36" src="company_logo.png"></img>
 
 <font size="-1">
 
diff --git a/reg_d_indiv_notes1.mst b/reg_d_indiv_notes1.mst
index ea87e87..57f8845 100644
--- a/reg_d_indiv_notes1.mst
+++ b/reg_d_indiv_notes1.mst
@@ -20,7 +20,7 @@
 }}
 
 {{! No header on this page, but still use the logo. }}
-<scaled_image inv_factor="0.36" src="company_logo.png"></scaled_image>
+<img inv_factor="0.36" src="company_logo.png"></img>
 
 <p align="center"><font size="+1"><b>Explanatory Notes</b></font></p>
 
diff --git a/reg_d_indiv_notes2.mst b/reg_d_indiv_notes2.mst
index f8d1adb..0da8caf 100644
--- a/reg_d_indiv_notes2.mst
+++ b/reg_d_indiv_notes2.mst
@@ -20,7 +20,7 @@
 }}
 
 {{! No header on this page, but still use the logo. }}
-<scaled_image inv_factor="0.36" src="company_logo.png"></scaled_image>
+<img inv_factor="0.36" src="company_logo.png"></img>
 
 <p align="center"><font size="+1"><b>Explanatory Notes</b></font></p>
 



reply via email to

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