[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>
- [lmi-commits] [lmi] master 37e9b0b 01/15: Update to wxWidgets v3.1.1-319-g9daf5bec98 snapshot, (continued)
- [lmi-commits] [lmi] master 37e9b0b 01/15: Update to wxWidgets v3.1.1-319-g9daf5bec98 snapshot, Greg Chicares, 2018/07/27
- [lmi-commits] [lmi] master 6465704 04/15: Restore the use of wxDCClipper in PDF table generation code, Greg Chicares, 2018/07/27
- [lmi-commits] [lmi] master a8d5e26 08/15: Look for image files referenced in templates under data directory, Greg Chicares, 2018/07/27
- [lmi-commits] [lmi] master 005b3eb 06/15: Replace pdf_writer_wx::get_page_height() with get_total_height(), Greg Chicares, 2018/07/27
- [lmi-commits] [lmi] master 28e3c42 11/15: Remove workarounds for wx 3.1.1 warnings not relevant any more, Greg Chicares, 2018/07/27
- [lmi-commits] [lmi] master b6b6827 03/15: Do call EndPage() in PDF generation code, Greg Chicares, 2018/07/27
- [lmi-commits] [lmi] master a86d90a 02/15: Use more recent wxPdfDocument fixing the text origin bug, Greg Chicares, 2018/07/27
- [lmi-commits] [lmi] master 554eb23 13/15: Forbid page breaks inside paragraphs in the illustrations, Greg Chicares, 2018/07/27
- [lmi-commits] [lmi] master 271db22 14/15: Fix over eager assert in pdf_writer_wx::output_html(), Greg Chicares, 2018/07/27
- [lmi-commits] [lmi] master 12d84c9 15/15: Fix regression in font sizes used for the group quotes PDF, Greg Chicares, 2018/07/27
- [lmi-commits] [lmi] master 2bd38fa 12/15: Use standard <img> tag instead of <scaled_image> in templates,
Greg Chicares <=
- [lmi-commits] [lmi] master 4cfcfe4 07/15: Refactor: remove render_page_template() helper function, Greg Chicares, 2018/07/27
- [lmi-commits] [lmi] master e821acd 05/15: Require specifying font sizes when using pdf_writer_wx, Greg Chicares, 2018/07/27
- [lmi-commits] [lmi] master c56a67f 09/15: Implement and use simple HTML output pagination, Greg Chicares, 2018/07/27
- [lmi-commits] [lmi] master f03ff64 10/15: Merge first two notes pages of regular individual illustrations, Greg Chicares, 2018/07/27