Module: Haml::Parser

Includes:
Util
Included in:
Engine
Defined in:
lib/haml/parser.rb

Constant Summary collapse

ELEMENT =

Designates an XHTML/XML element.

?%
DIV_CLASS =

Designates a <div> element with the given class.

?.
DIV_ID =

Designates a <div> element with the given id.

?#
COMMENT =

Designates an XHTML/XML comment.

?/
DOCTYPE =

Designates an XHTML doctype or script that is never HTML-escaped.

?!
SCRIPT =

Designates script, the result of which is output.

?=
SANITIZE =

Designates script that is always HTML-escaped.

?&
FLAT_SCRIPT =

Designates script, the result of which is flattened and output.

?~
SILENT_SCRIPT =

Designates script which is run but not output.

?-
SILENT_COMMENT =

When following SILENT_SCRIPT, designates a comment that is not output.

?#
ESCAPE =

Designates a non-parsed line.

?\\
FILTER =

Designates a block of filtered text.

?:
PLAIN_TEXT =

Designates a non-parsed line. Not actually a character.

-1
HAML_EJS =

Designates a piece of client-side ejs functionality

"^"
HAML_EJS_INTERPOLATE =

Designates a client-side interpolated ejs value

/^#{Regexp.escape(HAML_EJS)}=\s+(.*)$/
HAML_EJS_CONDITIONAL =

Designates a client-side conditional ejs block

/^#{Regexp.escape(HAML_EJS)}if\s+(.*)$/
HAML_EJS_NEGATED_CONDITIONAL =

Designates a client-side negated conditional ejs block

/^#{Regexp.escape(HAML_EJS)}unless\s+(.*)$/
HAML_EJS_ELSEIF_CONDITIONAL =

Designates a client-side negated conditional ejs block

/^#{Regexp.escape(HAML_EJS)}elsif\s+(.*)$/
HAML_EJS_ELSE_CONDITIONAL =

Designates a client-side negated conditional ejs block

/^#{Regexp.escape(HAML_EJS)}else\s*$/
HAML_EJS_ITERATE =

Designates a client-side iteration ejs block

/^#{Regexp.escape(HAML_EJS)}each\s+(.*)$/
SPECIAL_CHARACTERS =

Keeps track of the ASCII values of the characters that begin a specially-interpreted line.

[
  ELEMENT,
  DIV_CLASS,
  DIV_ID,
  COMMENT,
  DOCTYPE,
  SCRIPT,
  SANITIZE,
  FLAT_SCRIPT,
  SILENT_SCRIPT,
  ESCAPE,
  FILTER,
  HAML_EJS
]
MULTILINE_CHAR_VALUE =

The value of the character that designates that a line is part of a multiline string.

?|
MID_BLOCK_KEYWORDS =
%w[else elsif rescue ensure end when]
START_BLOCK_KEYWORDS =
%w[if begin case]
START_BLOCK_KEYWORD_REGEX =

Try to parse assignments to block starters as best as possible

/(?:\w+(?:,\s*\w+)*\s*=\s*)?(#{START_BLOCK_KEYWORDS.join('|')})/
BLOCK_KEYWORD_REGEX =
/^-\s*(?:(#{MID_BLOCK_KEYWORDS.join('|')})|#{START_BLOCK_KEYWORD_REGEX.source})\b/
HAML_EJS_BLOCK_KEYWORD_REGEX =
/^#{Regexp.escape(HAML_EJS)}(if|else|elsif|unless)\s*/
DOCTYPE_REGEX =

The Regex that matches a Doctype command.

/(\d(?:\.\d)?)?[\s]*([a-z]*)\s*([^ ]+)?/i
LITERAL_VALUE_REGEX =

The Regex that matches a literal string or symbol value

/:(\w*)|(["'])((?![\\#]|\2).|\\.)*\2/

Constants included from Util

Util::CHARSET_REGEXPS, Util::ENCODINGS_TO_CHECK, Util::RUBY_ENGINE, Util::RUBY_VERSION

Method Summary

Methods included from Util

#abstract, #ap_geq?, #ap_geq_3?, #assert_html_safe!, #av_template_class, #caller_info, #check_encoding, #check_haml_encoding, #def_static_method, #dump, #enum_cons, #enum_slice, #enum_with_index, #flatten, #haml_warn, #has?, #html_safe, #inspect_obj, #intersperse, #ironruby?, #lcs, #load, #map_hash, #map_keys, #map_vals, #merge_adjacent_strings, #ord, #paths, #powerset, #rails_env, #rails_root, #rails_safe_buffer_class, #rails_xss_safe?, #restrict, #ruby1_8?, #ruby1_8_6?, #scope, #set_eql?, #set_hash, #silence_haml_warnings, #silence_warnings, #static_method_name, #strip_string_array, #substitute, #to_hash, #try_sass, #version_geq, #version_gt, #windows?