Class Kwartz::ElementInfo
In: kwartz/converter.rb
Parent: Object

Methods

apply   create   dummy_span_tag?   new  

Attributes

after  [R] 
append_exprs  [RW] 
applied  [RW] 
attr_info  [RW] 
before  [R] 
cont_expr  [R] 
cont_stmts  [RW] 
elem_expr  [R] 
etag_expr  [R] 
etag_info  [RW] 
logic  [R] 
name  [RW] 
stag_expr  [R] 
stag_info  [RW] 

Public Class methods

[Source]

# File kwartz/converter.rb, line 178
    def self.create(values={})
      v = values
      return self.new(v[:name], v[:stag], v[:etag], v[:cont], v[:attr], v[:append])
    end

[Source]

# File kwartz/converter.rb, line 162
    def initialize(stag_info, etag_info, cont_stmts, attr_info, append_exprs)
      @stag_info    = stag_info      # TagInfo
      @etag_info    = etag_info      # TagInfo
      @cont_stmts   = cont_stmts     # list of Statement
      @attr_info    = attr_info      # AttrInfo
      @append_exprs = append_exprs   # list of NativeExpression
      @logic = [ ExpandStatement.new(:elem, @name) ]
    end

Public Instance methods

[Source]

# File kwartz/converter.rb, line 184
    def apply(ruleset)
      r = ruleset
      @stag_expr = _to_native_expr(r.stag) if r.stag
      @cont_expr = _to_native_expr(r.cont) if r.cont
      @etag_expr = _to_native_expr(r.etag) if r.etag
      @elem_expr = _to_native_expr(r.elem) if r.elem
      if @cont_expr
        @cont_stmts = [ PrintStatement.new([@cont_expr]) ]
        @stag_info.tail_space = ''
        @etag_info.head_space = ''
        @etag_info.rebuild_tag_text()
      end
      r.remove.each do |aname|
        @attr_info.delete(aname)
      end if r.remove
      r.attrs.each do |aname, avalue|
        @attr_info[aname] = _to_native_expr(avalue)
      end if r.attrs
      r.append.each do |expr|
        (@append_exprs ||= []) << _to_native_expr(expr)
      end if r.append
      @tagname = r.tagname if r.tagname
      @logic  = r.logic  if r.logic
      (@before ||= []).concat(r.before) if r.before
      (@after  ||= []).concat(r.after)  if r.after
    end

[Source]

# File kwartz/converter.rb, line 212
    def dummy_span_tag?(tagname='span')
      return @stag_info.tagname == tagname && @attr_info.empty?  && @append_exprs.nil?
    end

[Validate]