Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Whitelist rather than blacklist constants.

  • Loading branch information...
commit bb6765a37d5bd35d17459b6a5d22ad1bfd32daf4 1 parent 7f10fc5
Natalie Weizenbaum nex3 authored
1  .yardopts
View
@@ -4,6 +4,7 @@
--default-return ""
--title "Haml/Sass Documentation"
--query 'object.type != :classvariable'
+--query 'object.type != :constant || @api && @api.text == "public"'
--hide-void-return
--protected
--no-private
1  lib/haml.rb
View
@@ -17,6 +17,7 @@ module Haml
# A string representing the version of Haml.
# A more fine-grained representation is available from Haml.version.
+ # @api public
VERSION = version[:string] unless defined?(Haml::VERSION)
# Initializes Haml for Rails.
1  lib/haml/exec.rb
View
@@ -115,7 +115,6 @@ def process_result
@options[:input], @options[:output] = input, output
end
- # @private
COLORS = { :red => 31, :green => 32, :yellow => 33 }
# Prints a status message about performing the given action,
1  lib/haml/filters.rb
View
@@ -327,6 +327,7 @@ def render(text)
end
# An alias for the Textile filter,
# since the only available Textile parser is RedCloth.
+ # @api public
RedCloth = Textile
Filters.defined['redcloth'] = RedCloth
1  lib/haml/helpers.rb
View
@@ -500,7 +500,6 @@ def haml_tag(name, *rest, &block)
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
1  lib/haml/html.rb
View
@@ -146,7 +146,6 @@ def render
end
alias_method :to_haml, :render
- # @private
TEXT_REGEXP = /^(\s*).*$/
# @see Hpricot
18 lib/haml/precompiler.rb
View
@@ -8,60 +8,46 @@ module Precompiler
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,
@@ -78,7 +64,6 @@ module Precompiler
# 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
@@ -94,15 +79,12 @@ module Precompiler
#
# 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
1  lib/haml/root.rb
View
@@ -2,5 +2,6 @@ module Haml
# The root directory of the Haml source tree.
# This may be overridden by the package manager
# if the lib directory is separated from the main source tree.
+ # @api public
ROOT_DIR = File.expand_path("../../..", __FILE__)
end
1  lib/haml/util.rb
View
@@ -10,6 +10,7 @@ module Util
extend self
# An array of ints representing the Ruby version number.
+ # @api public
RUBY_VERSION = ::RUBY_VERSION.split(".").map {|s| s.to_i}
# Returns the path of a file relative to the Haml root directory.
1  lib/sass.rb
View
@@ -16,6 +16,7 @@ module Sass
# A string representing the version of Sass.
# A more fine-grained representation is available from {Haml::Version#version Sass.version}.
+ # @api public
VERSION = version[:string] unless defined?(Sass::VERSION)
end
15 lib/sass/engine.rb
View
@@ -79,60 +79,49 @@ def comment?
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.
+ # @api public
DEFAULT_OPTIONS = {
:style => :nested,
:load_paths => ['.'],
@@ -562,7 +551,6 @@ def parse_else(parent, line, text)
nil
end
- # @private
MIXIN_DEF_RE = /^(?:=|@mixin)\s*(#{Sass::SCSS::RX::IDENT})(.*)$/
def parse_mixin_definition(line)
name, arg_string = line.text.scan(MIXIN_DEF_RE).first
@@ -575,7 +563,6 @@ def parse_mixin_definition(line)
Tree::MixinDefNode.new(name, args)
end
- # @private
MIXIN_INCLUDE_RE = /^(?:\+|@include)\s*(#{Sass::SCSS::RX::IDENT})(.*)$/
def parse_mixin_include(line, root)
name, arg_string = line.text.scan(MIXIN_INCLUDE_RE).first
2  lib/sass/script.rb
View
@@ -13,11 +13,9 @@ module Sass
# This module contains code that handles the parsing and evaluation of SassScript.
module Script
# The regular expression used to parse variables.
- # @private
MATCH = /^[!\$](#{Sass::SCSS::RX::IDENT})\s*((?:\|\|)?=|:)\s*(.+?)(!(?i:default))?$/
# The regular expression used to validate variables without matching.
- # @private
VALIDATE = /^[!\$]#{Sass::SCSS::RX::IDENT}$/
# Parses a string of SassScript
2  lib/sass/script/color.rb
View
@@ -19,7 +19,6 @@ class Color < Literal
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,
@@ -39,7 +38,6 @@ class << self; include Haml::Util; end
'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]}
# Constructs an RGB or HSL color object,
6 lib/sass/script/lexer.rb
View
@@ -40,7 +40,6 @@ class Lexer
attr_reader :offset
# A hash from operator strings to the corresponding token types.
- # @private
OPERATORS = {
'+' => :plus,
'-' => :minus,
@@ -67,10 +66,8 @@ class Lexer
'{' => :lcurly,
}
- # @private
OPERATORS_REVERSE = Haml::Util.map_hash(OPERATORS) {|k, v| [v, k]}
- # @private
TOKEN_NAMES = Haml::Util.map_hash(OPERATORS_REVERSE) {|k, v| [k, v.inspect]}.merge({
:const => "variable (e.g. $foo)",
:ident => "identifier (e.g. middle)",
@@ -79,16 +76,13 @@ class Lexer
# 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 sub-list of {OP_NAMES} that only includes operators
# with identifier names.
- # @private
IDENT_OP_NAMES = OP_NAMES.select {|k, v| k =~ /^\w+/}
# A hash of regular expressions that are used for tokenizing.
- # @private
REGULAR_EXPRESSIONS = {
:whitespace => /\s+/,
:comment => COMMENT,
3  lib/sass/script/number.rb
View
@@ -30,6 +30,7 @@ class Number < Literal
# The precision with which numbers will be printed to CSS files.
# For example, if this is `1000.0`,
# `3.1415926` will be printed as `3.142`.
+ # @api public
PRECISION = 1000.0
# @param value [Numeric] The value of the number
@@ -381,9 +382,7 @@ def normalize!
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
1  lib/sass/script/parser.rb
View
@@ -120,7 +120,6 @@ def self.parse(*args)
new(*args).parse
end
- # @private
PRECEDENCE = [
:comma, :single_eq, :concat, :or, :and,
[:eq, :neq],
2  lib/sass/script/string.rb
View
@@ -15,7 +15,7 @@ class String < Literal
# @return [Symbol] `:string` or `:identifier`
attr_reader :type
- # In addition to setting the {#context} of the string,
+ # In addition to setting the \{#context} of the string,
# this sets the string to be an identifier if the context is `:equals`.
#
# @see Node#context=
3  lib/sass/scss/parser.rb
View
@@ -99,7 +99,6 @@ def process_comment(text, node)
node << comment
end
- # @private
DIRECTIVES = Set[:mixin, :include, :debug, :warn, :for, :while, :if, :import, :media]
def directive
@@ -639,7 +638,6 @@ def sass_script(*args)
result
end
- # @private
EXPR_NAMES = {
:media_query => "media query (e.g. print, screen, print and screen)",
:media_expr => "media expression (e.g. (min-device-width: 800px)))",
@@ -649,7 +647,6 @@ def sass_script(*args)
:expr => "expression (e.g. 1px, bold)",
}
- # @private
TOK_NAMES = Haml::Util.to_hash(
Sass::SCSS::RX.constants.map {|c| [Sass::SCSS::RX.const_get(c), c.downcase]}).
merge(IDENT => "identifier", /[;}]/ => '";"', /[=:]/ => '":"')
1  lib/sass/tree/rule_node.rb
View
@@ -7,7 +7,6 @@ module Sass::Tree
# @see Sass::Tree
class RuleNode < Node
# The character used to include the parent selector
- # @private
PARENT = '&'
# The CSS selector for this rule,
Please sign in to comment.
Something went wrong with that request. Please try again.