Class: Docs::Css::EntriesFilter

Inherits:
EntriesFilter show all
Defined in:
lib/docs/filters/css/entries.rb

Constant Summary collapse

DATA_TYPE_SLUGS =
%w(angle basic-shape color_value counter frequency
gradient image integer length number percentage position_value ratio
resolution shape string time timing-function uri user-ident)
FUNCTION_SLUGS =
%w(attr calc cross-fade cubic-bezier cycle element
linear-gradient radial-gradient repeating-linear-gradient
repeating-radial-gradient var)
PSEUDO_ELEMENT_SLUGS =
%w(::after ::before ::first-letter ::first-line
::selection)
VALUE_SLUGS =
%w(auto inherit initial none normal unset)
ADDITIONAL_ENTRIES =
{
        'shape' => [
%w(rect() Syntax Functions) ],
        'uri' => [
%w(url() The_url()_functional_notation Functions) ],
        'timing-function' => [
%w(cubic-bezier() The_cubic-bezier()_class_of_timing-functions Functions),
%w(steps() The_steps()_class_of_timing-functions Functions),
%w(linear linear Values),
%w(ease ease Values),
%w(ease-in ease-in Values),
%w(ease-in-out ease-in-out Values),
%w(ease-out ease-out Values),
%w(step-start step-start Values),
%w(step-end step-end Values) ],
        'color_value' => [
%w(transparent transparent_keyword Values),
%w(currentColor currentColor_keyword Values),
%w(rgb() rgb() Functions),
%w(hsl() hsl() Functions),
%w(rgba() rgba() Functions),
%w(hsla() hsla() Functions) ],
        'transform-function' => [
%w(matrix() matrix() Functions),
%w(matrix3d() matrix3d() Functions),
%w(rotate() rotate() Functions),
%w(rotate3d() rotate3d() Functions),
%w(rotateX() rotateX() Functions),
%w(rotateY() rotateY() Functions),
%w(rotateZ() rotateZ() Functions),
%w(scale() scale() Functions),
%w(scale3d() scale3d() Functions),
%w(scaleX() scaleX() Functions),
%w(scaleY() scaleY() Functions),
%w(scaleZ() scaleZ() Functions),
%w(skew() skew() Functions),
%w(skewX() skewX() Functions),
%w(skewY() skewY() Functions),
%w(translate() translate() Functions),
%w(translate3d() translate3d() Functions),
%w(translateX() translateX() Functions),
%w(translateY() translateY() Functions),
%w(translateZ() translate(Z) Functions) ]}

Constants inherited from Filter

Filter::SCHEME_RGX

Instance Method Summary collapse

Methods inherited from EntriesFilter

#build_entries, #build_entry, #call, #default_entry, #entries, #include_default_entry?, #name, #path, #type

Methods inherited from Filter

#absolute_url_string?, #at_css, #at_xpath, #base_url, #css, #current_url, #fragment_url_string?, #initial_page?, #parse_html, #relative_url_string?, #root_page?, #root_path, #root_url, #slug, #subpath, #subpath_to, #xpath

Instance Method Details

#additional_entriesObject


87
88
89
# File 'lib/docs/filters/css/entries.rb', line 87

def additional_entries
  ADDITIONAL_ENTRIES[slug] || []
end

#get_nameObject


61
62
63
64
65
66
67
# File 'lib/docs/filters/css/entries.rb', line 61

def get_name
  case type
  when 'Data Types' then "<#{super.remove ' value'}>"
  when 'Functions'  then "#{super}()"
  else super
  end
end

#get_typeObject


69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/docs/filters/css/entries.rb', line 69

def get_type
  if slug.end_with? 'selectors'
    'Selectors'
  elsif slug.start_with? ':'
    PSEUDO_ELEMENT_SLUGS.include?(slug) ? 'Pseudo-elements' : 'Pseudo-classes'
  elsif slug.start_with? '@'
    'At-rules'
  elsif DATA_TYPE_SLUGS.include?(slug)
    'Data Types'
  elsif FUNCTION_SLUGS.include?(slug)
    'Functions'
  elsif VALUE_SLUGS.include?(slug)
    'Values'
  else
    'Properties'
  end
end