-
Notifications
You must be signed in to change notification settings - Fork 233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Module-ify built-in function documentation #366
Changes from all commits
0295203
df428f6
b1b0754
576474c
d46c2c7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -434,7 +434,8 @@ def _impl_status_row(name, status) | |
def function(*signatures, returns: nil) | ||
names = Set.new | ||
highlighted_signatures = signatures.map do |signature| | ||
name = signature.split("(").first | ||
name, rest = signature.split("(", 2) | ||
name_without_namespace = name.split(".").last | ||
html = Nokogiri::HTML(_render_markdown(<<MARKDOWN)) | ||
```scss | ||
@function #{signature} | ||
|
@@ -446,9 +447,9 @@ def function(*signatures, returns: nil) | |
take_while {|el| el.text != "{}"}[1...-1] | ||
|
||
# Add a class to make it easier to index function documentation. | ||
unless names.include?(name) | ||
names << name | ||
name_element = signature_elements.find {|el| el.text == name} | ||
unless names.include?(name_without_namespace) | ||
names << name_without_namespace | ||
name_element = signature_elements.find {|el| el.text == name_without_namespace} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Style/CollectionMethods: Prefer detect over find. |
||
name_element.add_class ".docSearch-function" | ||
name_element['name'] = name | ||
end | ||
|
@@ -490,7 +491,7 @@ def return_type_link(return_type) | |
when 'boolean'; link_to type, '/documentation/values/booleans' | ||
when 'null'; link_to '<code>null</code>', '/documentation/values/null' | ||
when 'function'; link_to type, '/documentation/values/functions' | ||
when 'selector'; link_to type, '/documentation/functions/selector#selector-values' | ||
when 'selector'; link_to type, '/documentation/modules/selector#selector-values' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping. |
||
else raise "Unknown type #{type}" | ||
end | ||
end.join(" | ") | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,9 +34,9 @@ if (window.location.hash) { | |
"#color_operations": "/documentation/operators/color", | ||
"#string_operations": "/documentation/operators/string", | ||
"#boolean_operations": "/documentation/operators/boolean", | ||
"#list_operations": "/documentation/functions/list", | ||
"#list_operations": "/documentation/modules/list", | ||
"#parentheses": "/documentation/operators#parentheses", | ||
"#functions": "/documentation/functions", | ||
"#functions": "/documentation/modules", | ||
"#keyword_arguments": "/documentation/at-rules/function#keyword-arguments", | ||
"#interpolation_": "/documentation/interpolation", | ||
"#parent-script": "/documentation/style-rules/parent-selector#in-sassscript", | ||
|
@@ -97,93 +97,103 @@ if (window.location.hash) { | |
} | ||
|
||
if (redirect) window.location.href = redirect; | ||
} else if (window.location.pathname == "/documentation/functions") { | ||
} else if (window.location.pathname == "/documentation/modules") { | ||
var redirects = { | ||
"#declare-class_method": "/ruby-sass", | ||
"#random_number_generator-class_method": "/ruby-sass", | ||
"#random_seed=-class_method": "/ruby-sass", | ||
"#signature-class_method": "/ruby-sass", | ||
"#abs-instance_method": "/documentation/functions/math#abs", | ||
"#adjust_color-instance_method": "/documentation/functions/color#adjust-color", | ||
"#adjust_hue-instance_method": "/documentation/functions/color#adjust-hue", | ||
"#alpha-instance_method": "/documentation/functions/color#alpha", | ||
"#append-instance_method": "/documentation/functions/list#append", | ||
"#blue-instance_method": "/documentation/functions/color#blue", | ||
"#call-instance_method": "/documentation/functions/meta#call", | ||
"#ceil-instance_method": "/documentation/functions/math#ceil", | ||
"#change_color-instance_method": "/documentation/functions/color#change-color", | ||
"#comparable-instance_method": "/documentation/functions/math#comparable", | ||
"#complement-instance_method": "/documentation/functions/color#complement", | ||
"#content_exists-instance_method": "/documentation/functions/meta#content-exists", | ||
"#darken-instance_method": "/documentation/functions/color#darken", | ||
"#desaturate-instance_method": "/documentation/functions/color#desaturate", | ||
"#feature_exists-instance_method": "/documentation/functions/meta#feature-exists", | ||
"#floor-instance_method": "/documentation/functions/math#floor", | ||
"#get_function-instance_method": "/documentation/functions/meta#get-function", | ||
"#global_variable_exists-instance_method": "/documentation/functions/meta#global-variable-exists", | ||
"#grayscale-instance_method": "/documentation/functions/color#grayscale", | ||
"#green-instance_method": "/documentation/functions/color#green", | ||
"#hsl-instance_method": "/documentation/functions/color#hsl", | ||
"#hsla-instance_method": "/documentation/functions/color#hsla", | ||
"#hue-instance_method": "/documentation/functions/color#hue", | ||
"#ie_hex_str-instance_method": "/documentation/functions/color#ie-hex-str", | ||
"#abs-instance_method": "/documentation/modules/math#abs", | ||
"#adjust_color-instance_method": "/documentation/modules/color#adjust", | ||
"#adjust_hue-instance_method": "/documentation/modules/color#adjust-hue", | ||
"#alpha-instance_method": "/documentation/modules/color#alpha", | ||
"#append-instance_method": "/documentation/modules/list#append", | ||
"#blue-instance_method": "/documentation/modules/color#blue", | ||
"#call-instance_method": "/documentation/modules/meta#call", | ||
"#ceil-instance_method": "/documentation/modules/math#ceil", | ||
"#change_color-instance_method": "/documentation/modules/color#change", | ||
"#comparable-instance_method": "/documentation/modules/math#compatible", | ||
"#complement-instance_method": "/documentation/modules/color#complement", | ||
"#content_exists-instance_method": "/documentation/modules/meta#content-exists", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. |
||
"#darken-instance_method": "/documentation/modules/color#darken", | ||
"#desaturate-instance_method": "/documentation/modules/color#desaturate", | ||
"#feature_exists-instance_method": "/documentation/modules/meta#feature-exists", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. |
||
"#floor-instance_method": "/documentation/modules/math#floor", | ||
"#get_function-instance_method": "/documentation/modules/meta#get-function", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. |
||
"#global_variable_exists-instance_method": "/documentation/modules/meta#global-variable-exists", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. |
||
"#grayscale-instance_method": "/documentation/modules/color#grayscale", | ||
"#green-instance_method": "/documentation/modules/color#green", | ||
"#hsl-instance_method": "/documentation/modules/color#hsl", | ||
"#hsla-instance_method": "/documentation/modules/color#hsla", | ||
"#hue-instance_method": "/documentation/modules/color#hue", | ||
"#ie_hex_str-instance_method": "/documentation/modules/color#ie-hex-str", | ||
"#if-instance_method": "/documentation/#if", | ||
"#index-instance_method": "/documentation/functions/list#index", | ||
"#inspect-instance_method": "/documentation/functions/meta#inspect", | ||
"#invert-instance_method": "/documentation/functions/color#invert", | ||
"#is_bracketed-instance_method": "/documentation/functions/list#is-bracketed", | ||
"#is_superselector-instance_method": "/documentation/functions/selector#is-superselector", | ||
"#join-instance_method": "/documentation/functions/list#join", | ||
"#keywords-instance_method": "/documentation/functions/meta#keywords", | ||
"#length-instance_method": "/documentation/functions/list#length", | ||
"#lighten-instance_method": "/documentation/functions/color#lighten", | ||
"#lightness-instance_method": "/documentation/functions/color#lightness", | ||
"#list_separator-instance_method": "/documentation/functions/list#list-separator", | ||
"#map_get-instance_method": "/documentation/functions/map#map-get", | ||
"#map_has_key-instance_method": "/documentation/functions/map#map-has-key", | ||
"#map_keys-instance_method": "/documentation/functions/map#map-keys", | ||
"#map_merge-instance_method": "/documentation/functions/map#map-merge", | ||
"#map_remove-instance_method": "/documentation/functions/map#map-remove", | ||
"#map_values-instance_method": "/documentation/functions/map#map-values", | ||
"#max-instance_method": "/documentation/functions/math#max", | ||
"#min-instance_method": "/documentation/functions/math#min", | ||
"#mix-instance_method": "/documentation/functions/color#mix", | ||
"#mixin_exists-instance_method": "/documentation/functions/meta#mixin-exists", | ||
"#nth-instance_method": "/documentation/functions/list#nth", | ||
"#opacify-instance_method": "/documentation/functions/color#opacify", | ||
"#opacity-instance_method": "/documentation/functions/color#opacity", | ||
"#percentage-instance_method": "/documentation/functions/math#percentage", | ||
"#quote-instance_method": "/documentation/functions/string#quote", | ||
"#random-instance_method": "/documentation/functions/math#random", | ||
"#red-instance_method": "/documentation/functions/color#red", | ||
"#rgb-instance_method": "/documentation/functions/color#rgb", | ||
"#rgba-instance_method": "/documentation/functions/color#rgba", | ||
"#round-instance_method": "/documentation/functions/math#round", | ||
"#saturate-instance_method": "/documentation/functions/color#saturate", | ||
"#saturation-instance_method": "/documentation/functions/color#saturation", | ||
"#scale_color-instance_method": "/documentation/functions/color#scale-color", | ||
"#selector_append-instance_method": "/documentation/functions/selector#selector-append", | ||
"#selector_extend-instance_method": "/documentation/functions/selector#selector-extend", | ||
"#selector_nest-instance_method": "/documentation/functions/selector#selector-nest", | ||
"#selector_parse-instance_method": "/documentation/functions/selector#selector-parse", | ||
"#selector_replace-instance_method": "/documentation/functions/selector#selector-replace", | ||
"#selector_unify-instance_method": "/documentation/functions/selector#selector-unify", | ||
"#set-instance_method": "/documentation/functions/list#set", | ||
"#simple_selectors-instance_method": "/documentation/functions/selector#simple-selectors", | ||
"#str_index-instance_method": "/documentation/functions/string#str-index", | ||
"#str_insert-instance_method": "/documentation/functions/string#str-insert", | ||
"#str_length-instance_method": "/documentation/functions/string#str-length", | ||
"#str_slice-instance_method": "/documentation/functions/string#str-slice", | ||
"#to_lower_case-instance_method": "/documentation/functions/string#to-lower-case", | ||
"#to_upper_case-instance_method": "/documentation/functions/string#to-upper-case", | ||
"#transparentize-instance_method": "/documentation/functions/color#transparentize", | ||
"#type_of-instance_method": "/documentation/functions/meta#type-of", | ||
"#unique_id-instance_method": "/documentation/functions/string#unique-id", | ||
"#unit-instance_method": "/documentation/functions/math#unit", | ||
"#unitless-instance_method": "/documentation/functions/math#unitless", | ||
"#unquote-instance_method": "/documentation/functions/string#unquote", | ||
"#variable_exists-instance_method": "/documentation/functions/meta#variable-exists", | ||
"#zip-instance_method": "/documentation/functions/list#zip" | ||
"#index-instance_method": "/documentation/modules/list#index", | ||
"#inspect-instance_method": "/documentation/modules/meta#inspect", | ||
"#invert-instance_method": "/documentation/modules/color#invert", | ||
"#is_bracketed-instance_method": "/documentation/modules/list#is-bracketed", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. |
||
"#is_superselector-instance_method": "/documentation/modules/selector#is-superselector", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. |
||
"#join-instance_method": "/documentation/modules/list#join", | ||
"#keywords-instance_method": "/documentation/modules/meta#keywords", | ||
"#length-instance_method": "/documentation/modules/list#length", | ||
"#lighten-instance_method": "/documentation/modules/color#lighten", | ||
"#lightness-instance_method": "/documentation/modules/color#lightness", | ||
"#list_separator-instance_method": "/documentation/modules/list#separator", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. |
||
"#map_get-instance_method": "/documentation/modules/map#get", | ||
"#map_has_key-instance_method": "/documentation/modules/map#has-key", | ||
"#map_keys-instance_method": "/documentation/modules/map#keys", | ||
"#map_merge-instance_method": "/documentation/modules/map#merge", | ||
"#map_remove-instance_method": "/documentation/modules/map#remove", | ||
"#map_values-instance_method": "/documentation/modules/map#values", | ||
"#max-instance_method": "/documentation/modules/math#max", | ||
"#min-instance_method": "/documentation/modules/math#min", | ||
"#mix-instance_method": "/documentation/modules/color#mix", | ||
"#mixin_exists-instance_method": "/documentation/modules/meta#mixin-exists", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. |
||
"#nth-instance_method": "/documentation/modules/list#nth", | ||
"#opacify-instance_method": "/documentation/modules/color#opacify", | ||
"#opacity-instance_method": "/documentation/modules/color#opacity", | ||
"#percentage-instance_method": "/documentation/modules/math#percentage", | ||
"#quote-instance_method": "/documentation/modules/string#quote", | ||
"#random-instance_method": "/documentation/modules/math#random", | ||
"#red-instance_method": "/documentation/modules/color#red", | ||
"#rgb-instance_method": "/documentation/modules/color#rgb", | ||
"#rgba-instance_method": "/documentation/modules/color#rgba", | ||
"#round-instance_method": "/documentation/modules/math#round", | ||
"#saturate-instance_method": "/documentation/modules/color#saturate", | ||
"#saturation-instance_method": "/documentation/modules/color#saturation", | ||
"#scale_color-instance_method": "/documentation/modules/color#scale", | ||
"#selector_append-instance_method": "/documentation/modules/selector#append", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. |
||
"#selector_extend-instance_method": "/documentation/modules/selector#extend", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. |
||
"#selector_nest-instance_method": "/documentation/modules/selector#nest", | ||
"#selector_parse-instance_method": "/documentation/modules/selector#parse", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. |
||
"#selector_replace-instance_method": "/documentation/modules/selector#replace", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. |
||
"#selector_unify-instance_method": "/documentation/modules/selector#unify", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. |
||
"#set-instance_method": "/documentation/modules/list#set", | ||
"#simple_selectors-instance_method": "/documentation/modules/selector#simple-selectors", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. |
||
"#str_index-instance_method": "/documentation/modules/string#index", | ||
"#str_insert-instance_method": "/documentation/modules/string#insert", | ||
"#str_length-instance_method": "/documentation/modules/string#length", | ||
"#str_slice-instance_method": "/documentation/modules/string#slice", | ||
"#to_lower_case-instance_method": "/documentation/modules/string#to-lower-case", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. |
||
"#to_upper_case-instance_method": "/documentation/modules/string#to-upper-case", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. |
||
"#transparentize-instance_method": "/documentation/modules/color#transparentize", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. |
||
"#type_of-instance_method": "/documentation/modules/meta#type-of", | ||
"#unique_id-instance_method": "/documentation/modules/string#unique-id", | ||
"#unit-instance_method": "/documentation/modules/math#unit", | ||
"#unitless-instance_method": "/documentation/modules/math#is-unitless", | ||
"#unquote-instance_method": "/documentation/modules/string#unquote", | ||
"#variable_exists-instance_method": "/documentation/modules/meta#variable-exists", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. |
||
"#zip-instance_method": "/documentation/modules/list#zip" | ||
}; | ||
|
||
var redirect = redirects[window.location.hash]; | ||
if (redirect) window.location.href = redirect; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Expected '{' and instead saw 'window'. |
||
} else if (window.location.pathname == "/documentation/modules/color") { | ||
var redirects = { | ||
"#rgb": "/documentation/modules#rgb", | ||
"#rgba": "/documentation/modules#rgba", | ||
"#hsl": "/documentation/modules#hsl", | ||
"#hsla": "/documentation/modules#hsla" | ||
}; | ||
|
||
var redirect = redirects[window.location.hash]; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lint/UselessAssignment: Useless assignment to variable - rest. Use _ or _rest as a variable name to indicate that it won't be used.