ivartj / tpl Goto Github PK
View Code? Open in Web Editor NEWTemplate system for making simple static websites. The code is currently a mess.
Template system for making simple static websites. The code is currently a mess.
tpl template system (unfinished) =================== tpl is a tool for composing simple HTML documents. The following are notes on how I intend it to work. ==== build.sh #!/bin/bash cd en for i in $(find . -name '*.bb'); do tpl -d ../dest/en -I ../tpl/ -D doc-path="$i" "$i" done cd ../no for i in $(find . -name '*.bb'); do tpl -d ../dest/no -I ../tpl/no/ -I ../tpl/ -D doc-path="$i" "$i" done ==== tpl/body.html.tpl -outputs: html title: Untitled lang: en lang-other: no <html lang="<[lang]>"> <head> <meta charset="utf-8"> <title><[title|html-escape]></title> </head> <body> <a href="/<[lang-other]>/<[doc-path]>"><[lang-other]></a> <h1><[title|html-escape]></h1> <[...]> </body> </html> ==== tpl/no/body.html.tpl -template: body.html title: Ingen tittel lang: no lang-other: en <[...]> ==== tpl/bb.tpl -template: body.html <[...|bbcode]> ==== en/hello.bb title: Hello [b]Hello![/b] ==== no/hello.bb title: Hallo [b]Hallo![/b] ==== dest/en/hello.html <html lang="en"> <head> <meta charset="utf-8"> <title>Hello</title> </head> <body> <a href="/no/hello.html>">no</a> <h1>Hello</h1> <strong>Hello!</strong><br /> </body> </html> ==== dest/no/hello.html <html lang="no"> <head> <meta charset="utf-8"> <title>Hallo</title> </head> <body> <a href="/en/hello.html>">en</a> <h1>Hallo</h1> <strong>Hallo!</strong><br /> </body> </html> ==== Template merging If a template refers to a template for its own extension, tpl will search only later search directories. start -> no/hello.bb no/hello.bb -> tpl/bb.tpl tpl/bb.tpl -template: body.html -> tpl/no/body.html.tpl tpl/no/body.html.tpl - template body.html -> tpl/body.html tpl/body.html title: Hallo -> title: Hallo - title: Ingen tittel lang: no -> lang: no lang-other: en -> lang-other: en - title: Untitled lang: en lang-other: no merge template ==== Programmatic features While fields in a template are written as <[field]>, control structures may be written like <{if Approved}> or <{for articles/*/summary.*}> followed by <{end}>.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.