Class | Amrita::Template |
In: |
lib/amrita/parts.rb
lib/amrita/template.rb |
Parent: | Object |
amrita_id | [RW] | The name of attribute that will be used for template expandion by amrita. You will need to set this if you use id attribute fom DOM. For expample, if this was set to "amrita_id", you can use amrita_id for amrita and id for DOM. |
asxml | [RW] | If set, the output is an xhtml document. |
cache_manager | [RW] | |
compact_space | [RW] | compact spaces and delete new line of output if set. you can‘t set prettyprint and compact_space both in same Template. |
debug_compiler | [RW] | debug compiler |
escaped_id | [RW] | The name of attribute that turns into id. You will need to set this if you use id attribute for DOM/CSS/etc… For expample, if this was set to "__id", you can use id for amrita and __id for DOM/CSS/etc.… |
expand_attr | [RW] | If set, expand attribute which value is "@xxxx" |
keep_id | [RW] | @deprecated 設定しても無視される。 |
pre_format | [RW] | If Set, use pre_format method |
prettyprint | [RW] | output is pretty printed if set. |
src | [R] | The source code that generated by template compiler |
template | [R] | |
use_compiler | [R] | If Set, use compiler. |
xml | [RW] | If set, use REXML-based parser instead of Amrita‘s own html-parser |
# File lib/amrita/template.rb, line 106 def initialize @hint = nil @template = nil @xml = @prettyprint = @compact_space = @asxml = @pre_format = @expand_attr= false @keep_id = false @escaped_id = nil @amrita_id = "id" @use_compiler = false @cache_manager = DummyCacheManager.new @debug_compiler = false end
# File lib/amrita/template.rb, line 127 def expand(stream, model) setup_template if need_update? context = setup_context formatter = setup_formatter(stream) do_expand(model, context, formatter) end
# File lib/amrita/parts.rb, line 64 def install_parts_template(mod, ee, cls_name) e = ee.clone e[:id] = nil parts_mod = nil if mod.const_defined?(cls_name) parts_mod = mod.const_get(cls_name) raise "#{cls_name} is not a Module but [#{parts_mod.type}]" unless parts_mod.kind_of?(Module) else parts_mod = Module.new mod.const_set(cls_name, parts_mod) end parts_mod.module_eval { include Amrita include PartsTemplate #include HtmlCompiler::RuntimeRoutines #extend HtmlCompiler::RuntimeRoutines } compile_partstemplate(parts_mod, e, cls_name) end