Skip to content

Commit 2b0ead3

Browse files
authored
Rollup merge of rust-lang#103817 - notriddle:notriddle/attribute-css, r=GuillaumeGomez
rustdoc: rename syntax highlighting CSS class `attribute` to `attr` Link classes use the abbreviation `attr` ... https://github.com/rust-lang/rust/blob/2afca78a0b03db144c5d8b9f8868feebfe096309/src/librustdoc/html/static/css/rustdoc.css#L255-L259 ... so why does syntax highlighting use the full word? https://github.com/rust-lang/rust/blob/2afca78a0b03db144c5d8b9f8868feebfe096309/src/librustdoc/html/static/css/rustdoc.css#L1095-L1097
2 parents db200d0 + 6432bb7 commit 2b0ead3

File tree

7 files changed

+16
-16
lines changed

7 files changed

+16
-16
lines changed

Diff for: src/librustdoc/html/highlight.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ impl Class {
362362
match self {
363363
Class::Comment => "comment",
364364
Class::DocComment => "doccomment",
365-
Class::Attribute => "attribute",
365+
Class::Attribute => "attr",
366366
Class::KeyWord => "kw",
367367
Class::RefKeyWord => "kw-2",
368368
Class::Self_(_) => "self",

Diff for: src/librustdoc/html/highlight/fixtures/sample.html

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
.kw { color: #8959A8; }
44
.kw-2, .prelude-ty { color: #4271AE; }
55
.number, .string { color: #718C00; }
6-
.self, .bool-val, .prelude-val, .attribute, .attribute .ident { color: #C82829; }
6+
.self, .bool-val, .prelude-val, .attr, .attr .ident { color: #C82829; }
77
.macro, .macro-nonterminal { color: #3E999F; }
88
.lifetime { color: #B76514; }
99
.question-mark { color: #ff9011; }
1010
</style>
11-
<pre><code><span class="attribute">#![crate_type = <span class="string">&quot;lib&quot;</span>]
11+
<pre><code><span class="attr">#![crate_type = <span class="string">&quot;lib&quot;</span>]
1212

1313
</span><span class="kw">use </span>std::path::{Path, PathBuf};
1414

15-
<span class="attribute">#[cfg(target_os = <span class="string">&quot;linux&quot;</span>)]
15+
<span class="attr">#[cfg(target_os = <span class="string">&quot;linux&quot;</span>)]
1616
#[cfg(target_os = <span class="string">&quot;windows&quot;</span>)]
1717
</span><span class="kw">fn </span>main() -&gt; () {
1818
<span class="kw">let </span>foo = <span class="bool-val">true </span>&amp;&amp; <span class="bool-val">false </span>|| <span class="bool-val">true</span>;
@@ -23,7 +23,7 @@
2323
<span class="macro">mac!</span>(foo, <span class="kw-2">&amp;mut </span>bar);
2424
<span class="macro">assert!</span>(<span class="self">self</span>.length &lt; N &amp;&amp; index &lt;= <span class="self">self</span>.length);
2525
::std::env::var(<span class="string">&quot;gateau&quot;</span>).is_ok();
26-
<span class="attribute">#[rustfmt::skip]
26+
<span class="attr">#[rustfmt::skip]
2727
</span><span class="kw">let </span>s:std::path::PathBuf = std::path::PathBuf::new();
2828
<span class="kw">let </span><span class="kw-2">mut </span>s = String::new();
2929

Diff for: src/librustdoc/html/highlight/tests.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const STYLE: &str = r#"
99
.kw { color: #8959A8; }
1010
.kw-2, .prelude-ty { color: #4271AE; }
1111
.number, .string { color: #718C00; }
12-
.self, .bool-val, .prelude-val, .attribute, .attribute .ident { color: #C82829; }
12+
.self, .bool-val, .prelude-val, .attr, .attr .ident { color: #C82829; }
1313
.macro, .macro-nonterminal { color: #3E999F; }
1414
.lifetime { color: #B76514; }
1515
.question-mark { color: #ff9011; }

Diff for: src/librustdoc/html/static/css/rustdoc.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -1090,7 +1090,7 @@ pre.rust .bool-val {
10901090
pre.rust .self {
10911091
color: var(--code-highlight-self-color);
10921092
}
1093-
pre.rust .attribute {
1093+
pre.rust .attr {
10941094
color: var(--code-highlight-attribute-color);
10951095
}
10961096
pre.rust .macro,

Diff for: src/test/rustdoc-gui/highlight-colors.goml

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ define-function: (
1515
string,
1616
bool_val,
1717
self,
18-
attribute,
18+
attr,
1919
macro,
2020
question_mark,
2121
comment,
@@ -33,7 +33,7 @@ define-function: (
3333
("assert-css", ("pre.rust .string", {"color": |string|}, ALL)),
3434
("assert-css", ("pre.rust .bool-val", {"color": |bool_val|}, ALL)),
3535
("assert-css", ("pre.rust .self", {"color": |self|}, ALL)),
36-
("assert-css", ("pre.rust .attribute", {"color": |attribute|}, ALL)),
36+
("assert-css", ("pre.rust .attr", {"color": |attr|}, ALL)),
3737
("assert-css", ("pre.rust .macro", {"color": |macro|}, ALL)),
3838
("assert-css", ("pre.rust .question-mark", {"color": |question_mark|}, ALL)),
3939
("assert-css", ("pre.rust .comment", {"color": |comment|}, ALL)),
@@ -52,7 +52,7 @@ call-function: ("check-colors", {
5252
"string": "rgb(184, 204, 82)",
5353
"bool_val": "rgb(255, 119, 51)",
5454
"self": "rgb(54, 163, 217)",
55-
"attribute": "rgb(230, 225, 207)",
55+
"attr": "rgb(230, 225, 207)",
5656
"macro": "rgb(163, 122, 204)",
5757
"question_mark": "rgb(255, 144, 17)",
5858
"comment": "rgb(120, 135, 151)",
@@ -69,7 +69,7 @@ call-function: ("check-colors", {
6969
"string": "rgb(131, 163, 0)",
7070
"bool_val": "rgb(238, 104, 104)",
7171
"self": "rgb(238, 104, 104)",
72-
"attribute": "rgb(238, 104, 104)",
72+
"attr": "rgb(238, 104, 104)",
7373
"macro": "rgb(62, 153, 159)",
7474
"question_mark": "rgb(255, 144, 17)",
7575
"comment": "rgb(141, 141, 139)",
@@ -86,7 +86,7 @@ call-function: ("check-colors", {
8686
"string": "rgb(113, 140, 0)",
8787
"bool_val": "rgb(200, 40, 41)",
8888
"self": "rgb(200, 40, 41)",
89-
"attribute": "rgb(200, 40, 41)",
89+
"attr": "rgb(200, 40, 41)",
9090
"macro": "rgb(62, 153, 159)",
9191
"question_mark": "rgb(255, 144, 17)",
9292
"comment": "rgb(142, 144, 140)",

Diff for: src/test/rustdoc/issue-41783.codeblock.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<code># single
22
## double
33
### triple
4-
<span class="attribute">#[outer]
4+
<span class="attr">#[outer]
55
#![inner]</span></code>

Diff for: src/test/rustdoc/issue-41783.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// @has issue_41783/struct.Foo.html
22
// @!hasraw - 'space'
33
// @!hasraw - 'comment'
4-
// @hasraw - '<span class="attribute">#[outer]'
5-
// @!hasraw - '<span class="attribute">#[outer]</span>'
4+
// @hasraw - '<span class="attr">#[outer]'
5+
// @!hasraw - '<span class="attr">#[outer]</span>'
66
// @hasraw - '#![inner]</span>'
7-
// @!hasraw - '<span class="attribute">#![inner]</span>'
7+
// @!hasraw - '<span class="attr">#![inner]</span>'
88
// @snapshot 'codeblock' - '//*[@class="rustdoc-toggle top-doc"]/*[@class="docblock"]//pre/code'
99

1010
/// ```no_run

0 commit comments

Comments
 (0)