masterview 0.2.5 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. data/CHANGELOG +31 -1
  2. data/README +70 -69
  3. data/RELEASE_NOTES +70 -64
  4. data/Rakefile +26 -27
  5. data/TODO +13 -29
  6. data/doc/about.html +246 -0
  7. data/doc/configuration.html +49 -36
  8. data/doc/developer.html +423 -41
  9. data/doc/directives.html +139 -51
  10. data/doc/guide.html +19 -9
  11. data/doc/index.html +90 -224
  12. data/doc/installation.html +36 -28
  13. data/doc/media_list.html +30 -20
  14. data/doc/simple_diagram.html +3 -5
  15. data/doc/stylesheets/masterview.css +16 -1
  16. data/examples/rails_app_config/masterview/settings.rb +2 -1
  17. data/init.rb +1 -1
  18. data/lib/#ChangeLog# +6 -0
  19. data/lib/masterview/analyzer.rb +48 -34
  20. data/lib/masterview/attr_string_parser.rb +5 -1
  21. data/lib/masterview/case_insensitive_hash.rb +69 -0
  22. data/lib/masterview/{pathname_extensions.rb → core_ext/pathname.rb} +0 -0
  23. data/lib/masterview/{string_extensions.rb → core_ext/string.rb} +0 -0
  24. data/lib/masterview/deprecated/directive_base.rb +362 -0
  25. data/lib/masterview/directive_base.rb +201 -179
  26. data/lib/masterview/directive_dsl.rb +457 -0
  27. data/lib/masterview/directive_helpers.rb +28 -141
  28. data/lib/masterview/directive_load_path.rb +388 -0
  29. data/lib/masterview/directive_metadata.rb +377 -0
  30. data/lib/masterview/directive_registry.rb +259 -69
  31. data/lib/masterview/directives/.metadata +16 -0
  32. data/lib/masterview/directives/attr.rb +9 -8
  33. data/lib/masterview/directives/block.rb +11 -14
  34. data/lib/masterview/directives/check_box.rb +13 -18
  35. data/lib/masterview/directives/collection_select.rb +15 -29
  36. data/lib/masterview/directives/content.rb +9 -3
  37. data/lib/masterview/directives/else.rb +15 -13
  38. data/lib/masterview/directives/elsif.rb +14 -13
  39. data/lib/masterview/directives/eval.rb +20 -0
  40. data/lib/masterview/directives/form.rb +56 -9
  41. data/lib/masterview/directives/form_remote.rb +26 -0
  42. data/lib/masterview/directives/global_inline_erb.rb +10 -14
  43. data/lib/masterview/directives/hidden_field.rb +11 -20
  44. data/lib/masterview/directives/if.rb +13 -12
  45. data/lib/masterview/directives/image_tag.rb +20 -28
  46. data/lib/masterview/directives/import.rb +5 -12
  47. data/lib/masterview/directives/import_render.rb +7 -19
  48. data/lib/masterview/directives/insert_generated_comment.rb +8 -11
  49. data/lib/masterview/directives/javascript_include.rb +21 -12
  50. data/lib/masterview/directives/link_to.rb +14 -8
  51. data/lib/masterview/directives/link_to_function.rb +22 -0
  52. data/lib/masterview/directives/link_to_if.rb +15 -13
  53. data/lib/masterview/directives/link_to_remote.rb +13 -8
  54. data/lib/masterview/directives/omit_tag.rb +32 -16
  55. data/lib/masterview/directives/password_field.rb +10 -22
  56. data/lib/masterview/directives/radio_button.rb +11 -22
  57. data/lib/masterview/directives/replace.rb +7 -8
  58. data/lib/masterview/directives/select.rb +11 -24
  59. data/lib/masterview/directives/stylesheet_link.rb +20 -12
  60. data/lib/masterview/directives/submit.rb +11 -5
  61. data/lib/masterview/directives/text_area.rb +10 -23
  62. data/lib/masterview/directives/text_field.rb +10 -22
  63. data/lib/masterview/exceptions.rb +21 -0
  64. data/lib/masterview/extras/app/controllers/masterview_controller.rb +102 -75
  65. data/lib/masterview/extras/app/views/layouts/masterview_admin.rhtml +24 -23
  66. data/lib/masterview/extras/app/views/layouts/masterview_admin_config.rhtml +81 -0
  67. data/lib/masterview/extras/app/views/masterview/admin/configuration.rhtml +5 -1
  68. data/lib/masterview/extras/app/views/masterview/admin/create.rhtml +2 -2
  69. data/lib/masterview/extras/app/views/masterview/admin/directives.rhtml +5 -0
  70. data/lib/masterview/extras/app/views/masterview/admin/features.rhtml +5 -79
  71. data/lib/masterview/extras/app/views/masterview/admin/interact.rhtml +5 -0
  72. data/lib/masterview/extras/app/views/masterview/admin/list.rhtml +3 -71
  73. data/lib/masterview/extras/init_mv_admin_pages.rb +42 -23
  74. data/lib/masterview/filter_helpers.rb +26 -0
  75. data/lib/masterview/initializer.rb +99 -53
  76. data/lib/masterview/io.rb +19 -15
  77. data/lib/masterview/keyword_expander.rb +7 -2
  78. data/lib/masterview/masterview_info.rb +229 -23
  79. data/lib/masterview/masterview_version.rb +2 -2
  80. data/lib/masterview/parser.rb +275 -105
  81. data/lib/masterview/parser_helpers.rb +54 -0
  82. data/lib/masterview/rails_ext/action_controller_erb_direct.rb +29 -0
  83. data/lib/masterview/rails_ext/action_controller_reparse_checking.rb +27 -0
  84. data/lib/masterview/{extras/init_rails_erb_mv_direct.rb → rails_ext/action_view_erb_direct.rb} +12 -59
  85. data/lib/masterview/template_spec.rb +3 -2
  86. data/lib/masterview.rb +21 -12
  87. data/lib/rexml/parsers/baseparser_with_doctype_fix.rb +473 -0
  88. data/lib/rexml/parsers/sax2parser_with_doctype_fix.rb +243 -0
  89. data/test/directive_test_helper.rb +135 -0
  90. data/test/fixtures/directives/id_check.rb +18 -0
  91. data/test/fixtures/directives/test_directive_events.rb +70 -0
  92. data/test/test_helper.rb +18 -5
  93. data/test/tmp/views/layouts/product.rhtml +10 -10
  94. data/test/tmp/views/product/_form.rhtml +4 -4
  95. data/test/tmp/views/product/_product.rhtml +3 -3
  96. data/test/tmp/views/product/destroy.rhtml +5 -5
  97. data/test/tmp/views/product/edit.rhtml +4 -4
  98. data/test/tmp/views/product/list.rhtml +3 -3
  99. data/test/tmp/views/product/new.rhtml +4 -4
  100. data/test/tmp/views/product/show.rhtml +2 -2
  101. data/test/unit/attr_string_parser_test.rb +105 -0
  102. data/test/unit/case_insensitive_hash_mod_test.rb +104 -0
  103. data/test/unit/config_settings_test.rb +13 -1
  104. data/test/unit/default_generate_mio_filter_test.rb +3 -3
  105. data/test/unit/deprecated_directive_base_test.rb +30 -0
  106. data/test/unit/directive_attr_test.rb +111 -35
  107. data/test/unit/directive_base_test.rb +520 -1
  108. data/test/unit/directive_block_test.rb +30 -22
  109. data/test/unit/directive_content_test.rb +24 -11
  110. data/test/unit/directive_else_test.rb +18 -15
  111. data/test/unit/directive_elsif_test.rb +17 -15
  112. data/test/unit/directive_form_remote_test.rb +59 -0
  113. data/test/unit/directive_form_test.rb +31 -39
  114. data/test/unit/directive_global_inline_erb_test.rb +28 -17
  115. data/test/unit/directive_grid_test_notready.rb +38 -0
  116. data/test/unit/directive_helpers_test.rb +39 -0
  117. data/test/unit/directive_hidden_field_test.rb +44 -29
  118. data/test/unit/directive_if_test.rb +10 -7
  119. data/test/unit/directive_image_tag_test.rb +69 -61
  120. data/test/unit/directive_import_render_test.rb +28 -38
  121. data/test/unit/directive_import_test.rb +16 -14
  122. data/test/unit/directive_insert_generated_comment_test.rb +32 -0
  123. data/test/unit/directive_javascript_include_test.rb +40 -43
  124. data/test/unit/directive_link_to_function_test.rb +40 -0
  125. data/test/unit/directive_link_to_if_test.rb +52 -12
  126. data/test/unit/directive_link_to_remote_test.rb +58 -0
  127. data/test/unit/directive_link_to_test.rb +46 -31
  128. data/test/unit/directive_load_path_test.rb +257 -0
  129. data/test/unit/directive_metadata_test.rb +313 -0
  130. data/test/unit/directive_omit_tag_test.rb +73 -21
  131. data/test/unit/directive_password_field_test.rb +44 -38
  132. data/test/unit/directive_registry_test.rb +44 -0
  133. data/test/unit/directive_replace_test.rb +28 -12
  134. data/test/unit/directive_stylesheet_link_test.rb +43 -36
  135. data/test/unit/directive_submit_test.rb +29 -30
  136. data/test/unit/directive_text_area_test.rb +40 -36
  137. data/test/unit/directive_text_field_test.rb +44 -38
  138. data/test/unit/example_directive_child_events_test.rb +41 -0
  139. data/test/unit/example_test.rb +31 -4
  140. data/test/unit/file_mio_test.rb +18 -13
  141. data/test/unit/filter_helpers_test.rb +10 -8
  142. data/test/unit/find_directive_parent_test.rb +174 -0
  143. data/test/unit/keyword_expander_test.rb +4 -2
  144. data/test/unit/mio_test.rb +18 -11
  145. data/test/unit/mtime_string_hash_mio_tree_test.rb +5 -1
  146. data/test/unit/parser_test.rb +41 -29
  147. data/test/unit/pathname_extensions_test.rb +1 -1
  148. data/test/unit/run_parser_test.rb +2 -2
  149. data/test/unit/simplified_directive_base_test.rb +256 -0
  150. data/test/unit/string_hash_mio_test.rb +5 -1
  151. data/test/unit/template_file_watcher_test.rb +2 -2
  152. data/test/unit/template_test.rb +221 -46
  153. metadata +86 -45
  154. data/lib/masterview/directives/testfilter.rb +0 -55
  155. data/lib/masterview/extras/init_rails_reparse_checking.rb +0 -62
data/TODO CHANGED
@@ -1,31 +1,28 @@
1
- - put image, stylesheets, javascript relative path regex in initializer
1
+ TODO LIST
2
2
  - create install.rb for rails 1.1 plugin installs, it will create config/masterview and some sample configs
3
3
  - create namespace for mv and publish, update generated files
4
4
  - more videos
5
- - allow multiple namespace prefixes for directives (allow custom directives to declare their own namespace)
6
- - publish .xsd namespace definition for builtin directives to enable xhmtl docs using mv markup to validate
5
+ - publish .xsd namespace definition for builtin directives to enable xhtml docs using mv markup to validate
7
6
  - wiki for site
8
7
  - render from db
9
8
  - app for syntax
10
9
  - include additional stylesheets
11
10
  - ajax examples
12
11
  - ajax table component
13
- - fix admin controller config page so it fits into admin layout
12
+ - improve directives info page in admin controller
13
+ - add link to directives rdoc from Loaded Directives page
14
14
  - documentation
15
15
  - update the plugin generator descr in installation.html: also installs config file templates in config
16
16
  - add tips in installation.doc about running gems rdoc server to view installed gems' rdoc
17
17
  - update admin controller description to point out that it installs public/stylesheets/masterview
18
18
  - run spelling checker on our html and release docs; retrofit to rdoc comments
19
- - directive developer documentation and examples
19
+ - build utility to auto-generate directives reference doc from directive metadata and std. rdoc markup
20
+ - add doc on directive impl unit test helper and techniques/examples
20
21
  - more tests
21
22
  - build improvements
22
23
  - add release tasks to automate archiving trunk to tags/masterview-N.N.N, resetting tags/masterview
23
24
  - investigate mirror sites for obtaining gems (supplement primary rubyforge host)
24
25
  - improve RubyForge project site: include online docs; post release msgs in news
25
- - internal code cleanup
26
- - DirectiveHelpers ERB_xx constants to differentiate ' %>' and ' -%>'
27
- - replace MasterView::NamespacePrefix+'<gen/import directivename>' concats in parser/analyzer with directive attr name constants
28
- - run spell checker on doc/*.html, ripple typo fixes back in rdoc comment
29
26
  - reverse engineer legacy rhtml into masterview templates
30
27
 
31
28
  --####################
@@ -36,29 +33,16 @@
36
33
 
37
34
  - make tidy installation easier
38
35
 
39
- DSL for creating directives
40
- maybe something like
41
36
 
42
- event :stag do |e|
43
- # these read args consecutively out of parse(attr_value)
44
- e.attr_arg :object, :quote_if => true
45
- e.attr_arg :foo { |t| t.upcase } # modifying case of foo
46
- e.attr_arg :link_name { self.content } #overriding with different value
47
- e.attr_arg :options, :optional => {} # specify that is optional but provide default if it is needed
48
- e.attr_arg :html_options, :merge_common => true, :merge => [:size, :rows] # merge in common and specified attributes
49
-
50
- a = a+1 # do some other logic
37
+ - clean up rhtml files when switching from write rhtml files to filesystem to direct erb, otherwise written files will take precedence over MV internals.
51
38
 
52
- old_content = e.content # retrieving content of tag
53
- e.content = 'foo' # resetting content of tag
54
- yield_contents = e.yield()
39
+ - build patch to send to rails core team improving hooks for template engines, removing file system dependency
55
40
 
56
- e.erb_code_render 'a = a + 1' # render <% a = a + 1 %>
57
- e.erb_content_render 'text_area' args(:object, :foo, :link_name, :options, :html_options) # render <%= %>, args handles joining the args with comma, and also takes into account if last args are not empty that other args are either provided also or defaulted.
41
+ - make admin pages localhost lockdown configurable rather than simple only available from localhost
58
42
 
59
- e.render 'direct render' # direct render as is
60
- end
43
+ - create DirectiveHelpers.parse_string_into_hash
44
+ - create DirectiveHelpers.serialize_hash_to_attributes # refactor attr directive code into here
61
45
 
62
- - default generate to *.rhtml if nothing is specified
46
+ - liquid directives or other non-evaling safe mode which allows user created templates or parts
63
47
 
64
-
48
+ - handle all xml syntax including processing_instruction, attlistdecl, elementdecl, entitydecl, notationdecl
data/doc/about.html ADDED
@@ -0,0 +1,246 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+
9
+ <title>MasterView - Rails-optimized (x)html friendly template engine</title>
10
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
11
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
12
+
13
+ <link href="./stylesheets/masterview.css" rel="stylesheet" type="text/css" />
14
+
15
+ </head>
16
+
17
+ <body>
18
+
19
+ <div id="pageHeader">
20
+ <a href="index.html"><img id="logo" src="images/masterview_logo.png" alt="MasterView Rails-optimized (x)html friendly template engine"/></a>
21
+ </div>
22
+
23
+ <div id="headerNav">
24
+ <div>
25
+ &middot;&nbsp;
26
+ <a href="./index.html">Doc Home</a>
27
+ &nbsp;|&nbsp;
28
+ <a href="./about.html">About</a>
29
+ &nbsp;|&nbsp;
30
+ <a href="./installation.html">Installation</a>
31
+ &nbsp;|&nbsp;
32
+ <a href="./configuration.html">Configuration</a>
33
+ &nbsp;|&nbsp;
34
+ <a href="./guide.html">Usage</a>
35
+ &nbsp;|&nbsp;
36
+ <a href="./directives.html">Directives</a>
37
+ &nbsp;|&nbsp;
38
+ <a href="./developer.html">Developers</a>
39
+ &nbsp;|&nbsp;
40
+ <a href="./media_list.html">Screencasts</a>
41
+ &nbsp;&middot;
42
+ </div>
43
+ </div>
44
+
45
+ <div id="pageBody">
46
+ <div id="bodyContent">
47
+
48
+ <h1>About MasterView</h1>
49
+
50
+ <h2>Why another templating engine?</h2>
51
+ <p>In short, I needed a way to be able to use a WYSIWYG editor to design/layout my rails pages and didn't want to give up the power and productivity of layouts, partials, and rails helpers. I needed to be able to create html templates quickly that could be handed off to a graphic designer for complex styling, and then use those html templates directly in the project. I also needed to be able to take existing html prototypes and easily make them real. I wanted to be able to give these html templates back to the designer at anytime throughout the project if the style or layout needs to be updated. The existing templating solutions did not meet all my goals or desired operation. For more information, read the background story below.
52
+ </p>
53
+
54
+ <h2>Goals</h2>
55
+ <ul>
56
+ <li>Create/extend a template engine for rails that would be XHTML friendly and
57
+ thus could be edited/styled with a WYSIWYG HTML editor even late in
58
+ development without breaking template.
59
+
60
+ </li>
61
+ <li>Keep it simple. DRY. No extra config files, simple syntax with ruby flavor.
62
+
63
+ </li>
64
+ <li>Design it specifically for ruby and rails. Use the full power and not be
65
+ limited in its capabilities over what can be done with ERb
66
+
67
+ </li>
68
+ <li>Utilize layouts, partials, and rails html helpers.
69
+
70
+ </li>
71
+ <li>Reduce complexity, work with existing rails code, no extra view logic or
72
+ hashes than what is used by ERb. Scaffold generate initial templates or
73
+ work from existing html prototype.
74
+
75
+ </li>
76
+ <li>Production ready generated templates - Make generated scaffolding templates
77
+ useable for production. Build in proper structure and style hooks. Provide simple
78
+ CSS for style and color usage. Fully generate labels and fields so that
79
+ it will be simple to reorder or remove things from views there by eliminating much
80
+ of the re-work necessary to build out real-world views.
81
+
82
+ </li>
83
+ <li>Reduce the numbers of files, simplifying editing. Define partials and
84
+ layouts naturally right in the template, no need to go to another file.
85
+
86
+ </li>
87
+ <li>Preview in browser without running an app. Allow for dummy data in the
88
+ template so that the page can be viewed and styled independently of the
89
+ application.
90
+
91
+ </li>
92
+ <li>Performance equal to ERb
93
+
94
+ </li>
95
+ </ul>
96
+
97
+ <h2>Background story</h2>
98
+ <p>
99
+ I came from a Java Struts environment when I was introduced to Ruby. I was
100
+ just in the process of evaluating Tapestry and JSF when I learned about
101
+ Rails. Ruby and Rails changed my world forever. I had to however drop many
102
+ of my bad habits aquired from years of Java and C++ work. I had to embrace
103
+ the new ideas and approach things now with a different mindset. (If you
104
+ ever have a chance to hear Dave Thomas speak, you will know what I mean. He
105
+ has a wonderfully entertaining yet enlightening way of illustrating this.)
106
+ </p>
107
+ <p>
108
+ After learning the Ruby and Rails way, (Thank you Matz and DHH for such
109
+ wonderful gifts to the world) I was amazed at how productive this
110
+ environment is. Programming was fun once again, and everything you do in
111
+ Ruby or Rails is easier than any other language or framework I have ever
112
+ seen. Even taking into account having to learn something new, I was still
113
+ far more productive than ever before. The only thing that I felt that could
114
+ be done better, was to have a nice html friendly templating engine so that
115
+ designers and developers could work collaboratively together on a project.
116
+ The designers could style and layout the pages with their WYSIWYG HTML
117
+ editors and developers would have the full power of Ruby and Rails without
118
+ having to jump through extra hoops to use them. I looked at the available
119
+ html template engines to see if anything fit with my style. I was
120
+ disappointed with each of them, mainly because they all made it harder than
121
+ straight ERb (rhtml) and were not able to use layouts and partials easily.
122
+ </p>
123
+ <p>
124
+ After all the hard work so many people have put into Ruby and Rails, I
125
+ wanted to see if there was anyway I could contribute as well, maybe
126
+ extending one of the existing template projects to have the ideal
127
+ functionality I was striving for. I wanted something to make my own web
128
+ development even more productive. However after reviewing each of them and
129
+ even getting into the source code, the closest ones seemed to be Amrita2,
130
+ Liquid, and Kwartz. Unfortunately it was not going to be easy to add the
131
+ functionality and usability I desired.
132
+ </p>
133
+ <p>
134
+ During my research I learned that many of the rails gurus were putting down
135
+ html template engines because they felt that they handicapped the developer
136
+ severely, namely by not taking advantage of rails layouts, partials, and
137
+ html helpers. After doing some projects with ERb (rhtml) I realized that
138
+ they were right. I too did not want to give up any of that power either. I
139
+ also didn&#8217;t want to create a bunch of extra code or config to use the
140
+ templates (extra view code, or data structures to pass to the templates) as
141
+ so many of the other engines relied on.
142
+ </p>
143
+ <p>
144
+ I expanded my search outside of Ruby for the best html template technology
145
+ I could find. After reviewing all the front runners I still didn&#8217;t
146
+ find anything that quite met with my goals for developing with ruby and
147
+ rails. I also didn&#8217;t find any technology that was close enough that I
148
+ could adapt it. However I did come across features in a variety of systems
149
+ that inspired me, and helped me shape the ideas that are presented here. A few
150
+ of those systems were Tapestry, Zope/PHP TAL, Kwartz, Amrita 2, Liquid,
151
+ and Web Objects.
152
+ </p>
153
+ <p>
154
+ After putting much thought into all the possible options I could not see
155
+ extending an existing template engine to meet my needs. And since I wanted
156
+ this engine to have all the power of ruby and rails, it seemed that I would
157
+ be best served by developing a html template syntax that was a thin layer
158
+ above ERb. That way it would be intuitive to use (not having to learn yet
159
+ another syntax) yet very powerful. Once I was able to come up with the
160
+ desired syntax and approach it became apparent that this would also be
161
+ fairly straightforward to build.
162
+ </p>
163
+ <p>
164
+ I ran the concept by the guys at the St. Louis Ruby Group <a
165
+ href="http://stlruby.org">stlruby.org</a> and they were excited about the
166
+ project. With their help I was able to simply some of the confusing or
167
+ complicated areas before beginning development. They also sparked some
168
+ ideas about how to make this infinitely extensible such that developers
169
+ could easily add their own attribute directives. This would give them the
170
+ power to create custom extensions that would encapsulate some of their
171
+ development work. This would serve a couple needs, it would not only make
172
+ this engine extensible, it would also allow this engine to grow easily
173
+ being composed of small pluggable attribute directives. Many thanks to the
174
+ members of this group, I continue to enjoy discussing the power of Ruby and
175
+ learning from each of them on a monthly basis.
176
+ </p>
177
+ <p>
178
+ While I am on the subject of thanks, I would like to thank my wife and
179
+ daughter for their support as I took time away from them to work on this
180
+ project and I want to thank God for bringing the right people into my life
181
+ just when I needed them and for bringing me on this wonderful journey, I am
182
+ so very blessed. May I be able to give back some of what has been given to
183
+ me.
184
+ </p>
185
+ <p>
186
+ And one more mention of tremendous thanks to Deb Lewis, the other core developer on the
187
+ team, she has spent countless hours reviewing, revising, and improving the codebase,
188
+ configuration, and documentation. The project wouldn't be half of what it is today
189
+ without all her help, inspiration, and hard work. I thoroughly enjoy working and
190
+ debating the finer points of the project with her each step of the way.
191
+ </p>
192
+ <p>
193
+ So that&#8217;s the story, I hope that many of you will find MasterView to be a useful tool for
194
+ your development. I am continuing to refine MasterView by using it daily for
195
+ Genesis Ministry sites and all my web projects. I know that there is much
196
+ more work needed in documentation, examples, test cases, additional
197
+ directives, etc., so I would appreciate any feedback and ideas that you
198
+ have. Thanks for taking the time to review MasterView!
199
+ </p>
200
+ <p>
201
+ Jeff Barczewski
202
+ (jeff.barczewski
203
+ <span class="class"> (at) </span>
204
+ gmail (dot) com)
205
+ </p>
206
+
207
+
208
+ </div> <!-- bodyContent -->
209
+ </div>
210
+
211
+ <div id="pageFooter">
212
+ <div>
213
+ &middot;&nbsp;
214
+ <a href="./index.html">Doc Home</a>
215
+ &nbsp;|&nbsp;
216
+ <a href="./about.html">About</a>
217
+ &nbsp;|&nbsp;
218
+ <a href="./installation.html">Installation</a>
219
+ &nbsp;|&nbsp;
220
+ <a href="./configuration.html">Configuration</a>
221
+ &nbsp;|&nbsp;
222
+ <a href="./guide.html">Usage</a>
223
+ &nbsp;|&nbsp;
224
+ <a href="./directives.html">Directives</a>
225
+ &nbsp;|&nbsp;
226
+ <a href="./developer.html">Developers</a>
227
+ &nbsp;|&nbsp;
228
+ <a href="./media_list.html">Screencasts</a>
229
+ &nbsp;&middot;
230
+ </div>
231
+ <table summary="layout area">
232
+ <tbody>
233
+ <tr>
234
+ <td class="copyright">&copy;&nbsp;Copyright MasterView 2006</td>
235
+ <td class="validators">
236
+ <a href="http://validator.w3.org/check/referer"><img
237
+ src="http://www.w3.org/Icons/valid-xhtml10" class="w3c_validator"
238
+ title="Valid XHTML 1.0!" alt="Valid XHTML 1.0!" /></a>
239
+ </td>
240
+ </tr>
241
+ </tbody>
242
+ </table>
243
+ </div>
244
+
245
+ </body>
246
+ </html>
@@ -1,8 +1,8 @@
1
1
  <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
2
+ <!DOCTYPE html
3
3
  PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
4
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
5
+
6
6
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
7
  <head>
8
8
 
@@ -25,6 +25,8 @@
25
25
  &middot;&nbsp;
26
26
  <a href="./index.html">Doc Home</a>
27
27
  &nbsp;|&nbsp;
28
+ <a href="./about.html">About</a>
29
+ &nbsp;|&nbsp;
28
30
  <a href="./installation.html">Installation</a>
29
31
  &nbsp;|&nbsp;
30
32
  <a href="./configuration.html">Configuration</a>
@@ -32,8 +34,10 @@
32
34
  <a href="./guide.html">Usage</a>
33
35
  &nbsp;|&nbsp;
34
36
  <a href="./directives.html">Directives</a>
35
- &nbsp;&nbsp;
36
- <a href="./media_list.html">Media (Videos/Illustrations)</a>
37
+ &nbsp;|&nbsp;
38
+ <a href="./developer.html">Developers</a>
39
+ &nbsp;|&nbsp;
40
+ <a href="./media_list.html">Screencasts</a>
37
41
  &nbsp;&middot;
38
42
  </div>
39
43
  </div>
@@ -41,7 +45,7 @@
41
45
  <div id="pageBody">
42
46
  <div id="bodyContent">
43
47
 
44
- <h1>MasterView - Configuration Guide</h1>
48
+ <h1>MasterView Configuration Guide</h1>
45
49
 
46
50
  <p><span class="productName">MasterView</span> supports a number of options for configuring its operation.</p>
47
51
 
@@ -61,7 +65,7 @@
61
65
  that are suitable for a typical Rails application.
62
66
  The goal is to allow Rails application developers to use
63
67
  the <span class="productName">MasterView</span> plugin "out of the box",
64
- with little or no initial setup effort: simply install the
68
+ with little or no initial setup effort: simply install the
65
69
  <span class="productName">MasterView</span> plugin in a rails application
66
70
  and start using the template engine facilities in its views.
67
71
  </p>
@@ -69,11 +73,11 @@ and start using the template engine facilities in its views.
69
73
  <h2>Using MasterView in a Rails Application</h2>
70
74
 
71
75
  <p>The standard configuration of <span class="productName">MasterView</span> in
72
- a Rails application is to search for MasterView templates (*.html) in the normal
76
+ a Rails application is to search for MasterView templates (*.html) in the normal
73
77
  <code>RAILS_ROOT/app/views</code> directory and for rails to load the generated
74
78
  rhtml directly from <span class="productName">MasterView</span> internally. If config.generate_rhtml is set to true
75
- (default is false) then <span class="productName">MasterView</span> will generate its intermediate rhtml to the standard
76
- <code>RAILS_ROOT/app/views</code> directory and Rails will pick it up from there
79
+ (default is false) then <span class="productName">MasterView</span> will generate its intermediate rhtml to the standard
80
+ <code>RAILS_ROOT/app/views</code> directory and Rails will pick it up from there
77
81
  as normal.
78
82
 
79
83
  The <code>mv:</code> attribute markup in the masterview templates determines
@@ -83,11 +87,11 @@ the content of the generated rhtml view templates, which are then used by the Ra
83
87
  By default, all masterview templates are parsed during rails application startup to ensure
84
88
  that generated rhtml views are up-to-date for the application.
85
89
  In a development environment, when Rails is reloading changed classes to dynamically
86
- update the application code as you make changes,
90
+ update the application code as you make changes,
87
91
  <span class="productName">MasterView</span> will automatically
88
92
  detect changes you make to your masterview templates and regenerate the rails rhtml views.
89
93
  This ability to dynamically modify your rails application during development
90
- is a key factor for the productivity of Rails developers, so
94
+ is a key factor for the productivity of Rails developers, so
91
95
  the <span class="productName">MasterView</span> designers have ensured
92
96
  that you continue to have this capability when using masterview templates.
93
97
  </p>
@@ -112,10 +116,10 @@ to configure settings specifically for your development environment).
112
116
 
113
117
  <h3>Sample <code>config/masterview/settings.rb</code> in a Rails Application</h3>
114
118
 
115
- <pre><code>
119
+ <pre class="code">
116
120
  # Application configuration settings for the MasterView template engine.
117
- # Run at plugin load time during Rails startup (after the base rails
118
- # framework is loaded and before the application's own startup logic
121
+ # Run at plugin load time during Rails startup (after the base rails
122
+ # framework is loaded and before the application's own startup logic
119
123
  # in its config/environment.rb is run).
120
124
  #
121
125
  # Set standard application
@@ -126,24 +130,23 @@ to configure settings specifically for your development environment).
126
130
 
127
131
  # Only use the MasterView admin pages for development
128
132
  config.enable_admin_pages = false
129
-
133
+
130
134
  # modify the default logging level from WARN to ERROR (only want to see serious errors)
131
135
  config.logger = 'log4r'
132
136
  config.log_level = 'ERROR'
133
- config.after_initialize {
137
+ config.after_initialize {
134
138
  # we shouldn't see any of these in the log
135
- MasterView.Log.debug "LOG CONFIG TEST: debug log entries suppressed at ERROR level"
136
- MasterView.Log.info "LOG CONFIG TEST: info log entries suppressed at ERROR level"
137
- MasterView.Log.warn "LOG CONFIG TEST: warning log entries suppressed at ERROR level"
139
+ MasterView.Log.debug "LOG CONFIG TEST: debug log entries suppressed at ERROR level"
140
+ MasterView.Log.info "LOG CONFIG TEST: info log entries suppressed at ERROR level"
141
+ MasterView.Log.warn "LOG CONFIG TEST: warning log entries suppressed at ERROR level"
138
142
  # so this is the only log message that should get through
139
143
  #MasterView.Log.error "LOG CONFIG TEST: only serious messages are reported at ERROR level"
140
144
  }
141
-
142
- </code></pre>
145
+ </pre>
143
146
 
144
147
  <h3>Sample <code>config/masterview/environments/development.rb</code> in a Rails Application</h3>
145
148
 
146
- <pre><code>
149
+ <pre class="code">
147
150
  # Application configuration settings for the MasterView template engine.
148
151
  #
149
152
  # Set development-mode config settings here
@@ -153,8 +156,7 @@ to configure settings specifically for your development environment).
153
156
 
154
157
  # include debug and all info/warning/error log messages during development
155
158
  config.log_level = 'DEBUG'
156
-
157
- </code></pre>
159
+ </pre>
158
160
 
159
161
  <h2>Using MasterView outside Rails</h2>
160
162
 
@@ -163,14 +165,14 @@ used independently of the Rails application context.
163
165
  Outside Rails, you need to explicitly run the <code>MasterView::Initializer</code>
164
166
  in your application startup code.
165
167
  While the Rails framework handles masterview loading automatically through its
166
- framework startup and plugin loading facilities,
168
+ framework startup and plugin loading facilities,
167
169
  with configuration settings files obtained from standard locations within the
168
170
  overall structure of a rails application,
169
171
  a non-rails application using the MasterView template engine needs to initiate
170
172
  loading the template engine and providing it with configuration information.
171
173
  </p>
172
174
 
173
- <pre><code>
175
+ <pre class="code">
174
176
  require 'masterview/initializer'
175
177
  config = MasterView::Configuration( :app_root_path = '/path/to/my/app' )
176
178
  # This app has simple config, so it won't use the config files scheme used in Rails.
@@ -178,7 +180,7 @@ loading the template engine and providing it with configuration information.
178
180
  config.template_src_dir_path = 'masterview/templates' # rel path from app's root_path
179
181
  config.template_dst_dir_path = 'masterview/output'
180
182
  Masterview::Initializer(:process, config)
181
- </code></pre>
183
+ </pre>
182
184
 
183
185
  <hr />
184
186
  <a name="mv_options_ref" />
@@ -311,7 +313,7 @@ Use <code>config.template_src_dir_abs_path(abs_path)</code> to specify the templ
311
313
  <br />{root_path}/masterview/output<br />(non-rails app)</td>
312
314
  <td class="description">Path to the directory where Masterview template output (rhtml) will be generated.
313
315
  <div class="explanation">
314
- Specify the location of your template output directory as a relative path from
316
+ Specify the location of your template output directory as a relative path from
315
317
  the application's <code>root_path</code>.
316
318
  Use <code>config.template_dst_dir_abs_path(abs_path)</code> to specify the template output directory as an absolute path.
317
319
  </div>
@@ -389,7 +391,7 @@ with the pathname of the source template file.
389
391
  <tr>
390
392
  <td>&nbsp;</td>
391
393
  <td class="default"><b>:default_generate</b> => true</td>
392
- <td class="description">Ensure that a mv:generate or mv:gen_partial is present in a template,
394
+ <td class="description">Ensure that a mv:generate or mv:gen_partial is present in a template,
393
395
  otherwise add a mv:generate="{template_path}" to the body tag if one is present or the root
394
396
  element. If a body tag is present and mv:generate is being added then also add mv:omit_tag="".</td>
395
397
  </tr>
@@ -401,7 +403,12 @@ element. If a body tag is present and mv:generate is being added then also add m
401
403
  <tr>
402
404
  <td class="setting">namespace_prefix</td>
403
405
  <td class="default">mv:</td>
404
- <td class="description">XML name space prefix for MasterView directive attributes in template html.</td>
406
+ <td class="description">XML name space prefix for built-in MasterView directive attributes in template html.</td>
407
+ </tr>
408
+ <tr>
409
+ <td class="setting">namespace_prefix_extensions</td>
410
+ <td class="default">mvx:</td>
411
+ <td class="description">XML name space prefix for addon MasterView directive attributes in template html.</td>
405
412
  </tr>
406
413
  <tr>
407
414
  <td class="setting">inline_erb_start</td>
@@ -447,13 +454,13 @@ element. If a body tag is present and mv:generate is being added then also add m
447
454
  <tr>
448
455
  <td class="setting">reparse_changed_masterview_templates</td>
449
456
  <td class="default">true if both template parsing at startup and ActionController class reloading are enabled</td>
450
- <td class="description">Boolean which determines whether masterview templates are automatically reparsed if the template changes after initial application loading.
457
+ <td class="description">Boolean which determines whether masterview templates are automatically reparsed if the template changes after initial application loading. Note: If ActionController::Base.perform_caching is true (default true in production), compiled rhtml is cached and MasterView will not check for modified templates.
451
458
  </td>
452
459
  </tr>
453
460
  <tr>
454
461
  <td class="setting">enable_admin_pages</td>
455
462
  <td class="default">true for development, otherwise false</td>
456
- <td class="description">Enable MasterView admin pages in the rails application.
463
+ <td class="description">Enable MasterView admin pages in the rails application.
457
464
  <!--Too clever, just set the default and be done with it:
458
465
  If config/masterview/environments/development.rb was created during installation then the default is true in development mode (false by default in production unless changed in settings.rb).
459
466
  -->
@@ -463,7 +470,7 @@ If config/masterview/environments/development.rb was created during installation
463
470
  <tr>
464
471
  <td class="setting">enable_view_rhtml</td>
465
472
  <td class="default">true for development, otherwise false</td>
466
- <td class="description">Enable MasterView admin pages in a rails application to be able to view the generated rhtml. When enabled it creates links on the list page to click to view the rhtml source. Requires that enable_admin_pages is true.
473
+ <td class="description">Enable MasterView admin pages in a rails application to be able to view the generated rhtml. When enabled it creates links on the list page to click to view the rhtml source. Requires that enable_admin_pages is true.
467
474
  <!--Too clever, just set the default and be done with it:
468
475
  If config/masterview/environments/development.rb was created during installation then the default is true in development mode (false by default in production unless changed in settings.rb).
469
476
  -->
@@ -495,6 +502,8 @@ If config/masterview/environments/development.rb was created during installation
495
502
  &middot;&nbsp;
496
503
  <a href="./index.html">Doc Home</a>
497
504
  &nbsp;|&nbsp;
505
+ <a href="./about.html">About</a>
506
+ &nbsp;|&nbsp;
498
507
  <a href="./installation.html">Installation</a>
499
508
  &nbsp;|&nbsp;
500
509
  <a href="./configuration.html">Configuration</a>
@@ -502,8 +511,10 @@ If config/masterview/environments/development.rb was created during installation
502
511
  <a href="./guide.html">Usage</a>
503
512
  &nbsp;|&nbsp;
504
513
  <a href="./directives.html">Directives</a>
505
- &nbsp;&nbsp;
506
- <a href="./media_list.html">Media (Videos/Illustrations)</a>
514
+ &nbsp;|&nbsp;
515
+ <a href="./developer.html">Developers</a>
516
+ &nbsp;|&nbsp;
517
+ <a href="./media_list.html">Screencasts</a>
507
518
  &nbsp;&middot;
508
519
  </div>
509
520
  <table summary="layout area">
@@ -511,7 +522,9 @@ If config/masterview/environments/development.rb was created during installation
511
522
  <tr>
512
523
  <td class="copyright">&copy;&nbsp;Copyright MasterView 2006</td>
513
524
  <td class="validators">
514
- <a href="http://validator.w3.org/check/referer">[Valid XHTML]</a>
525
+ <a href="http://validator.w3.org/check/referer"><img
526
+ src="http://www.w3.org/Icons/valid-xhtml10" class="w3c_validator"
527
+ title="Valid XHTML 1.0!" alt="Valid XHTML 1.0!" /></a>
515
528
  </td>
516
529
  </tr>
517
530
  </tbody>