# MasterView 0.3.4 Rails-optimized (x)html template engine

**URL:** <https://www.ruby-forum.com/t/masterview-0-3-4-rails-optimized-x-html-template-engine/116339>\
**Category:** Ruby\
**Created:** [October 4, 2007, 5:02pm UTC](https://www.ruby-forum.com/t/masterview-0-3-4-rails-optimized-x-html-template-engine/116339 "2007-10-04T17:02:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jbell38](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/edb3f5/32.png) [@jbell38](https://www.ruby-forum.com/u/jbell38)\
**Post date:** [October 4, 2007, 5:02pm UTC](https://www.ruby-forum.com/t/masterview-0-3-4-rails-optimized-x-html-template-engine/116339/1 "2007-10-04T17:02:23Z")

</div>

= MasterView - Rails-optimized (x)html friendly template engine

MasterView is a template engine plugin that provides another option to  
the existing rails view templates (rhtml and rxml). This template  
engine has all the power of layouts, partials, and rails helpers but  
is still editable/styleable in a WYSIWYG editor.

Another major goal it to have the syntax of these attribute directives  
be very similar to rails helpers so that one could intuitively start  
using MasterView with little learning curve other than knowing rails.  
MasterView users can additionally create their own directives to  
encapsulate custom functionality so the system can be easily extended  
into specific uses.

MasterView was inspired by Amrita, Kwartz, Tapestry, Zope/PHP TAL,  
Liquid, and Web Objects but designed with a fresh approach and  
specifically targetted for rails users.

There are several ways to use MasterView:

- Start with a pure HTML prototype of your site and add directives to  
the pages to make them live. You can continue to WYSIWYG edit HTML  
prototype throughout project life cycle. (See screencast for  
demonstration)

- If you don’t have an HTML prototype and want to generate a CRUD  
application, you may use the MasterView generator which creates a  
styled CRUD application which you can then change as needed.

- If you already have an application but would like to use MasterView,  
you can start to use MasterView for new pages. MasterView will  
co-exist nicely with existing rhtml and you can slowly evolve the site  
over time.

== Recent changes (Release 0.3.4) - Partial enhancement and maintenance  
Make values in gen\_partial and import\_partial retain their page  
specific values, allowing you to specify different locals,  
collections, or objects for import\_render than you do on gen\_partial.  
Also allows you to reuse the partial multiple times on a page with  
different values. (thanks James B.)

Fix rebuild template so that it uses the same list of XHTML empty  
elements to determine whether to collapse empty elements (thanks to  
Brian Jordan)

Fixed a problem with CruiseControl where ActionController was not  
defined when masterview was initialized. (thanks James B.)

Added mv:generate\_all\_rhtml rake task which generates all rhtml files to  
make it  
more obvious for users who want to generate the rhtml files. Also  
changed the way  
gen\_partial and import\_render work with regards to collections,  
object, and locals,  
they now retain the values from the page even after rebuild. This  
allows you to have  
different values on each page and even different values on the same  
page if use partials  
multiple times on a page.

== Recent changes (Release 0.3.3) - Maintenance release plus auto\_copy  
Added auto copy feature which can be configured to automatically copy  
static files like stylesheets, images, and javascripts from a  
non-standard location to the proper location at runtime (under Rails  
public). This makes it easy to use HTML prototypes and associated  
files with MasterView eliminating any manual copying.

This release fix adds doctype to generated code, and a bug in  
gen\_replace which outputted \<% %\> rather than \<%= %\> (thanks Jon  
Frisby). Fixed defect in multipart form and stylesheet\_link directives  
(thanks Rajavel Lenin).

Made REXML sax2parser configurable. Generator now creates example for  
custom admin auth mixin controlling authentication with custom code.  
(thanks David K.)

Fix defect which prevented MasterView to be used with Goldberg or  
other plugins which alter the view base unless MasterView was  
configured to generate the rhtml files.

Fix rails runtime detection when running in RadRails which launches  
using -e

Added rake task mv:clean\_mv\_rhtml task which removes the MasterView  
generated rhtml if you have configured MasterView to generate to the  
file system. Only removes files that it generates leaving other rhtml  
untouched. This is useful when switching to not generating rhtml mode  
when it was previously enabled.

== Release 0.3.2 - Maintenance release plus custom admin auth  
This release addresses a compatibility problem with Rails 1.2 where a  
view syntax error would not display the normal debug output but  
instead displayed only a blank screen. Also fixed a parsing problem  
with multiple parameters in some directives. Added the ability to use  
custom mixin for authorization to MasterView admin screens. Changed  
the MasterView generator to use request, flash, and params rather than  
deprecated @request, @flash, and @params. Tested with Rails 1.2.2

== Details

Author:: Jeff B.  
Email:: jeff.barczewski (at) gmail (dot) com  
Primary developers:: Jeff B., Deb Lewis  
Website:: [http://masterview.org](http://masterview.org)  
Rubyforge project:: masterview  
([http://rubyforge.org/projects/masterview](http://rubyforge.org/projects/masterview))  
License:: MIT open source license like Rails

=== Video ===

A short video demonstrating use of MasterView converting an HTML  
prototype into a live application while still allowing round trip  
WYSIWYG editing.  
[http://masterview.org/media/html-to-live/screencast.html](http://masterview.org/media/html-to-live/screencast.html)

=== Screenshots, illustrations, other video ===

[http://masterview.org/media\_list.html](http://masterview.org/media_list.html)

=== Packaging ===

MasterView is distributed as a gem or a plugin. You may install it as  
a gem and then generate a lightweight plugin which mainly refers to  
the gem _or_ you can simply install as a plugin which is self  
contained. I personally prefer installing as a gem for ease of  
management, however if you are running at a shared hosting environment  
you might not have authority to install this gem so you may install as  
a self contained plugin.

== Goals

- Create/extend a template engine for rails that would be XHTML  
friendly and thus could be edited/styled with a WYSIWYG HTML editor  
even late in development without breaking template.
- Keep it simple. DRY. No extra config files, simple syntax with ruby  
flavor.
- Design it specifically for ruby and rails. Use the full power and  
not be limited in its capabilities over what can be done with ERb
- Work nicely with layouts, partials, and rails html helpers.
- Reduce complexity, work with existing rails code, no extra view  
logic or hashes than what is used by ERb. Scaffold generate initial  
templates or work from existing html prototype.
- Reduce the numbers of files, simplifying editing. Define partials  
and layouts naturallyl right in the template, no need to go to another  
file.
- Preview in browser without running an app. Allow for dummy data in  
the template so that the page can be viewed and styled independently  
of the application.
- Performance equal to ERb

== Prerequisites

Requires::  
No external dependencies

Optional::  
tidy (gem) and tidy library  
if these are installed you can use tidy to cleanup  
html into valid xhtml for use by MasterView

```
    log4r (gem)
        if this gem is installed then MasterView will use
        it for logging otherwise it defaults to using built
        in Logger.

```

== User Documentation

MasterView documentation is available online at the MasterView site:  
[http://www.masterview.org](http://www.masterview.org)  
and on the rubyforge project  
[http://rubyforge.org/projects/masterview/](http://rubyforge.org/projects/masterview/)

== Installation

Detailed installation instructions for installing the masterview gems  
or a self-contained copy of the plugin is provided in the MasterView  
Installation Guide.

The Configuration Guide describes how to customize the configuration  
of the MasterView template engine for your application.

== Usage

The MasterView User’s Guide and a complete Directives Reference are  
provided in the MasterView user documentation. MasterView templates  
can be created by adding masterview directives markup to an (x)html  
ptototype, or can be generated for typical Rails controller/view  
scenarios using the supplied masterview generator developer tool.

A MasterView Admin controller can optionally be activated in your  
application to assist you during development with creating and  
managing your templates.

== Next Steps

Visit the online documentation page at [http://masterview.org/](http://masterview.org/) for  
screenshots, illustrations, complete installation and usage  
information.

We would love to hear your feedback and ideas around this project!  
Visit the rubyforge project to join the users mailing list or to add  
yourself to the announce list to receive future announcements. Check  
out the video to see MasterView in action!

Thanks for your time!!

MasterView Development Team  
Jeff B. and Deb Lewis

---

<div class="post-metadata">

**Author:** ![jbell38](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/edb3f5/32.png) [@jbell38](https://www.ruby-forum.com/u/jbell38)\
**Post date:** [October 5, 2007, 1:15am UTC](https://www.ruby-forum.com/t/masterview-0-3-4-rails-optimized-x-html-template-engine/116339/2 "2007-10-05T01:15:48Z")

</div>

Jeff B. wrote:

> = MasterView - Rails-optimized (x)html friendly template engine
> 
> MasterView is a template engine plugin that provides another option to  
> the existing rails view templates (rhtml and rxml). This template  
> engine has all the power of layouts, partials, and rails helpers but  
> is still editable/styleable in a WYSIWYG editor.

This is beautiful. Thanks for writing this. It addresses rails one  
and only major shortcoming.
