Skip to content
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

Merge feature.use #374

Merged
merged 23 commits into from
Oct 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,28 @@ namespace :sass do
end
end

namespace :migrator do
# Check out the latest commit of the Sass migrator into the .sass-migrator directory.
task :checkout do
unless Dir.exists?(".sass-migrator")
sh %{git clone git://github.com/sass/migrator .sass-migrator}
end

Dir.chdir(".sass-migrator") do
sh %{git fetch}
if ENV["SASS_MIGRATOR_REVISION"]
sh %{git checkout #{ENV["SASS_MIGRATOR_REVISION"]}}
else
sh %{git checkout origin/master}
end
end
end

task :version => :checkout do
add_version 'migrator', Dir.chdir(".sass-migrator") {latest_stable_tag}
end
end

namespace :libsass do
# Check out the latest commit of Dart Sass into the .libsass directory.
task :checkout do
Expand Down
6 changes: 4 additions & 2 deletions config.ru
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ use Rack::Rewrite do
r301 '/documentation/file.SASS_CHANGELOG.html', 'https://github.com/sass/dart-sass/blob/master/CHANGELOG.md'
r301 '/documentation/file.INDENTED_SYNTAX.html', '/documentation/syntax'
r301 '/documentation/file.SCSS_FOR_SASS_USERS.html', '/documentation/syntax'
r301 '/documentation/Sass/Script/Functions.html', '/documentation/functions'
r301 '/documentation/Sass/Script/Functions', '/documentation/functions'
r301 '/documentation/Sass/Script/Functions.html', '/documentation/modules'
r301 '/documentation/Sass/Script/Functions', '/documentation/modules'
r301 %r{/documentation/(Sass.*)}, 'http://www.rubydoc.info/gems/sass/$1'
r301 '/documentation/functions/css', '/documentation/at-rules/function#plain-css-functions'
r301 %r{/documentation/functions(.*)}, '/documentation/modules$1'

r301 %r{/(.+)/$}, '/$1'
r301 %r{/(.+)/index\.html$}, '/$1'
Expand Down
20 changes: 11 additions & 9 deletions data/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ toc:
- Interpolation: /documentation/interpolation
- At-Rules: /documentation/at-rules
:children:
- <code>@use</code>: /documentation/at-rules/use
- <code>@forward</code>: /documentation/at-rules/forward
- <code>@import</code>: /documentation/at-rules/import
- <code>@mixin</code> and <code>@include</code>: /documentation/at-rules/mixin
- <code>@function</code>: /documentation/at-rules/function
Expand Down Expand Up @@ -46,16 +48,15 @@ toc:
- Numeric: /documentation/operators/numeric
- String: /documentation/operators/string
- Boolean: /documentation/operators/boolean
- Built-In Functions: /documentation/functions
- Built-In Modules: /documentation/modules
:children:
- Plain CSS: /documentation/functions/css
- Numbers: /documentation/functions/math
- Strings: /documentation/functions/string
- Colors: /documentation/functions/color
- Lists: /documentation/functions/list
- Maps: /documentation/functions/map
- Selectors: /documentation/functions/selector
- Introspection: /documentation/functions/meta
- <code>sass:color</code>: /documentation/modules/color
- <code>sass:list</code>: /documentation/modules/list
- <code>sass:map</code>: /documentation/modules/map
- <code>sass:math</code>: /documentation/modules/math
- <code>sass:meta</code>: /documentation/modules/meta
- <code>sass:selector</code>: /documentation/modules/selector
- <code>sass:string</code>: /documentation/modules/string
- Breaking Changes: /documentation/breaking-changes
:children:
- Extending Compound Selectors: /documentation/breaking-changes/extend-compound
Expand All @@ -64,4 +65,5 @@ toc:
:children:
- Dart Sass: /documentation/cli/dart-sass
- Ruby Sass: /documentation/cli/ruby-sass
- Migrator: /documentation/cli/migrator
- JavaScript API: /documentation/js-api
14 changes: 8 additions & 6 deletions helpers/sass_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ def release_url(impl)
repo =
case impl
when :dart; "dart-sass"
when :migrator; "migrator"
when :libsass; "libsass"
end

Expand Down Expand Up @@ -423,7 +424,7 @@ def _impl_status_row(name, status)
]
end

# Renders API docs for a Sass function.
# Renders API docs for a Sass function (or mixin).
#
# The function's name is parsed from the signature. The API description is
# passed as a Markdown block. If `returns` is passed, it's included as the
Expand All @@ -434,7 +435,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}
Expand All @@ -446,9 +448,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}
name_element.add_class ".docSearch-function"
name_element['name'] = name
end
Expand Down Expand Up @@ -490,7 +492,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'
else raise "Unknown type #{type}"
end
end.join(" | ")
Expand Down
183 changes: 100 additions & 83 deletions source/assets/js/components/redirect.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -97,93 +97,110 @@ 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",
"#darken-instance_method": "/documentation/modules/color#darken",
"#desaturate-instance_method": "/documentation/modules/color#desaturate",
"#feature_exists-instance_method": "/documentation/modules/meta#feature-exists",
"#floor-instance_method": "/documentation/modules/math#floor",
"#get_function-instance_method": "/documentation/modules/meta#get-function",
"#global_variable_exists-instance_method": "/documentation/modules/meta#global-variable-exists",
"#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",
"#is_superselector-instance_method": "/documentation/modules/selector#is-superselector",
"#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",
"#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",
"#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",
"#selector_extend-instance_method": "/documentation/modules/selector#extend",
"#selector_nest-instance_method": "/documentation/modules/selector#nest",
"#selector_parse-instance_method": "/documentation/modules/selector#parse",
"#selector_replace-instance_method": "/documentation/modules/selector#replace",
"#selector_unify-instance_method": "/documentation/modules/selector#unify",
"#set-instance_method": "/documentation/modules/list#set",
"#simple_selectors-instance_method": "/documentation/modules/selector#simple-selectors",
"#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",
"#to_upper_case-instance_method": "/documentation/modules/string#to-upper-case",
"#transparentize-instance_method": "/documentation/modules/color#transparentize",
"#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",
"#zip-instance_method": "/documentation/modules/list#zip"
};

var redirect = redirects[window.location.hash];
if (redirect) window.location.href = redirect;
} 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];
if (redirect) window.location.href = redirect;
} else if (window.location.pathname == "/documentation/modules/map") {
var redirects = {
"#keywords": "/documentation/modules/meta#keywords"
};

var redirect = redirects[window.location.hash];
Expand Down
Loading