lmi
[Top][All Lists]
Advanced

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

Re: [lmi] MST: adding paragraph breaks to {{ProductDescription}}


From: Vadim Zeitlin
Subject: Re: [lmi] MST: adding paragraph breaks to {{ProductDescription}}
Date: Tue, 20 Feb 2018 15:27:29 +0100

On Tue, 20 Feb 2018 14:03:36 +0000 Greg Chicares <address@hidden> wrote:

GC> Vadim--Three ledger types already use {{ProductDescription}}, and the
GC> fourth, as you noted inline, should use it too. The (proprietary)
GC> contents generally look like this today:
GC> 
GC> std::string ProductDescription =
GC>   "This is the XYZZY product."
GC>   "" // There should be a paragraph break here.
GC>   "It has several death benefit options, viz. ..."
GC>   "" // There should be a paragraph break here.
GC>   "Here's another blurb that wants to be a separate paragraph."
GC>   ;
GC> 
GC> C++ doesn't use the empty string as a paragraph break, of course, but
GC> I thought maybe I could accomplish that by writing "\n" instead. Alas,
GC> that has no effect on the generated PDF.

 Well, yes, newlines are not significant in HTML, we really need to use <p>
tags to have multiple paragraphs.

GC> Would it be in good taste to make embedded newlines serve that purpose?
GC> Or do we really need:
GC> 
GC> std::string ProductDescription0 = "This is the XYZZY product.";
GC> std::string ProductDescription1 = "It has several death benefit options."
GC> 
GC> and so on, with one variable per paragraph?

 This wouldn't even really work that well, unfortunately, because if any
of ProductDescriptionN are empty, we'd still end up with "<p></p>" in the
generated HTML which would take up space in the output, so it's not a
solution.

 We either need to extend the template syntax to either support functions
in general (so that we could use "{{#para ProductDescription}}" in the
template) or some ad hoc syntax for just this functionality (e.g.
"{{=ProductDescription}}" or whatever) or define a function converting
multiline text to paragraphs in code.

 The latter should be simpler but, arguably, the former is "better" as the
templates should be responsible for converting the values to HTML, not the
code. I'm not sure what would I prefer, but I'd probably do it in the code
just for the reasons of expediency.

 What would be your preference here?
VZ


reply via email to

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