Skip to content

Commit

Permalink
Lint RTL
Browse files Browse the repository at this point in the history
  • Loading branch information
hexylena committed Jun 25, 2024
1 parent 8c7139e commit 4918f64
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 29 deletions.
58 changes: 29 additions & 29 deletions assets/css/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,11 @@ body {
vertical-align: 1em;
float: inline-start;
border: 1px solid $bg-color;
border-top-left-radius: 8px;
border-top-right-radius: 8px;
border-start-start-radius: 8px;
border-start-end-radius: 8px;

.fa {
padding-right: calc($tutorial-box-spacing / 5);
padding-inline-end: calc($tutorial-box-spacing / 5);
}

button {
Expand All @@ -247,8 +247,8 @@ body {
@mixin matrix-table (){
table {
width:unset;
margin-left:auto;
margin-right:auto;
margin-inline-start:auto;
margin-inline-end:auto;
margin-top: 20pt;
}

Expand All @@ -258,15 +258,15 @@ body {
}

table td:first-child, table th:first-child {
border-right: 2px solid #777;
border-inline-end: 2px solid #777;
font-weight: bold;
text-align: left;
}

table td:not(first-child), table th:not(first-child) {
text-align: center;
border-right: 1px solid #ddd;
border-left: 1px solid #ddd;
border-inline-end: 1px solid #ddd;
border-inline-start: 1px solid #ddd;
}
}

Expand Down Expand Up @@ -431,16 +431,16 @@ div.language-diff .p {
border-top: 1px solid #66d9ef;
border-bottom: 1px solid #66d9ef;

border-left: 5px solid #66d9ef;
border-right: 5px solid #66d9ef;
border-inline-start: 5px solid #66d9ef;
border-inline-end: 5px solid #66d9ef;

font-weight: 900;

line-height: 3em;

margin-right: 1em;
padding-left: 1em;
padding-right: 1em;
margin-inline-end: 1em;
padding-inline-start: 1em;
padding-inline-end: 1em;
}

body > footer {
Expand Down Expand Up @@ -485,7 +485,7 @@ nav.navbar {
}

a.navbar-brand {
padding-right: 2.5em; // the image seems to work poorly with parent size calculations.
padding-inline-end: 2.5em; // the image seems to work poorly with parent size calculations.
}

// Text decoration not necessary for accessibility here.
Expand Down Expand Up @@ -532,7 +532,7 @@ nav input.nicer {
}
}
#search-input {
margin-right:1em;
margin-inline-end:1em;
}

/*
Expand Down Expand Up @@ -718,8 +718,8 @@ blockquote {
border: 1px solid var(--border-light);
.card-title {
color: var(--brand-color-contrast);
// margin-left: -15px; // BS has a 15px margin on cards, this makes the card title fill the card.
// margin-right: -15px;
// margin-inline-start: -15px; // BS has a 15px margin on cards, this makes the card title fill the card.
// margin-inline-end: -15px;
}
}

Expand All @@ -738,8 +738,8 @@ blockquote {
// We have to manually exclude the card titles
// And also canvases because they apparently calculate their area before the CSS has finished.
& > :not(.card-title,canvas){
margin-left: 1em;
margin-right: 1em;
margin-inline-start: 1em;
margin-inline-start: 1em;
}
}
}
Expand Down Expand Up @@ -944,8 +944,8 @@ blockquote {
@media (max-width: 575px) {
.navbar > .container {
position: initial;
margin-left: initial;
margin-right: initial;
margin-inline-start: initial;
margin-inline-end: initial;
}
}

Expand Down Expand Up @@ -1034,7 +1034,7 @@ blockquote {

.level {
color: lightgray;
margin-right: 0.5em;
margin-inline-end: 0.5em;

.fa {
font-size: 0.9em;
Expand Down Expand Up @@ -1167,8 +1167,8 @@ nav[data-toggle='toc'] {
i {
height: 1.5em;
line-height: 1.5em;
margin-left: 0.5em;
margin-right: 0.5em;
margin-inline-start: 0.5em;
margin-inline-end: 0.5em;
}
}

Expand All @@ -1182,7 +1182,7 @@ nav[data-toggle='toc'] {
align-items: center;
border-radius: 1em;
border: 1px dotted var(--hyperlink);
padding-right: 0.5em;
padding-inline-end: 0.5em;
margin: 0.2em;
line-height: 1em;
flex-shrink: 0;
Expand Down Expand Up @@ -1293,7 +1293,7 @@ div.highlight:hover .btn,div.highlight .btn:focus{
}
.search_box {
float: inline-end;
i {padding-right: .5rem;}
i {padding-inline-end: .5rem;}
}
#clear_search{
cursor: pointer;
Expand Down Expand Up @@ -1434,7 +1434,7 @@ video::cue {
overflow-y: scroll;

tr td:nth-child(1) {
padding-right: 1em;
padding-inline-end: 1em;
color: var(--text-color-muted);
}
}
Expand Down Expand Up @@ -1862,8 +1862,8 @@ section.event {
cursor: pointer;
background: none;
font-size: 1.2rem;
border-top-left-radius: 0;
border-top-right-radius: 0;
border-start-start-radius: 0;
border-start-end-radius: 0;

&:hover {
color: var(--hyperlink-hover);
Expand Down
28 changes: 28 additions & 0 deletions bin/lint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,23 @@ def self.fix_ga_wf(contents)
results
end

def self.fix_css(contents)
results = []
results += find_matching_texts(contents, /-(left|right)/)
.map do |idx, _text, selected|
ReviewDogEmitter.warning(
path: @path,
idx: idx,
match_start: selected.begin(1),
match_end: selected.end(1) + 1,
replacement: '',
message: 'Use -start and -end instead of -left and -right to support right-to-left languages See: https://firefox-source-docs.mozilla.org/code-quality/coding-style/rtl_guidelines.html',
code: 'GTN:037'
)
end
results
end

def self.fix_bib(contents, bib)
bad_keys = bib_missing_mandatory_fields(bib)
results = []
Expand Down Expand Up @@ -1073,6 +1090,14 @@ def self.fix_file(path)
bib = BibTeX.open(path)
results = fix_bib(contents, bib)

results = filter_results(results, ignores)
emit_results(results)
when /.s?css$/
handle = File.open(path, 'r')
contents = handle.read.split("\n")

results = fix_css(contents)

results = filter_results(results, ignores)
emit_results(results)
when /.ga$/
Expand Down Expand Up @@ -1229,6 +1254,9 @@ def self.run_linter_global
)
end
end
enumerate_type(/\.s?css$/).each do |path|
fix_file(path)
end
enumerate_type(/\.ga$/).each do |path|
fix_file(path)
end
Expand Down

0 comments on commit 4918f64

Please sign in to comment.