diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2022-11-01 22:01:37 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-01 22:01:37 +0530 |
| commit | 2b0ead31261e36185b1b41847f717be7641348fc (patch) | |
| tree | 8679b4e9868bc050c33f9fa486af043ccb810405 | |
| parent | db200d01cd52915121e835636c300e1140b7e005 (diff) | |
| parent | 6432bb71b63bc9e929aff8f93b5c55fe25d4b1d8 (diff) | |
| download | rust-2b0ead31261e36185b1b41847f717be7641348fc.tar.gz rust-2b0ead31261e36185b1b41847f717be7641348fc.zip | |
Rollup merge of #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
| -rw-r--r-- | src/librustdoc/html/highlight.rs | 2 | ||||
| -rw-r--r-- | src/librustdoc/html/highlight/fixtures/sample.html | 8 | ||||
| -rw-r--r-- | src/librustdoc/html/highlight/tests.rs | 2 | ||||
| -rw-r--r-- | src/librustdoc/html/static/css/rustdoc.css | 2 | ||||
| -rw-r--r-- | src/test/rustdoc-gui/highlight-colors.goml | 10 | ||||
| -rw-r--r-- | src/test/rustdoc/issue-41783.codeblock.html | 2 | ||||
| -rw-r--r-- | src/test/rustdoc/issue-41783.rs | 6 |
7 files changed, 16 insertions, 16 deletions
diff --git a/src/librustdoc/html/highlight.rs b/src/librustdoc/html/highlight.rs index 28136cc48d6..cd8c8c463b1 100644 --- a/src/librustdoc/html/highlight.rs +++ b/src/librustdoc/html/highlight.rs @@ -362,7 +362,7 @@ impl Class { match self { Class::Comment => "comment", Class::DocComment => "doccomment", - Class::Attribute => "attribute", + Class::Attribute => "attr", Class::KeyWord => "kw", Class::RefKeyWord => "kw-2", Class::Self_(_) => "self", diff --git a/src/librustdoc/html/highlight/fixtures/sample.html b/src/librustdoc/html/highlight/fixtures/sample.html index 4a5a3cf609c..fced2eacd9e 100644 --- a/src/librustdoc/html/highlight/fixtures/sample.html +++ b/src/librustdoc/html/highlight/fixtures/sample.html @@ -3,16 +3,16 @@ .kw { color: #8959A8; } .kw-2, .prelude-ty { color: #4271AE; } .number, .string { color: #718C00; } -.self, .bool-val, .prelude-val, .attribute, .attribute .ident { color: #C82829; } +.self, .bool-val, .prelude-val, .attr, .attr .ident { color: #C82829; } .macro, .macro-nonterminal { color: #3E999F; } .lifetime { color: #B76514; } .question-mark { color: #ff9011; } </style> -<pre><code><span class="attribute">#![crate_type = <span class="string">"lib"</span>] +<pre><code><span class="attr">#![crate_type = <span class="string">"lib"</span>] </span><span class="kw">use </span>std::path::{Path, PathBuf}; -<span class="attribute">#[cfg(target_os = <span class="string">"linux"</span>)] +<span class="attr">#[cfg(target_os = <span class="string">"linux"</span>)] #[cfg(target_os = <span class="string">"windows"</span>)] </span><span class="kw">fn </span>main() -> () { <span class="kw">let </span>foo = <span class="bool-val">true </span>&& <span class="bool-val">false </span>|| <span class="bool-val">true</span>; @@ -23,7 +23,7 @@ <span class="macro">mac!</span>(foo, <span class="kw-2">&mut </span>bar); <span class="macro">assert!</span>(<span class="self">self</span>.length < N && index <= <span class="self">self</span>.length); ::std::env::var(<span class="string">"gateau"</span>).is_ok(); - <span class="attribute">#[rustfmt::skip] + <span class="attr">#[rustfmt::skip] </span><span class="kw">let </span>s:std::path::PathBuf = std::path::PathBuf::new(); <span class="kw">let </span><span class="kw-2">mut </span>s = String::new(); diff --git a/src/librustdoc/html/highlight/tests.rs b/src/librustdoc/html/highlight/tests.rs index a5e633df434..2c93b9a097f 100644 --- a/src/librustdoc/html/highlight/tests.rs +++ b/src/librustdoc/html/highlight/tests.rs @@ -9,7 +9,7 @@ const STYLE: &str = r#" .kw { color: #8959A8; } .kw-2, .prelude-ty { color: #4271AE; } .number, .string { color: #718C00; } -.self, .bool-val, .prelude-val, .attribute, .attribute .ident { color: #C82829; } +.self, .bool-val, .prelude-val, .attr, .attr .ident { color: #C82829; } .macro, .macro-nonterminal { color: #3E999F; } .lifetime { color: #B76514; } .question-mark { color: #ff9011; } diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index 43834c136ea..219d1b4ed53 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -1090,7 +1090,7 @@ pre.rust .bool-val { pre.rust .self { color: var(--code-highlight-self-color); } -pre.rust .attribute { +pre.rust .attr { color: var(--code-highlight-attribute-color); } pre.rust .macro, diff --git a/src/test/rustdoc-gui/highlight-colors.goml b/src/test/rustdoc-gui/highlight-colors.goml index 51693314e85..ff1be389dcb 100644 --- a/src/test/rustdoc-gui/highlight-colors.goml +++ b/src/test/rustdoc-gui/highlight-colors.goml @@ -15,7 +15,7 @@ define-function: ( string, bool_val, self, - attribute, + attr, macro, question_mark, comment, @@ -33,7 +33,7 @@ define-function: ( ("assert-css", ("pre.rust .string", {"color": |string|}, ALL)), ("assert-css", ("pre.rust .bool-val", {"color": |bool_val|}, ALL)), ("assert-css", ("pre.rust .self", {"color": |self|}, ALL)), - ("assert-css", ("pre.rust .attribute", {"color": |attribute|}, ALL)), + ("assert-css", ("pre.rust .attr", {"color": |attr|}, ALL)), ("assert-css", ("pre.rust .macro", {"color": |macro|}, ALL)), ("assert-css", ("pre.rust .question-mark", {"color": |question_mark|}, ALL)), ("assert-css", ("pre.rust .comment", {"color": |comment|}, ALL)), @@ -52,7 +52,7 @@ call-function: ("check-colors", { "string": "rgb(184, 204, 82)", "bool_val": "rgb(255, 119, 51)", "self": "rgb(54, 163, 217)", - "attribute": "rgb(230, 225, 207)", + "attr": "rgb(230, 225, 207)", "macro": "rgb(163, 122, 204)", "question_mark": "rgb(255, 144, 17)", "comment": "rgb(120, 135, 151)", @@ -69,7 +69,7 @@ call-function: ("check-colors", { "string": "rgb(131, 163, 0)", "bool_val": "rgb(238, 104, 104)", "self": "rgb(238, 104, 104)", - "attribute": "rgb(238, 104, 104)", + "attr": "rgb(238, 104, 104)", "macro": "rgb(62, 153, 159)", "question_mark": "rgb(255, 144, 17)", "comment": "rgb(141, 141, 139)", @@ -86,7 +86,7 @@ call-function: ("check-colors", { "string": "rgb(113, 140, 0)", "bool_val": "rgb(200, 40, 41)", "self": "rgb(200, 40, 41)", - "attribute": "rgb(200, 40, 41)", + "attr": "rgb(200, 40, 41)", "macro": "rgb(62, 153, 159)", "question_mark": "rgb(255, 144, 17)", "comment": "rgb(142, 144, 140)", diff --git a/src/test/rustdoc/issue-41783.codeblock.html b/src/test/rustdoc/issue-41783.codeblock.html index 89987491d1b..3bca4536cd5 100644 --- a/src/test/rustdoc/issue-41783.codeblock.html +++ b/src/test/rustdoc/issue-41783.codeblock.html @@ -1,5 +1,5 @@ <code># single ## double ### triple -<span class="attribute">#[outer] +<span class="attr">#[outer] #![inner]</span></code> diff --git a/src/test/rustdoc/issue-41783.rs b/src/test/rustdoc/issue-41783.rs index 87267a750c6..769f984a274 100644 --- a/src/test/rustdoc/issue-41783.rs +++ b/src/test/rustdoc/issue-41783.rs @@ -1,10 +1,10 @@ // @has issue_41783/struct.Foo.html // @!hasraw - 'space' // @!hasraw - 'comment' -// @hasraw - '<span class="attribute">#[outer]' -// @!hasraw - '<span class="attribute">#[outer]</span>' +// @hasraw - '<span class="attr">#[outer]' +// @!hasraw - '<span class="attr">#[outer]</span>' // @hasraw - '#![inner]</span>' -// @!hasraw - '<span class="attribute">#![inner]</span>' +// @!hasraw - '<span class="attr">#![inner]</span>' // @snapshot 'codeblock' - '//*[@class="rustdoc-toggle top-doc"]/*[@class="docblock"]//pre/code' /// ```no_run |
