Module: Haml::Precompiler

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

Overview

Handles the internal pre-compilation from Haml into Ruby code, which then runs the final creation of the HTML string.

Defined Under Namespace

Classes: Line

Constant Summary collapse

ELEMENT =

Designates an XHTML/XML element.

?%
DIV_CLASS =

Designates a

element with the given class.

?.
DIV_ID =

Designates a

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
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
]
MULTILINE_CHAR_VALUE =

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

?|
MID_BLOCK_KEYWORD_REGEX =

Regex to match keywords that appear in the middle of a Ruby block with lowered indentation. If a block has been started using indentation, lowering the indentation with one of these won't end the block. For example:

  • if foo %p yes!
  • else %p no!

The block is ended after %p no!, because else is a member of this array.

/^-\s*(#{%w[else elsif rescue ensure when end].join('|')})\b/
DOCTYPE_REGEX =

The Regex that matches a Doctype command.

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

The Regex that matches a literal string or symbol value

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

Constants included from Util

Util::RUBY_VERSION

Method Summary

Methods included from Util

#check_encoding, #def_static_method, #enum_with_index, #has?, #map_hash, #map_keys, #map_vals, #merge_adjacent_strings, #powerset, #ruby1_8?, #scope, #static_method_name, #to_hash