1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

Mark a whole bunch of stuff that shouldn't be publically visible as private.

This commit is contained in:
Nathan Weizenbaum 2010-01-17 16:46:21 -08:00
parent 14c4a88651
commit 9322af3996
10 changed files with 52 additions and 0 deletions

View file

@ -4,4 +4,5 @@
--default-return ""
--hide-void-return
--protected
--no-private
--no-highlight

View file

@ -462,6 +462,7 @@ END
end
# Characters that need to be escaped to HTML entities from user input
# @private
HTML_ESCAPE = { '&'=>'&amp;', '<'=>'&lt;', '>'=>'&gt;', '"'=>'&quot;', "'"=>'&#039;', }
# Returns a copy of `text` with ampersands, angle brackets and quotes

View file

@ -47,6 +47,7 @@ end
# Haml monkeypatches various Hpricot classes
# to add methods for conversion to Haml.
# @private
module Hpricot
# @see Hpricot
module Node
@ -102,9 +103,11 @@ module Haml
end
alias_method :to_haml, :render
# @private
TEXT_REGEXP = /^(\s*).*$/
# @see Hpricot
# @private
class ::Hpricot::Doc
# @see Haml::HTML::Node#to_haml
def to_haml(tabs, options)
@ -113,6 +116,7 @@ module Haml
end
# @see Hpricot
# @private
class ::Hpricot::XMLDecl
# @see Haml::HTML::Node#to_haml
def to_haml(tabs, options)
@ -121,6 +125,7 @@ module Haml
end
# @see Hpricot
# @private
class ::Hpricot::CData
# @see Haml::HTML::Node#to_haml
def to_haml(tabs, options)
@ -129,6 +134,7 @@ module Haml
end
# @see Hpricot
# @private
class ::Hpricot::DocType
# @see Haml::HTML::Node#to_haml
def to_haml(tabs, options)
@ -160,6 +166,7 @@ module Haml
end
# @see Hpricot
# @private
class ::Hpricot::Comment
# @see Haml::HTML::Node#to_haml
def to_haml(tabs, options)
@ -168,6 +175,7 @@ module Haml
end
# @see Hpricot
# @private
class ::Hpricot::Elem
# @see Haml::HTML::Node#to_haml
def to_haml(tabs, options)

View file

@ -8,46 +8,60 @@ module Haml
include Haml::Util
# Designates an XHTML/XML element.
# @private
ELEMENT = ?%
# Designates a `<div>` element with the given class.
# @private
DIV_CLASS = ?.
# Designates a `<div>` element with the given id.
# @private
DIV_ID = ?#
# Designates an XHTML/XML comment.
# @private
COMMENT = ?/
# Designates an XHTML doctype or script that is never HTML-escaped.
# @private
DOCTYPE = ?!
# Designates script, the result of which is output.
# @private
SCRIPT = ?=
# Designates script that is always HTML-escaped.
# @private
SANITIZE = ?&
# Designates script, the result of which is flattened and output.
# @private
FLAT_SCRIPT = ?~
# Designates script which is run but not output.
# @private
SILENT_SCRIPT = ?-
# When following SILENT_SCRIPT, designates a comment that is not output.
# @private
SILENT_COMMENT = ?#
# Designates a non-parsed line.
# @private
ESCAPE = ?\\
# Designates a block of filtered text.
# @private
FILTER = ?:
# Designates a non-parsed line. Not actually a character.
# @private
PLAIN_TEXT = -1
# Keeps track of the ASCII values of the characters that begin a
# specially-interpreted line.
# @private
SPECIAL_CHARACTERS = [
ELEMENT,
DIV_CLASS,
@ -64,6 +78,7 @@ module Haml
# The value of the character that designates that a line is part
# of a multiline string.
# @private
MULTILINE_CHAR_VALUE = ?|
# Regex to match keywords that appear in the middle of a Ruby block
@ -79,12 +94,15 @@ module Haml
#
# The block is ended after `%p no!`, because `else`
# is a member of this array.
# @private
MID_BLOCK_KEYWORD_REGEX = /^-\s*(#{%w[else elsif rescue ensure when end].join('|')})\b/
# The Regex that matches a Doctype command.
# @private
DOCTYPE_REGEX = /(\d(?:\.\d)?)?[\s]*([a-z]*)/i
# The Regex that matches a literal string or symbol value
# @private
LITERAL_VALUE_REGEX = /:(\w*)|(["'])((?![\\#]|\2).|\\.)*\2/
private
@ -124,6 +142,7 @@ END
end.join(';') + ';'
end
# @private
class Line < Struct.new(:text, :unstripped, :full, :index, :precompiler, :eod)
alias_method :eod?, :eod

View file

@ -76,45 +76,57 @@ module Sass
end
# The character that begins a CSS property.
# @private
PROPERTY_CHAR = ?:
# The character that designates that
# a property should be assigned to a SassScript expression.
# @private
SCRIPT_CHAR = ?=
# The character that designates the beginning of a comment,
# either Sass or CSS.
# @private
COMMENT_CHAR = ?/
# The character that follows the general COMMENT_CHAR and designates a Sass comment,
# which is not output as a CSS comment.
# @private
SASS_COMMENT_CHAR = ?/
# The character that follows the general COMMENT_CHAR and designates a CSS comment,
# which is embedded in the CSS document.
# @private
CSS_COMMENT_CHAR = ?*
# The character used to denote a compiler directive.
# @private
DIRECTIVE_CHAR = ?@
# Designates a non-parsed rule.
# @private
ESCAPE_CHAR = ?\\
# Designates block as mixin definition rather than CSS rules to output
# @private
MIXIN_DEFINITION_CHAR = ?=
# Includes named mixin declared using MIXIN_DEFINITION_CHAR
# @private
MIXIN_INCLUDE_CHAR = ?+
# The regex that matches properties of the form `name: prop`.
# @private
PROPERTY_NEW_MATCHER = /^[^\s:"\[]+\s*[=:](\s|$)/
# The regex that matches and extracts data from
# properties of the form `name: prop`.
# @private
PROPERTY_NEW = /^([^\s=:"]+)(\s*=|:)(?:\s+|$)(.*)/
# The regex that matches and extracts data from
# properties of the form `:name prop`.
# @private
PROPERTY_OLD = /^:([^\s=:"]+)\s*(=?)(?:\s+|$)(.*)/
# The default options for Sass::Engine.

View file

@ -13,12 +13,15 @@ module Sass
# This module contains code that handles the parsing and evaluation of SassScript.
module Script
# The character that begins a variable.
# @private
VARIABLE_CHAR = ?!
# The regular expression used to parse variables.
# @private
MATCH = /^!([a-zA-Z_]\w*)\s*((?:\|\|)?=)\s*(.+)/
# The regular expression used to validate variables without matching.
# @private
VALIDATE = /^![a-zA-Z_]\w*$/
# Parses and evaluates a string of SassScript.

View file

@ -6,6 +6,7 @@ module Sass::Script
class << self; include Haml::Util; end
# A hash from color names to `[red, green, blue]` value arrays.
# @private
HTML4_COLORS = map_vals({
'black' => 0x000000,
'silver' => 0xc0c0c0,
@ -25,6 +26,7 @@ module Sass::Script
'aqua' => 0x00ffff
}) {|color| (0..2).map {|n| color >> (n << 3) & 0xff}.reverse}
# A hash from `[red, green, blue]` value arrays to color names.
# @private
HTML4_COLORS_REVERSE = map_hash(HTML4_COLORS) {|k, v| [v, k]}
# Creates a new color from RGB components.

View file

@ -22,6 +22,7 @@ module Sass
Token = Struct.new(:type, :value, :line, :offset)
# A hash from operator strings to the corresponding token types.
# @private
OPERATORS = {
'+' => :plus,
'-' => :minus,
@ -47,9 +48,11 @@ module Sass
# A list of operator strings ordered with longer names first
# so that `>` and `<` don't clobber `>=` and `<=`.
# @private
OP_NAMES = OPERATORS.keys.sort_by {|o| -o.size}
# A hash of regular expressions that are used for tokenizing.
# @private
REGULAR_EXPRESSIONS = {
:whitespace => /\s*/,
:variable => /!(\w+)/,

View file

@ -351,7 +351,9 @@ module Sass::Script
end
# A hash of unit names to their index in the conversion table
# @private
CONVERTABLE_UNITS = {"in" => 0, "cm" => 1, "pc" => 2, "mm" => 3, "pt" => 4}
# @private
CONVERSION_TABLE = [[ 1, 2.54, 6, 25.4, 72 ], # in
[ nil, 1, 2.36220473, 10, 28.3464567], # cm
[ nil, nil, 1, 4.23333333, 12 ], # pc

View file

@ -6,6 +6,7 @@ module Sass::Tree
# @see Sass::Tree
class RuleNode < Node
# The character used to include the parent selector
# @private
PARENT = '&'
# The CSS selectors for this rule.