Ruby templating languages

From WhyNotWiki
Revision as of 16:34, 5 April 2007 by Tyler (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

This is a more specific instance of Templating languages


Ruby templating languages  edit   (Category  edit)


Templating languages  edit   (Category  edit)


Contents

HAML

http://unspace.ca/discover/haml

Quote:

!!!
%html
  %head
    %title Client Admin Site
    %meta{"http-equiv"=>"Content-Type", 
       :content=>"text/html; charset=utf-8"}/
    = stylesheet_link_tag 'tabbed'
    = javascript_include_tag 'tabbed'
  %body
    #application
      #header
        .container
          .statusbar
            .logo
              %strong Admin Interface
            .menu= link_to 'logout',  
               :controller => 'account', :action => 'logout'
          %br{:style=>"clear:both;"}/
          .tabs
            %ul.navigation
              %li= link_to 'Member Approval', member_admin_url
              %li= link_to 'User Management', user_admin_url, 
                 :class => 'selected'
              %li= link_to 'Pages', page_admin_url
              %li= link_to 'Reports', reports_url
              %li= link_to 'Help', '/'
      #page
        #content
          //These will only render if there is 
             a non-false value returned from the helper
          #errors= print_flash(:error)
          #notice= print_flash(:notice)
          = @content_for_layout
        #sidebar= @content_for_sidebar || false
        %hr/
      #footer
        %p= "Copyright Hampton Catlin 2006"

Markdown on Rails

Allows you to use `.text` files containing Markdown text as Rails views. ERb is supported.

Markaby

http://code.whytheluckystiff.net/markaby/

 html do
   head do
     title action_name
     stylesheet_link_tag 'scaffold'
   end

   body do
     p flash[:notice], :style => "color: green" 
     self << content_for_layout
   end
 end

Ruty

Homepage: http://ruty.rubyforge.org/


Project/Development: http://rubyforge.org/projects/ruty/


Description: Ruty is a template engine heavily inspired by the Django and Jinja Template Engine. It supports template inheritance, template inclusion and most of the tags supported by Jinja/Django.




Readiness: released 0.0.1 January 21, 2007


http://ruty.rubyforge.org/

Ruty is a sandboxed, django/jinja like template engine with template inheritance support. It's completely sandboxed so template designers won't be able to screw things up or execute code which is not meant to be executed. How fast is it? Ruty is slower than ERB but much faster then liquid. If we have time we will probably create a working benchmark. But usually you won't have problems with the performance since the acutal template rendering is the smallest part of the request delivery process.

http://ruty.rubyforge.org/index.tmpl

{% extends 'layout/base.tmpl' %}
{% block title %}Index{% endblock %}
{% block pageid %}index{% endblock %}
{% block content %}
  <h2>What is Ruty?</h2>
  <p>
    Ruty is a sandboxed, django/jinja like template engine with
    template inheritance support. It's completely sandboxed so
    template designers won't be able to screw things up or execute
    code which is not meant to be executed.
  </p>
  <h2>What does it look like?</h2>
  <p>
    This webpage is generated of Ruty templates. On each page you
    see a link in the footer to show the sourcecode. For more
    examples you can head over to the
    <a href="/documentation/">documentation</a>.
  </p>
{% endblock %}

Liquid

http://home.leetsoft.com/liquid Liquid Markup

star_full.gif star_empty.gif star_empty.gif Persia View Plugin

Categories/Tags: [Attribute language (category)]
Homepage: http://persia.rubyforge.org/
Documentation: Tutorial User Manual


Project/Development: http://rubyforge.org/projects/persia/


Description: An alternative view layer for Rails, inspired by Java projects Tapestry and Wicket. The purpose is to use clean html, which can be edited by a html-editor such as DreamWeaver, and use a powerful dom-api to make it dynamic.



Environment: Rails
Readiness: 4 - Beta



http://persia.rubyforge.org/tutorial.html

A mdml file is a valid xhtml file. Persia does not accept invalid xhtml. Any valid xhtml file is also valid mdml. The only difference is that you should add a namespace declaration to the root of your document: e.g. xmlns:persia="http://persia.rubyforge.org/specs" Also, you should mark elements with special Persia attributes. There are three such attributes: persia:id, persia:skip, and persia:class. With persia:id you can give a single element in a mdml file a unique name. persia:skip works as persia:id but also skips parsing the children of the element. persia:class allows you to give a non-unique name to an element.Only marked elements and their descendants will be available from your view class. How to manipulate a document tree There are several ways to manipulate a document tree:

  1. cursor <= 'text' – set attribute or textnode to ‘text’, or replace element by ‘text’
  2. cursor < 'text' – append ‘text’ to attribute or textnode
  3. cursor <=> cmd – run proc on current element
  4. cursor ^ 'http://java.net/' – set url on href attribute of a element or action attribute of form element
  5. cursor.replace! :document – replace current element with resource with ‘document’ id
  6. cursor.unwrap! – replaces current element with its children


Markup languages  edit   (Category  edit)


Text markup languages  edit   (Category  edit)


Facts about Ruby templating languagesRDF feed
Description [Oops! No type defined for attribute]
Ads
Personal tools