Hi, all,

another libfossil minor milestone update:

while libfossil does not have an official script binding, it does have a
script binding, and i recently added support similar to embedding TH1 in
fossil pages. Here's a brief demo:

// ==================
const CGI = api.cgi
const F = CGI.getFossilInstance()

const symTmplish = {<tt>tmplish()</tt>}

const template = <<<END_OF_TEMPLATE
<h1>Welcome to <% F.getProjectName() %></h1>

<div>
This is a demonstration of using <% symTmplish %> to
create HTML templates with embedded th1ish code.
</div>
<? if(CGI.isLocalServer)<<<IfLocalServer ?>
    <div>Running in local server mode.</div>
<? IfLocalServer ?>
END_OF_TEMPLATE

const code = tmplish(template) // converts tmpl to script code
eval code // runs the script code
// ==================

(The template can of course be read from a file or the db as well.)

Note the different tags: <? vs <% - they have different semantics. <?
treats its contents as "normal code" and <% evaluates the contents and
outputs the result in its place.

i'm working on integrating a demo of this into the libfossil CGI bits now.
Once that's done, it'll be a straightforward matter to add custom
html+script pages in a form very much like fossil's header/footer pages.

Happy Fossiling!

-- 
----- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
"Freedom is sloppy. But since tyranny's the only guaranteed byproduct of
those who insist on a perfect world, freedom will have to do." -- Bigby Wolf
_______________________________________________
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to