Changes between Version 4 and Version 5 of WikiStart


Ignore:
Timestamp:
08/27/07 15:22:07 (14 years ago)
Author:
speck
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • WikiStart

    v4 v5  
    1 Jabhts is a template system which extensively uses java annotations to specify which parts of the html template that are generated by java. It provides scoping for loops (e.g. table rows) by supporting inner-classes and Iterator/Iterable.
     1Jabhts is a template system which:
     2 1. Uses 100% clean html/xhtml without any special tags or attributes. You can even add mock-up data so you can preview the final design in the browser/html-editor without any need to run it through the template processor first.
     3 1. Uses java annotations to specify the dynamic parts of the html templates: which elements have their content generated by java, which elements are loops (e.g. table rows).
     4 1. Has unique support for (a) scoping loops (e.g. table rows) by supporting inner-classes and Iterator/Iterable, (b) specifying sub-attribute values such as css class names and style attributes. It doesn't just append text to the attribute value, but parses the content so you can suppress class names and css provided by the template.
     5
     6== Examples ==
     7
     8{{{
     9#!html
     10<div style='float: left;'>
     11<div><i>Template:</i></div>
     12}}}
     13{{{
     14<div class='_Box UserInfo' style='margin: 0; color: blue;'>
     15     You're logged in as
     16     <span id=PersonFullName>John Doe</span>
     17     (<a id=_Username>jdoe</a>).</div>
     18}}}
     19{{{
     20#!html
     21<div><i>Output:</i></div>
     22}}}
     23{{{
     24<div class=UserInfo
     25     style='margin: 0; color: red; border: 1px solid black'>
     26     You're logged in as
     27     <span id=PersonFullName>Elliott Smith</span>
     28      (<a href='/info?user=es'>es</a>).</div>
     29
     30}}}
     31The java code is all that it takes to implement the dynamic parts of the[[BR]]
     32template. There is no additional specification.[[BR]]
     33You would of course need to implement the full servlet interface.
     34
     35Note: id attributes (and class names) which has a leading underscore[[BR]]
     36is automatically suppressed in the output by the template engine.
     37{{{
     38#!html
     39</div>
     40<div><i>Minimal servlet:</i></div>
     41}}}
     42{{{
     43public class DesignTest1 {
     44    @EHtml
     45    void printPersonFullName() {
     46        pw.print("Elliott Smith");
     47    }
     48
     49    @EText
     50    String username = "es";
     51
     52    @AHref
     53    String linkUsername() {
     54        return "/info?user=es";
     55    }
     56
     57    @SValue(styles = "color")
     58    String clrBox() {
     59       return "red";
     60    }
     61
     62    @SValue(styles = "border")
     63    String clrBox() {
     64       return "1px solid black";
     65    }
     66}
     67}}}
     68{{{
     69#!html
     70}}}
     71
    272
    373== Documentation ==
     
    1585The current source is available from the svn repository at http://jabhts.org/svn/trunk
    1686
    17 It reads XHTML templates using java's builtin xml parser. HTML templates are read using the python version of [http://code.google.com/p/html5lib/ html5lib]. Python 2.5 or later is required as previous versions has buggy unicode support. The java version is still too buggy, but as soon as it is usable, Jabhts will switch to it.
     87XHTML templates are read using java's builtin xml parser. HTML templates are read using the python version of
     88[http://code.google.com/p/html5lib/ html5lib] ([wiki:JabhtsHtml5LibInstall how-to install]).
     89The java version is still too buggy, but as soon as it is usable, Jabhts will switch to it.
    1890
    1991== History ==
    2092
    21 The initial version of Jabhts was created by Peter Speck as a project at Roskilde University. The project report is available at
     93The initial version of Jabhts was created by [mailto:speck@vitality.dk Peter Speck] as a project at [http://ruc.dk Roskilde University]. The project report is available at
    2294[http://hdl.handle.net/1800/2541 Roskilde University Digital Archive].
    2395Even when considering the changes made to Jabhts since the initial version, the project report is still worth reading as it documents the design decisions behind the system. It too describes the high-level design of the compiler, so it is a good introduction to the internals when you want to poke in its internals.