LC Server style survey: co-mingle code w/HTML?
alex at tweedly.net
Sat Dec 9 07:40:26 EST 2017
On 08/12/2017 17:28, Mark Waddingham via use-livecode wrote:
> On 2017-12-07 19:52, Richard Gaskin via use-livecode wrote:
>> Would it be possible/practical to extend the merge function to at
>> least allow things like control structures with non-LC stuff in
>> between them?
> A LC Server script is an alternating sequence of code and text blocks.
> Once you have that alternating sequence, you could replace the text
> blocks with a call to a handler with a parameter which is a custom
> prop of the stack containing the text content.
Would it not be easier to transform the text blocks in to a (series of)
"put" statement(s) ?
Being "put"ted is exactly what is going to happen to the text in the
non-code blocks, so why not just do that.
Also, that means that the LC Server script can be turned into a
script-only stack - which would feel more natural to me. And, it would
continue to be visible in-line, therefore retaining (more or less) the
same self-documenting characteristic as the original script.
It's much more legible (to me) to replace
<?lc if a = b then ?>
<p>Some data that happens to be HTML</p>
<?lc else ?>
<p>Some other data that happens to be HTML</p>
<?lc end if ?>
if a = b then
put " <p>Some data that happens to be HTML</p> " & CR
put " <p>Some other data that happens to be HTML</p> & CR
if a = b then
OK, OK, you need to handle quotes within the HTML - but it should be
More information about the Use-livecode