Class Iowa::TemplateParser
In: src/TemplateParser.rb
Parent: Object

Parse a template for dynamic elements.

Methods

Constants

Bodyless = %w(p input li hr option)
OID = "oid"
PatternString = "(<\\s*([^>]+?)\\s+([^>]*?" + OID + "\\s*=('|\")\\s*(.*?)\\s*(\\4)[^>]*?(/)?\\s*)>)" + "|" + "(@([\\w.]+))"
Pattern = Regexp.new(PatternString)   Regexp constant that defines the regexp to use to parse the template for dynamic content tags.
DynamicTag = 1   Constant that defines the position in Pattern of the dynamic tag data.
Tag = 2
Attributes = 3
ID = 5
Close = 7
Shortform = 9
OpenTag = Shortform + 1
CloseTag = Shortform + 2

Public Class methods

Take the data to parse and the bindings for the template. Store each in object variables, and then parse the template data for dynamic tags.

Public Instance methods

Determine if a given tag is part of the set of bodyless tags.

Parse the contents of a single tag.

Traverse a tag’s body, looking for other dynamic elements embedded within it.

Returns a regular expression object that matches either a dynamic element as defined in the global template parsing Pattern, or an opening element of the given tag (argument passed to the method) or a closing element of the given tag.

Return the last element of the nodestack.

[Validate]