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

Fix nested division #1225

Merged
merged 2 commits into from Feb 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion assets/stylesheets/bootstrap/_code.scss
Expand Up @@ -41,7 +41,7 @@ kbd {
// Blocks of code
pre {
display: block;
padding: (math.div($line-height-computed - 1), 2);
padding: math.div(($line-height-computed - 1), 2);
margin: 0 0 math.div($line-height-computed, 2);
font-size: ($font-size-base - 1); // 14px to 13px
line-height: $line-height-base;
Expand Down
10 changes: 5 additions & 5 deletions assets/stylesheets/bootstrap/_variables.scss
Expand Up @@ -335,24 +335,24 @@ $grid-gutter-width: 30px !default;
//** Point at which the navbar becomes uncollapsed.
$grid-float-breakpoint: $screen-sm-min !default;
//** Point at which the navbar begins collapsing.
$grid-float-breakpoint-max: math.div($grid-float-breakpoint - 1) !default;
$grid-float-breakpoint-max: ($grid-float-breakpoint - 1) !default;


//== Container sizes
//
//## Define the maximum width of `.container` for different screen sizes.

// Small screen, tablet
// Small screen / tablet
$container-tablet: (720px + $grid-gutter-width) !default;
//** For `$screen-sm-min` and up.
$container-sm: $container-tablet !default;

// Medium screen / desktop
$container-desktop: math.div(940px + $grid-gutter-width) !default;
$container-desktop: (940px + $grid-gutter-width) !default;
//** For `$screen-md-min` and up.
$container-md: $container-desktop !default;

// Large screen, wide desktop
// Large screen / wide desktop
$container-large-desktop: (1140px + $grid-gutter-width) !default;
//** For `$screen-lg-min` and up.
$container-lg: $container-large-desktop !default;
Expand All @@ -367,7 +367,7 @@ $navbar-height: 50px !default;
$navbar-margin-bottom: $line-height-computed !default;
$navbar-border-radius: $border-radius-base !default;
$navbar-padding-horizontal: floor(math.div($grid-gutter-width, 2)) !default;
$navbar-padding-vertical: (math.div($navbar-height - $line-height-computed), 2) !default;
$navbar-padding-vertical: math.div(($navbar-height - $line-height-computed), 2) !default;
$navbar-collapse-max-height: 340px !default;

$navbar-default-color: #777 !default;
Expand Down
4 changes: 2 additions & 2 deletions assets/stylesheets/bootstrap/mixins/_nav-vertical-align.scss
Expand Up @@ -5,6 +5,6 @@
// Example: an element has a height of 30px, so write out `.navbar-vertical-align(30px);` to calculate the appropriate top margin.

@mixin navbar-vertical-align($element-height) {
margin-top: (math.div($navbar-height - $element-height), 2);
margin-bottom: (math.div($navbar-height - $element-height), 2);
margin-top: math.div(($navbar-height - $element-height), 2);
margin-bottom: math.div(($navbar-height - $element-height), 2);
}
36 changes: 34 additions & 2 deletions tasks/converter/less_conversion.rb
Expand Up @@ -184,9 +184,41 @@ def wrap_at_groups_with_at_root(file)
end

def replace_division(less)
re = /(?<!\w)\(\s*([^(]+?)\s+\/\s+([^)]+?)\s*\)/
re = %r{
(?<expression>
(?<callee>[[:alpha:]\.]+)?
\(
(?:
(?>
(?<dividend>
[^()/]+
|
\([^/]+\)
)
\s+
/
\s+
(?<divisor>
[^()/]+
|
\([^/]+\)
)
)
|
\g<expression>
)
\)
)
}x
return less if less !~ re
"@use \"sass:math\";\n" + less.gsub(re, 'math.div(\1, \2)')
"@use \"sass:math\";\n" + less.gsub(re) do
named_captures = $~.named_captures
callee = named_captures['callee']
dividend = named_captures['dividend']
divisor = named_captures['divisor']
expression = "math.div(#{dividend}, #{divisor})"
callee.nil? ? expression : "#{callee}(#{expression})"
end
end

def sass_fn_exists(fn)
Expand Down
10 changes: 5 additions & 5 deletions templates/project/_bootstrap-variables.sass
Expand Up @@ -336,24 +336,24 @@
//** Point at which the navbar becomes uncollapsed.
// $grid-float-breakpoint: $screen-sm-min
//** Point at which the navbar begins collapsing.
// $grid-float-breakpoint-max: math.div($grid-float-breakpoint - 1)
// $grid-float-breakpoint-max: ($grid-float-breakpoint - 1)


//== Container sizes
//
//## Define the maximum width of `.container` for different screen sizes.

// Small screen, tablet
// Small screen / tablet
// $container-tablet: (720px + $grid-gutter-width)
//** For `$screen-sm-min` and up.
// $container-sm: $container-tablet

// Medium screen / desktop
// $container-desktop: math.div(940px + $grid-gutter-width)
// $container-desktop: (940px + $grid-gutter-width)
//** For `$screen-md-min` and up.
// $container-md: $container-desktop

// Large screen, wide desktop
// Large screen / wide desktop
// $container-large-desktop: (1140px + $grid-gutter-width)
//** For `$screen-lg-min` and up.
// $container-lg: $container-large-desktop
Expand All @@ -368,7 +368,7 @@
// $navbar-margin-bottom: $line-height-computed
// $navbar-border-radius: $border-radius-base
// $navbar-padding-horizontal: floor(math.div($grid-gutter-width, 2))
// $navbar-padding-vertical: (math.div($navbar-height - $line-height-computed), 2)
// $navbar-padding-vertical: math.div(($navbar-height - $line-height-computed), 2)
// $navbar-collapse-max-height: 340px

// $navbar-default-color: #777
Expand Down