Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > [ANN] Kwartz-ruby 2.0.0-beta1 - a template system for Ruby, PHP, and Java

Thread Tools

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

Makoto Kuwata
Posts: n/a
Hi all,

I'm pleased to announce the release of Kwartz-ruby 2.0.0-beta1.
This is the first beta release.

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.
<tr id="mark:items">
<td id="mark:item">foo</td>

- 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
<% for item in list do %>
<td><%= item %></td>
<% end %>

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

<%@ taglib prefix="c" uri="" %>
<%@ taglib prefix="fn" uri="" %>
<c:forEach var="item" items="${list}">
<td><cut value="${item}" escapeXml="false"/></td>

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 '<cut/>' tag without 'escapeXml="false"' in JSTL.

* Resources:

- Web Page:

- Download:

- Users Guide:

- Reference Manual:

- Presentation Pattern Catalog:

Have a good Valentine's Day!

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
r H2 deduce deduce template argument of a template class inheritingfrom a non template base? nguillot C++ 5 03-08-2009 05:56 PM
How to use the template member function of a template in the memberfunction of another template class? Peng Yu C++ 3 10-26-2008 03:51 PM
template template arguments: expected a class template, got `Component<T1, T2, T3> C++ 1 06-08-2007 07:10 AM
Re: A Newbie Question about template template template tom_usenet C++ 0 07-24-2003 12:06 PM
Re: A Newbie Question about template template template Chris Theis C++ 2 07-24-2003 09:42 AM