Tuesday | 21 MAY 2024
[ previous ]
[ next ]

The Template Language - READ

Title:
Date: 2023-06-15

I've now added my EVALUATE function to my RENDER routine and we are off to the races. I have the OPEN and READ statements working pretty well. I also have regular BASIC lines being evaluated and displayed as well. Variables are getting processed properly. At this point I have the basics of the template language. The next thing to implement is the FOR loop.

I'll need to make my RENDER routine into a subroutine and then call it against a scoped environment and the block of code inside the FOR loop. I'm going to steal the code for this from my previous attempt as I think it will be mostly the same. The only difference will occur at the point where expressions are evaluated in the FOR statement.

An example template:

{{ OPEN '','SITE-FILE' TO SITE.FILE ELSE NULL }}
{{ READ SITE.ITEM FROM SITE.FILE,'MAIN' ELSE SITE.ITEM = '' }}
{{ "Test" : OCONV(DATE(),"D") }}
{{ "TEST" : 123 }}
<div>{{ SITE.ITEM<1,1>  }}</div>
Hello, World!

outputs:

Test15 JUN 2023
TEST123
<div>devlog</div>
Hello, World!

I'm stoked that it works as well as it does.