[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 4e76bba 098/156: Add support for comments to
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 4e76bba 098/156: Add support for comments to the string interpolation function |
Date: |
Tue, 30 Jan 2018 17:22:21 -0500 (EST) |
branch: master
commit 4e76bba3c4fa640368fc70fe745d0e657b8a69c0
Author: Vadim Zeitlin <address@hidden>
Commit: Vadim Zeitlin <address@hidden>
Add support for comments to the string interpolation function
They can be useful to explain why certain things are done in the
Mustache templates.
---
interpolate_string.cpp | 4 ++++
interpolate_string_test.cpp | 5 +++++
2 files changed, 9 insertions(+)
diff --git a/interpolate_string.cpp b/interpolate_string.cpp
index f6153d1..28f6f4e 100644
--- a/interpolate_string.cpp
+++ b/interpolate_string.cpp
@@ -210,6 +210,10 @@ void do_interpolate_string_in_context
}
break;
+ case '!':
+ // This is a comment, we just ignore it completely.
+ break;
+
default:
if(is_active())
{
diff --git a/interpolate_string_test.cpp b/interpolate_string_test.cpp
index 766c20d..a1813bd 100644
--- a/interpolate_string_test.cpp
+++ b/interpolate_string_test.cpp
@@ -44,6 +44,11 @@ int test_main(int, char*[])
BOOST_TEST_EQUAL( test_interpolate("foo{{bar}}"), "foobar" );
BOOST_TEST_EQUAL( test_interpolate("{{foo}}{{bar}}"), "foobar" );
+ // Comments should be just ignored.
+ BOOST_TEST_EQUAL( test_interpolate("{{! ignore me}}", "" );
+ BOOST_TEST_EQUAL( test_interpolate("{{! too}}{{x}}", "x" );
+ BOOST_TEST_EQUAL( test_interpolate("{{x}}{{!also}}", "x" );
+
// Sections.
auto const section_test = [](char const* s)
{
- [lmi-commits] [lmi] master a629602 083/156: Use custom <scaled_image> HTML tag for the embedded images, (continued)
- [lmi-commits] [lmi] master a629602 083/156: Use custom <scaled_image> HTML tag for the embedded images, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master b425030 082/156: Factor out html_cell_for_pdf_output from numeric_summary_table_cell, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master d99576a 069/156: Change cover page to use an external template, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 416ab02 030/156: Add support for vector variables to PDF generating code, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master d4dfaa9 075/156: Also use data directory for image files referenced from HTML, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 4f98db5 081/156: Don't show "Age 70" row in numeric summary for composites, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master f8853b9 090/156: Add "contract numbers" fragment to the header, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 61430d2 092/156: Move some variable definitions to the base illustration class, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 7ccd207 087/156: Rename "footer_contents" to more precise "page_number", Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 3a64b87 094/156: Correct misleading comment for page class dtor, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 4e76bba 098/156: Add support for comments to the string interpolation function,
Greg Chicares <=
- [lmi-commits] [lmi] master b5fe850 102/156: Add NASD basic illustration page, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 4250de9 104/156: Add first variant of NASD supplemental page, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 7a1e1e8 025/156: Include the missing <cstring> header, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 8bfb896 109/156: Add NASD illustration first explanatory notes page, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master ea20a31 095/156: Make pdf_illustration dtor virtual, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 61fae89 091/156: Reimplement the contract numbers fragment as an external template, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 0c55621 085/156: Replace trivial PDF page classes with single standard_page one, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master ea2564b 099/156: Split the NASD header template in the upper and lower parts, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master c1bf4a8 032/156: Adjust position of the right hand side of the header manually, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 89b4674 120/156: Add automatic support for multiline super-headers, Greg Chicares, 2018/01/30