[Pas2js] multiline string literals

Mattias Gaertner nc-gaertnma at netcologne.de
Wed Feb 20 14:09:03 CET 2019


On Wed, 20 Feb 2019 05:42:29 -0700 (MST)
warleyalex via Pas2js <pas2js at lists.freepascal.org> wrote:

> var s := #"
>    Lorem ipsum 'dolor' sit amet, consectetur adipiscing elit. 
>    Duis l'ipsum odio, pretium ""hendrerit"" varius sed, 
>    aliquet vitae elit. 
>    Sed eu libero nec nisl ""malesuada"" dignissim.
> "; 

How should line breaks be translated?
Exclude, use source, Unix, Mac, Windows style?

Why #" instead of #'?

I often need multiline string literals too, but I hate to break my
indentation. For example:

begin
  if BadIndentation then
    Result:=#'
<tag>
  <br>
</tag>'
  else if WithIndentation then
    Result:=#'
      '<tag>
      '  <br>
      '</tag>';
end;

Do you have an idea how the syntax could support indentation?

Mattias


More information about the Pas2js mailing list