Since ERB doesn't allow "<%" and other tags inside of ruby
        blocks we have to use a split approach here that fails for
        that too.
436984
def get_tokens_unprocessed(self, text):
        
        tokens = self._block_re.split(text)
        tokens.reverse()
        state = idx = 0
        try:
            while True:
                # text
                if state == 0:
                    val = tokens.pop()
                    yield idx, Other, val
                    idx += len(val)
                    state = 1
                # block starts
                elif state == 1:
                    tag = tokens.pop()
                    # literals
                    if tag in ('<%%', '%%>'):
                        yield idx, Other, tag
                        idx += 3
                        state = 0
                    # comment
                    elif tag == '<%#':
                        yield idx, Comment.Preproc, tag
                        val = tokens.pop()
                        yield idx + 3, Comment, val
                        idx += 3 + len(val)
                        state = 2
                    # blocks or output
                    elif tag in ('<%', '<%=', '<%-'):
                        yield idx, Comment.Preproc, tag
                        idx += len(tag)
                        data = tokens.pop()
                        r_idx = 0
                        for r_idx, r_token, r_value in \
                                self.ruby_lexer.get_tokens_unprocessed(data):
                            yield r_idx + idx, r_token, r_value
                        idx += len(data)
                        state = 2
                    elif tag in ('%>', '-%>'):
                        yield idx, Error, tag
                        idx += len(tag)
                        state = 0
                    # % raw ruby statements
                    else:
                        yield idx, Comment.Preproc, tag[0]
                        r_idx = 0
                        for r_idx, r_token, r_value in \
                                self.ruby_lexer.get_tokens_unprocessed(tag[1:]):
                            yield idx + 1 + r_idx, r_token, r_value
                        idx += len(tag)
                        state = 0
                # block ends
                elif state == 2:
                    tag = tokens.pop()
                    if tag not in ('%>', '-%>'):
                        yield idx, Other, tag
                    else:
                        yield idx, Comment.Preproc, tag
                    idx += len(tag)
                    state = 0
        except IndexError:
            return
426676
def _normalize_options(options)
        _normalize_text(options)

        if options[:html]
          options[:html] = ERB::Util.html_escape(options[:html])
        end

        if options[:status]
          options[:status] = Rack::Utils.status_code(options[:status])
        end

        super
      end
313960
def tag!(tag, *args, &block)
      ele_id = nil

      # TODO: Move this logic to the tagset so that the tagset itself can validate + raise when invalid
      if @auto_validation && @tagset
        if !@tagset.tagset.has_key?(tag)
          raise InvalidXhtmlError, "no element `#{tag}' for #{tagset.doctype}"
        elsif args.last.respond_to?(:to_hash)
          attrs = args.last.to_hash

          if @tagset.forms.include?(tag) && attrs[:id]
            attrs[:name] ||= attrs[:id]
          end

          attrs.each do |k, v|
            atname = k.to_s.downcase.intern

            unless k =~ /:/ or @tagset.tagset[tag].include?(atname) or (@tagset == Markaby::HTML5 && atname.to_s =~ /^data-/)
              raise InvalidXhtmlError, "no attribute `#{k}' on #{tag} elements"
            end

            if atname == :id
              ele_id = v.to_s

              if @used_ids.has_key? ele_id
                raise InvalidXhtmlError, "id `#{ele_id}' already used (id's must be unique)."
              end
            end

            if AttrsBoolean.include? atname
              if v
                attrs[k] = atname.to_s
              else
                attrs.delete k
              end
            end
          end
        end
      end

      if block
        str = capture(&block)
        block = proc { text(str) }
      end

      f = fragment { @builder.tag!(tag, *args, &block) }
      @used_ids[ele_id] = f if ele_id
      f
    end
575880
def hash_for_railsbp(error)
        {
          'linter' => error['message'].gsub(/\((.*)\)/, '').strip.parameterize('_').camelize,
          'severity' => 'warning',
          'reason' => error['message'],
          'column' => 0,
          'line' => error['line_number'].to_i
        }
      end
1244951
def fix_cdata(body)
      # <![CDATA[ = &lt;![CDATA[
      # ]]> =  ]]&gt;
      if !body.nil? && body.include?('&lt;![CDATA[')
        body.gsub! '&lt;![CDATA[', '<![CDATA['
        body.gsub! ']]&gt', ']]>'
      end
      body
    end
70885
def splits(cls, fields, root=".data", train="en-ud-tag.v2.train.txt",
               validation="en-ud-tag.v2.dev.txt",
               test="en-ud-tag.v2.test.txt", **kwargs):
        

        return super(UDPOS, cls).splits(
            fields=fields, root=root, train=train, validation=validation,
            test=test, **kwargs)
215975
def escape_wildcards(unescaped)
      case ActiveRecord::Base.connection.adapter_name
      when "Mysql2".freeze, "PostgreSQL".freeze
        # Necessary for PostgreSQL and MySQL
        unescaped.to_s.gsub(/([\\%_.])/, '\\\\\\1')
      else
        unescaped
      end
    end
43330
function split (str) {
  if (typeof str !== 'string') throw new TypeError('str is required!');

  if (regex.yaml.test(str)) return splitYAML(str);
  if (regex.comments.test(str)) return splitComments(str);

  return {
    content: str
  };
}
164146
def parse_ruby_code(outer_delimiters)
      code = String.new
      end_re = if outer_delimiters.is_a?(Regexp)
                 outer_delimiters
               else
                 /\A\s*[#{Regexp.escape outer_delimiters.to_s}]/
               end
      delimiters = []
      string_start_quote_char = nil

      until @line.empty? || (delimiters.empty? && @line =~ end_re)
        char = @line[0]

        # backslash escaped delimiter
        if char == '\\' && RUBY_ALL_DELIMITERS.include?(@line[1])
          code << @line.slice!(0, 2)
          next
        end

        case char
        when RUBY_START_DELIMITERS_RE
          if RUBY_NOT_NESTABLE_DELIMITERS.include?(char) && delimiters.last == char
            # end char of not nestable delimiter
            delimiters.pop
            string_start_quote_char = nil
          else
            # diving into nestable delimiters
            delimiters << char if string_start_quote_char.nil?

            # mark start char of the not nestable delimiters, for example strings
            if RUBY_NOT_NESTABLE_DELIMITERS.include?(char) && string_start_quote_char.nil?
              string_start_quote_char = char
            end
          end

        when RUBY_END_DELIMITERS_RE
          # rising
          delimiters.pop if char == RUBY_DELIMITERS_REVERSE[delimiters.last]
        end

        code << @line.slice!(0)
      end

      syntax_error('Unexpected end of ruby code') unless delimiters.empty?

      code.strip
    end
921701
def format_options(options):
    ''''''
    # split on one of the following tokens: ' -' or '[[' or ']]'
    lines = ['']
    for token in re.split(r'( -|\[\[|\]\])', options):
        if token in ['[[',']]']:
            lines.append(token)
            lines.append('')
        elif token == ' -':
            lines.append(token)
        else:
            lines[-1] += token
    # join all non-empty lines and wrap them into 'span'-tags
    return '<span style="display:block">' + '</span><span style="display:block">'.join(line for line in lines if line.strip()) + '</span>'
502181
def tag(tokens)
      !tokens.is_a?(Array) && !tokens.is_a?(String) &&
        raise(ArgumentError, 'tokens must be an instance of String or Array')

      j_instance.tag(tokens.to_java(:String))
    end
1002489
def tag( params )

            # TODO: make these method args if possible
            tag   = params['tag']
            attr  = params['attr']
            cdata = params['cdata']

            unless attr.kind_of?( HTML::AutoAttr )
                attr = HTML::AutoAttr.new( attr, @sorted )
            end

            # emtpy tag
            unless cdata and cdata.to_s.length
                return ( @indent * @level ) + '<' + tag + attr.to_s + ' />' + @newline
            end

            rendered  = ''
            no_indent = 0

            if cdata.kind_of?( Array )

                if cdata[0].kind_of?( Hash )
                    @level += 1
                    rendered = @newline

                    cdata.each do |hash|
                        rendered += tag( hash )
                    end
                    @level -= 1
                else
                    str = ''
                    cdata.each do |scalar|
                        str += tag( 'tag' => tag, 'attr' => attr, 'cdata' => scalar )
                    end
                    return str
                end

            elsif cdata.kind_of?( Hash )
                @level += 1
                rendered = @newline + tag( cdata )
                @level -= 1

            else
                rendered = @encode ? @encoder.encode( cdata, @encodes ) : cdata
                no_indent = 1
            end

            return (@indent * @level)  \
                + '<' + tag + attr.to_s + '>'  \
                + rendered.to_s + ( no_indent == 1 ? '' : ( @indent * @level ) )  \
                + '</' + tag + '>' + @newline

        end
651197
def render_open_tag options
      out = '<' + tag_name
      unless attributes.empty?
        attributes.each do |name,value|
          name = name.to_s.gsub('_', '-') if name.is_a? Symbol
          value = value.to_s.gsub('_', '-') if value.is_a? Symbol

          case value
          when false
            next
          when true
            if options[:format] == Rxhp::XHTML_FORMAT
              out += ' ' + name + '="' + name + '"'
            else
              out += ' ' + name
            end
          else
            out += ' ' + name.to_s + '="' + html_escape(value.to_s) + '"'
          end
        end
      end

      if options[:format] == Rxhp::XHTML_FORMAT && !children?
        out + ' />'
      else
        out + '>'
      end
    end
146936
def parse(data = nil)
      data ||= @raw_data
    
      # wrapper array holding hashes of css tags/rules
      css_out = []
      # clear initial spaces
      data.strip_side_space!.strip_space!
    
      # split on end of assignments
      data.split('}').each_with_index do |assignments, index|
        # split again to separate tags from rules
        tags, styles = assignments.split('{').map{|a| a.strip_side_space!}
        unless styles.blank?
          # clean up tags and apply namespaces as needed
          tags.strip_selector_space!
          tags.gsub!(/\./, ".#{namespace}") unless namespace.blank?
      
          # split on semicolon to iterate through each rule
          rules = []
          styles.split(';').each do |key_val_pair|
            unless key_val_pair.nil?
              # split by property/val and append to rules array with correct declaration
              property, value = key_val_pair.split(':', 2).map{|kv| kv.strip_side_space!}
              break unless property && value
              rules << "#{property}:#{value};"
            end
          end
          # now keeps track of index as hashes don't keep track of position (which will be fixed in Ruby 1.9)
          css_out << {:tags => tags, :rules => rules.join, :idx => index} unless tags.blank? || rules.to_s.blank?
        end
      end
      css_out
    end
167142
def characters
      return non_excerpted_text if @charcount < @settings[:characters]
      html_count = char_count = 0
      tags_entities = /#{Regexp.union(/(<[a-z0-9]{1,}\b[^>]*>)/,/(<\/[a-z0-9]{1,}>)/,/(&[^\s]*;)/)}/io
      @body.split(tags_entities).each do |piece|
        if piece =~ tags_entities
          html_count += piece.length
        else
          chars_left = @settings[:characters] - char_count
          # NOTE Do I want to count spaces or not?
          piece.split(/\b/).each{|p|
            break if (char_count >= @settings[:characters])
            char_count += p.length
          }
        end
        break if (char_count >= @settings[:characters])
      end 
      text = clean(@body[0...(html_count+char_count)])
      close_tags(text)
    end
54882
public void invokeTaglib(final IJRubyContext rcon, JellyContext context, XMLOutput output, String uri, String localName, Map<RubySymbol,?> attributes, final RubyProc proc) throws JellyException {
        TagScript tagScript = createTagScript(context, uri, localName);

        if (attributes!=null) {
            for (Entry<RubySymbol, ?> e : attributes.entrySet()) {
                tagScript.addAttribute(e.getKey().asJavaString(), new ConstantExpression(e.getValue()));
            }
        }
        
        if (proc!=null) {
            final Ruby runtime = ((IRubyObject)rcon).getRuntime();

            tagScript.setTagBody(new Script() {
                public Script compile() throws JellyException {
                    return this;
                }

                public void run(JellyContext context, XMLOutput output) throws JellyTagException {
                    JellyContext oc = rcon.getJellyContext();
                    XMLOutput oo = rcon.getOutput();
                    try {
                        rcon.setJellyContext(context);
                        rcon.setOutput(output);
                        proc.getBlock().yield(runtime.getCurrentContext(),null);
                    } finally {
                        rcon.setJellyContext(oc);
                        rcon.setOutput(oo);
                    }
                }
            });
        }
        tagScript.run(context, output);
    }
177192
def convert(key, block = nil)
      if block.nil? or block.call(key)
        img_tag(key)
      else
        ":#{key}:"
      end
    end