Sha256: 3217159a400f6ec93dde9a9fab7f8e5116b4f8a38492ce918e8b055ce4ada7e7
Contents?: true
Size: 1.61 KB
Versions: 6
Compression:
Stored size: 1.61 KB
Contents
module WikiCloth class WikiBuffer::Var < WikiBuffer def initialize(data="",options={}) super(data,options) self.buffer_type = "var" @in_quotes = false end def skip_html? true end def function_name @fname end def to_s if self.is_function? ret = "#{buffer_type}" ret += " function #{function_name}" ret += "(#{params.inspect})" ret += " [#{data}]" else ret = @options[:link_handler].include_resource("#{params[0]}".strip,params[1..-1]) end ret ||= "<!-- TEMPLATE[#{params[0]}] NOT FOUND -->" ret end def is_function? self.function_name.nil? || self.function_name.blank? ? false : true end protected def function_name=(val) @fname = val end def new_char() case when current_char == '|' && @in_quotes == false self.current_param = self.data self.data = "" self.params << "" # Start of either a function or a namespace change when current_char == ':' && @in_quotes == false && self.params.size <= 1 self.function_name = self.data self.data = "" puts "[found var function (#{function_name})" # Dealing with variable names within functions # and variables when current_char == '=' && @in_quotes == false self.current_param = self.data self.data = "" self.name_current_param() # End of a template, variable, or function when current_char == '}' && previous_char == '}' self.data.chop! self.current_param = self.data self.data = "" return false else self.data += current_char end return true end end end
Version data entries
6 entries across 6 versions & 3 rubygems