Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
8a35cc3d
R
Rust
项目概览
int
/
Rust
12 个月 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8a35cc3d
编写于
5月 18, 2023
作者:
G
Guillaume Gomez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move item kind before the item name
上级
7a09a688
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
22 addition
and
35 deletion
+22
-35
src/librustdoc/html/static/css/rustdoc.css
src/librustdoc/html/static/css/rustdoc.css
+5
-0
src/librustdoc/html/static/js/search.js
src/librustdoc/html/static/js/search.js
+8
-3
tests/rustdoc-gui/search-reexport.goml
tests/rustdoc-gui/search-reexport.goml
+3
-2
tests/rustdoc-gui/search-result-color.goml
tests/rustdoc-gui/search-result-color.goml
+2
-26
tests/rustdoc-gui/search-result-display.goml
tests/rustdoc-gui/search-result-display.goml
+2
-2
tests/rustdoc-gui/search-result-keyword.goml
tests/rustdoc-gui/search-result-keyword.goml
+2
-2
未找到文件。
src/librustdoc/html/static/css/rustdoc.css
浏览文件 @
8a35cc3d
...
...
@@ -190,6 +190,7 @@ h1, h2, h3, h4, h5, h6,
.mobile-topbar
,
.search-input
,
.search-results
.result-name
,
.search-results
.type-kind
,
.item-name
>
a
,
.out-of-band
,
span
.since
,
...
...
@@ -870,6 +871,10 @@ so that we can apply CSS-filters to change the arrow color in themes */
}
.search-results
>
a
>
div
{
flex
:
3
;
}
.search-results
>
a
>
div
.type-kind
{
flex
:
1
;
}
...
...
src/librustdoc/html/static/js/search.js
浏览文件 @
8a35cc3d
...
...
@@ -1866,7 +1866,7 @@ function initSearch(rawSearchIndex) {
const
name
=
item
.
name
;
const
type
=
itemTypes
[
item
.
ty
];
const
longType
=
longItemTypes
[
item
.
ty
];
let
extra
=
longType
.
length
!==
0
?
` <i>(
${
longType
}
)</i>`
:
"
"
;
const
typeName
=
longType
.
length
!==
0
?
`
${
longType
}
`
:
"
?
"
;
length
+=
1
;
...
...
@@ -1878,7 +1878,6 @@ function initSearch(rawSearchIndex) {
resultName
.
className
=
"
result-name
"
;
if
(
item
.
is_alias
)
{
extra
=
""
;
const
alias
=
document
.
createElement
(
"
span
"
);
alias
.
className
=
"
alias
"
;
...
...
@@ -1892,9 +1891,15 @@ function initSearch(rawSearchIndex) {
resultName
.
appendChild
(
alias
);
}
const
typeDisplay
=
document
.
createElement
(
"
div
"
);
typeDisplay
.
innerText
=
typeName
;
typeDisplay
.
className
=
"
type-kind
"
;
link
.
appendChild
(
typeDisplay
);
resultName
.
insertAdjacentHTML
(
"
beforeend
"
,
item
.
displayPath
+
"
<span class=
\"
"
+
type
+
"
\"
>
"
+
name
+
"
</span>
"
+
extra
);
item
.
displayPath
+
"
<span class=
\"
"
+
type
+
"
\"
>
"
+
name
+
"
</span>
"
);
link
.
appendChild
(
resultName
);
const
description
=
document
.
createElement
(
"
div
"
);
...
...
tests/rustdoc-gui/search-reexport.goml
浏览文件 @
8a35cc3d
...
...
@@ -14,7 +14,8 @@ assert-attribute: (
"//a[@class='result-import']",
{"href": "../test_docs/index.html#reexport.TheStdReexport"},
)
assert-text: ("//a[@class='result-import']", "test_docs::TheStdReexport (re-export)")
assert-text: ("a.result-import .result-name", "test_docs::TheStdReexport")
assert-text: ("a.result-import .type-kind", "re-export")
click: "//a[@class='result-import']"
// We check that it has the background modified thanks to the focus.
wait-for-css: ("//*[@id='reexport.TheStdReexport']", {"background-color": "rgb(73, 74, 61)"})
...
...
@@ -25,7 +26,7 @@ press-key: 'Enter'
write: (".search-input", "AliasForTheStdReexport")
wait-for: "//a[@class='result-import']"
assert-text: (
"
//a[@class='result-import']
",
"
a.result-import .result-name
",
"AliasForTheStdReexport - see test_docs::TheStdReexport",
)
// Same thing again, we click on it to ensure the background is once again set as expected.
...
...
tests/rustdoc-gui/search-result-color.goml
浏览文件 @
8a35cc3d
...
...
@@ -5,7 +5,7 @@ define-function: (
(result_kind, color, hover_color),
block {
assert-css: (".result-" + |result_kind| + " ." + |result_kind|, {"color": |color|}, ALL)
assert-css: (".result-" + |result_kind| + "
i", {"color": |default
_color|})
assert-css: (".result-" + |result_kind| + "
.type-kind", {"color": |entry
_color|})
assert-css: (
".result-" + |result_kind|,
{"color": |entry_color|, "background-color": |background_color|},
...
...
@@ -19,7 +19,7 @@ define-function: (
".result-" + |result_kind| + ":hover ." + |result_kind|,
{"color": |hover_color|},
)
assert-css: (".result-" + |result_kind| + ":hover
i", {"color": |default
_color|})
assert-css: (".result-" + |result_kind| + ":hover
.type-kind", {"color": |hover_entry
_color|})
move-cursor-to: ".search-input"
focus: ".result-" + |result_kind|
assert-css: (
...
...
@@ -67,14 +67,6 @@ assert-css: (
{"border-bottom-color": "#aaa3"}
)
store-value: (default_color, "rgb(197, 197, 197)")
// Checking the color of "keyword" text.
assert-css: (
"//*[@class='result-name']//*[text()='(keyword)']",
{"color": |default_color|},
)
store-value: (entry_color, "#0096cf") // color of the search entry
store-value: (hover_entry_color, "#fff") // color of the hovered/focused search entry
store-value: (background_color, "transparent") // background color
...
...
@@ -186,14 +178,6 @@ assert-css: (
{"border-bottom-color": "#aaa3"}
)
store-value: (default_color, "rgb(221, 221, 221)")
// Checking the color for "keyword" text.
assert-css: (
"//*[@class='result-name']//*[text()='(keyword)']",
{"color": |default_color|},
)
store-value: (entry_color, "#ddd") // color of the search entry
store-value: (hover_entry_color, "#ddd") // color of the hovered/focused search entry
store-value: (background_color, "transparent") // background color
...
...
@@ -290,14 +274,6 @@ assert-css: (
{"border-bottom-color": "#aaa3"}
)
store-value: (default_color, "rgb(0, 0, 0)")
// Checking the color for "keyword" text.
assert-css: (
"//*[@class='result-name']//*[text()='(keyword)']",
{"color": |default_color|},
)
store-value: (entry_color, "#000") // color of the search entry
store-value: (hover_entry_color, "#000") // color of the hovered/focused search entry
store-value: (background_color, "transparent") // background color
...
...
tests/rustdoc-gui/search-result-display.goml
浏览文件 @
8a35cc3d
...
...
@@ -7,11 +7,11 @@ press-key: 'Enter'
wait-for: "#crate-search"
// The width is returned by "getComputedStyle" which returns the exact number instead of the
// CSS rule which is "50%"...
assert-
css: (".search-results div.desc", {"width": "310px"
})
assert-
size: (".search-results div.desc", {"width": 259
})
set-window-size: (600, 100)
// As counter-intuitive as it may seem, in this width, the width is "100%", which is why
// when computed it's larger.
assert-
css: (".search-results div.desc", {"width": "566px"
})
assert-
size: (".search-results div.desc", {"width": 566
})
// The result set is all on one line.
assert-css: (".search-results .result-name > span", {"display": "inline"})
...
...
tests/rustdoc-gui/search-result-keyword.goml
浏览文件 @
8a35cc3d
...
...
@@ -9,5 +9,5 @@ wait-for: "#search-tabs"
// less good.
//
// Checking that the CSS is displaying " (keyword)" in italic.
assert-text: (".result-keyword
span.keyword + i", "(keyword)
")
assert-text: (".result-keyword .result-name", "CookieMonster
(keyword)
")
assert-text: (".result-keyword
.type-kind", "keyword
")
assert-text: (".result-keyword .result-name", "CookieMonster")
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录