lmi
[Top][All Lists]
Advanced

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

[lmi] Truncated variables in mustache templates


From: Greg Chicares
Subject: [lmi] Truncated variables in mustache templates
Date: Wed, 25 Oct 2017 18:37:19 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0

A side benefit of replacing XSL-FO with mustache templates is that
it makes questionable aspects of the underlying design easier to see
and to reconsider. (Both implementations seem to do the _same_ thing;
I'm just questioning whether that's the _right_ thing.) Studying the
no-xslfo code, I came upon add_abbreviated_variable():

$grep --directories=skip add_abbreviated_variable *         
ledger_pdf_generator_wx.cpp:    void add_abbreviated_variable(std::string 
const& var, size_t len)
ledger_pdf_generator_wx.cpp:        add_abbreviated_variable("CorpName", 60);
ledger_pdf_generator_wx.cpp:        add_abbreviated_variable("Insured1", 30);
ledger_pdf_generator_wx.cpp:        
add_abbreviated_variable("MasterContractNumber", full_abbrev_length);
ledger_pdf_generator_wx.cpp:        
add_abbreviated_variable("MasterContractNumber", full_abbrev_length / 2);
ledger_pdf_generator_wx.cpp:        add_abbreviated_variable("ContractNumber", 
full_abbrev_length);
ledger_pdf_generator_wx.cpp:        add_abbreviated_variable("ContractNumber", 
full_abbrev_length / 2);
ledger_pdf_generator_wx.cpp:        add_abbreviated_variable("CorpName", 50);
ledger_pdf_generator_wx.cpp:        add_abbreviated_variable("Insured1", 50);
ledger_pdf_generator_wx.cpp:        add_abbreviated_variable("CorpName", 140);
ledger_pdf_generator_wx.cpp:        add_abbreviated_variable("Insured1", 140);

It's good to have all this truncation pass through a single chokepoint,
because that makes it much easier to review each use systematically.

The contract-number variables, IIRC, represent some nasty kludge that
let one string in a '.policy' file serve two purposes. (Or maybe I'm
thinking of an "imprimatur" field that was abused that way.) The XSL
code that's being replaced, 'fo_common.xsl', says:
    This monstrosity truncates 'MasterContractNumber' and 'ContractNumber' to:
    * 30 characters if both are present;
    * 15 characters if only one is present.
but doesn't explain the design rationale.

Truncating the insured's and corporation's names is probably just a
regrettable necessity. I wonder whether the thirty-character maximum
imposed in one case is too severe.




reply via email to

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