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

Reply
Thread Tools

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

 
 
Makoto Kuwata
Guest
Posts: n/a
 
      02-13-2005
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><cut 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 '<cut/>' 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!

--
regards,
kwa
 
Reply With Quote
 
 
 
Reply

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> gary.bernstein@gmail.com 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



Advertisments