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 & selector in Sass/SCSS lexer #1554

Merged
merged 3 commits into from
Jun 29, 2020
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/rouge/lexers/sass/common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class SassCommon < RegexLexer
end

rule %r/@#{id}/, Keyword, :selector
rule %r/&/, Keyword, :selector

# $variable: assignment
rule %r/([$]#{id})([ \t]*)(:)/ do
Expand Down
42 changes: 25 additions & 17 deletions spec/visual/samples/sass
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ body
:padding 2px
:border none

#menu
#menu
:clear both
:text-align right
:height 20px
Expand All @@ -167,7 +167,7 @@ body
ul
:margin 0 5px 0 0
:padding 0
li
li
:list-style-type none
:margin 0 5px
:padding 5px 5px 0 5px
Expand Down Expand Up @@ -212,9 +212,9 @@ body
:width 200px
.box
:margin-top 10px
p
p
:margin 0 1em auto 1em
.box.participants
.box.participants
img
:float left
:margin 0 1em auto 1em
Expand Down Expand Up @@ -254,12 +254,12 @@ body
:margin-top 0

#content.contests
.container.information
.column.right
.container.information
.column.right
.box
:margin 1em 0
.box.videos
.thumbnail img
.thumbnail img
:width 200px
:height 150px
:margin-bottom 5px
Expand All @@ -268,7 +268,7 @@ body
:text-decoration none
a:hover
:text-decoration underline
.box.votes
.box.votes
a
:display block
:width 200px
Expand All @@ -285,7 +285,7 @@ body
:text-indent -9999px
:border-top 5px solid #a20013

#content.contests
#content.contests
.container.video
.box.videos
h2
Expand All @@ -296,13 +296,13 @@ body
:border-top 5px solid #a20013
table
:width 100
td
td
:padding 1em
:width 25
:vertical-align top
p
:margin 0 0 5px 0
a:link, a:visited
a:link, a:visited
:color #93d700
:text-decoration none
a:hover
Expand All @@ -315,13 +315,13 @@ body
:margin 0 10px 0 0
:border 1px solid #6e000d

#content
.container.comments
#content
.container.comments
.column
:margin-top 15px
.column.left
:width 600px
.box
.box
ol
:margin 0
:padding 0
Expand Down Expand Up @@ -377,16 +377,16 @@ body
:float right


.clear
.clear
:clear both

.centered
.centered
:text-align center

img
:border none

button.short
button.short
:width 60px
:height 22px
:padding 0 0 2px 0
Expand All @@ -397,4 +397,12 @@ button.short
table
:border-collapse collapse

body
&.open > button::after
color: red

body
&::after
color: red

// Comment at EOF (#797)
40 changes: 26 additions & 14 deletions spec/visual/samples/scss
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ body {
}

ul {
@include horizontal-list;
@include horizontal-list;
padding: 0 0 0 25px;
li {
@include incr(18px);
padding: 0 20px 0 0;
text-transform: uppercase;
a {
a {
color: #febf0f;
text-decoration: none;
width: 100px;
Expand All @@ -86,7 +86,7 @@ body {
@include replace-text("header-timeline-text.jpg");
}
}
}
}
}

#paging {
Expand All @@ -99,8 +99,8 @@ body {
color: #908f8b;
padding-right: 20px;
text-transform: uppercase;
a {
color: #f07b07;
a {
color: #f07b07;
text-decoration: none;
}
}
Expand All @@ -109,18 +109,18 @@ body {
@include horizontal-list;
li {
padding: 3px 4px;
a {
a {
color: #4c4c4c;
@include replace-text("thread-paging-inactive-bullet.jpg");
width: 10px;
height: 10px;
display: block;
}
&.active a {
&.active a {
color: #f17d06;
background-image: image_@import "compass";
}
}
}
}
}

Expand Down Expand Up @@ -152,7 +152,7 @@ body {

@for $i from 0 through 30 {
&.position#{$i} {
left: ($i * -910px);
left: ($i * -910px);
}
}
}
Expand All @@ -163,7 +163,7 @@ body {
width: 100%;
}

#thread {
#thread {
padding: 0;
width: 5000px;
position: absolute;
Expand Down Expand Up @@ -278,15 +278,27 @@ body {
}

ul {
@include horizontal-list;
@include horizontal-list;

li {
padding: 0 30px 0 0;
a {
a {
text-decoration: none;
color: #ef7a06;
color: #ef7a06;
}
}
}
}
}

body {
&.open > button::after {
color: red;
}
}

body {
&::after {
color: red;
}
}

Expand Down