[ANN] Kwartz-ruby 2.0.0-beta1 - a template system for Ruby, PHP, and Java

M

Makoto Kuwata

Hi all,

I'm pleased to announce the release of Kwartz-ruby 2.0.0-beta1.
This is the first beta release.
http://www.kuwata-lab.com/kwartz/

Kwartz reborned from scratch and specifications are many changed.


* What's that?

Kwartz is a template system which is available with multi
programming language (PHP, Ruby and Java).
It is the first template system that realized the concept of
'Separation of Presentation Logic and Presentaion data' (SoPL/PD).
And Kwartz-ruby is an implementation of Kwartz in Ruby.
(There is a plan to develop implementations in PHP and Java.)

It is available to separate the presentation layer from the
main program with any template system. In addition, Kwartz
enables you to separate the presentation logics (iteration and
conditional branching) from the presentation data (HTML file).


* Features:

- Separates presentation logic from presentation data.
- Runs very fast
- Supports multiple programing languages (PHP/Ruby/Java)
- Doesn't break HTML design at all
- Handles any text file
- Supports Auto-Sanitizing and Partial-Sanitizing


* Changed from previous version

- syntax of presentation logic is completely changed
- enabled to manipulate attributes value from presentation logic
- embeded expression pattern is changed from '#{...}#' to '@{...}@'
- and more


* Example:

- Presentation Data (example.html)
There is no iteration nor conditional branching
in the presentation data file.
--------------------
<table>
<tr id="mark:items">
<td id="mark:item">foo</td>
</tr>
</table>
--------------------

- Presentation Logic (example.plogic)
There is no HTML tags in the presentation logic file.
--------------------
// elment marked as "items"
#items {
// iterate the element
plogic: {
foreach (item in list) {
@stag; // start tag
@cont; // content
@etag; // end tag
}
}
}

// elment marked as "item"
#item {
// print value of a variable 'item' instead of the content
value: item;
}
--------------------

- Compile
Generate an output script for eRuby, PHP, and JSP
from presentation data and presentation logic.
--------------------
$ kwartz -l eruby -p example.plogic example.html > example.rhtml
$ kwartz -l php -p example.plogic example.html > example.php
$ kwartz -l jstl11 -p example.plogic example.html > example.jsp
--------------------

- Output Script
(eRuby)
--------------------
<table>
<% for item in list do %>
<tr>
<td><%= item %></td>
</tr>
<% end %>
</table>
--------------------

(PHP)
--------------------
<table>
<?php foreach ($list as $item) { ?>
<tr>
<td><?php echo $item; ?></td>
</tr>
<?php } ?>
</table>
--------------------

(JSTL11)
--------------------
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<table>
<c:forEach var="item" items="${list}">
<tr>
<td><c:eek:ut value="${item}" escapeXml="false"/></td>
</tr>
</c:forEach>
</table>
--------------------

The above examples shows:
- Presentation data (= HTML file) doesn't contain any logics.
- Presentation logic file doesn't contain any data.
- These are separated from the main program.

The command-line option '-e' escapes the HTML special chars
with 'htmlspecialchars()' in PHP, 'CGI::escapeHTML()' in eRuby,
and '<c:eek:ut/>' tag without 'escapeXml="false"' in JSTL.


* Resources:

- Web Page:
http://www.kuwata-lab.com/kwartz/

- Download:
https://www.kuwata-lab.com/kwartz/download.html

- Users Guide:
http://www.kuwata-lab.com/kwartz/users-guide.en.html

- Reference Manual:
http://www.kuwata-lab.com/kwartz/reference.en.html

- Presentation Pattern Catalog:
http://www.kuwata-lab.com/kwartz/p-pattern.en.html


Have a good Valentine's Day!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,007
Latest member
obedient dusk

Latest Threads

Top