8000 Docs link back to root overview ref #648 · Roba1993/rune@6cc948f · GitHub
[go: up one dir, main page]

< 8000 div data-turbo-body class="logged-out env-production page-responsive" style="word-wrap: break-word;">
Skip to content

Commit 6cc948f

Browse files
committed
Docs link back to root overview ref rune-rs#648
1 parent 6e8b6dd commit 6cc948f

File tree

7 files changed

+21
-6
lines changed

7 files changed

+21
-6
lines changed

crates/rune/src/doc/build.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,15 @@ pub(crate) fn build(
145145
}
146146

147147
let search_index = RelativePath::new("index.js");
148+
let root_index = RelativePath::new("index.html");
148149

149150
let mut cx = Ctxt {
150151
state: State::default(),
151152
index: Vec::new(),
152153
name,
153154
context: &context,
154155
search_index: Some(search_index),
156+
root_index: root_index,
155157
fonts: &fonts,
156158
css: &css,
157159
js: &js,
@@ -262,6 +264,7 @@ fn build_search_index(cx: &Ctxt) -> Result<String> {
262264
struct Shared<'a> {
263265
data_path: Option<&'a RelativePath>,
264266
search_index: Option<RelativePathBuf>,
267+
root_index: RelativePathBuf,
265268
fonts: Vec<RelativePathBuf>,
266269
css: Vec<RelativePathBuf>,
267270
js: Vec<RelativePathBuf>,
@@ -328,6 +331,7 @@ pub(crate) struct Ctxt<'a, 'm> {
328331
name: &'a str,
329332
context: &'a Context<'m>,
330333
search_index: Option<&'a RelativePath>,
334+
root_index: &'a RelativePath,
331335
fonts: &'a [RelativePathBuf],
332336
css: &'a [RelativePathBuf],
333337
js: &'a [RelativePathBuf],
@@ -382,6 +386,7 @@ impl<'m> Ctxt<'_, 'm> {
382386
Ok(Shared {
383387
data_path: self.state.path.parent(),
384388
search_index: self.search_index.map(|p| dir.relative(p)),
389+
root_index: dir.relative(self.root_index),
385390
fonts: self.fonts.iter().map(|f| dir.relative(f)).try_collect()?,
386391
css: self.css.iter().map(|f| dir.relative(f)).try_collect()?,
387392
js: self.js.iter().map(|f| dir.relative(f)).try_collect()?,
@@ -496,7 +501,7 @@ impl<'m> Ctxt<'_, 'm> {
496501
Ok(self.dir().relative(path))
497502
}
498503

499-
/// Build banklinks for the current item.
504+
/// Build backlinks for the current item.
500505
fn module_path_html(&self, meta: Meta<'_>, is_module: bool) -> Result<String> {
501506
let mut module = Vec::new();
502507
let item = meta.item.context("Missing module item")?;

crates/rune/src/doc/static/enum.html.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{#> layout}}
2-
<h3 class="title">Enum {{literal module}}::<span class="enum">{{name}}</span></h3>
2+
<div class="title-wrapper"><h3 class="title">Enum {{literal module}}::<span class="enum">{{name}}</span></h3><a class="overview" href="{{literal root_index}}">Overview</a></div>
33
{{#if doc}}{{literal doc}}{{/if}}
44

55
{{#if variants}}

crates/rune/src/doc/static/function.html.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{{#> layout}}
22
<body>
3-
<h3 class="title">Function {{literal module}}::<span class="fn">{{name}}</span></h3>
3+
<div class="title-wrapper"><h3 class="title">Function {{literal module}}::<span class="fn">{{name}}</span></h3><a class="overview" href="{{literal root_index}}">Overview</a></div>
44
<div class="signature">
55
{{#if is_async}}<span class="keyword async">async</span> {{/if}} <span class="keyword fn">fn</span> <span class="fn">{{name}}</span>({{literal args}}){{#if this.return_type}} -&gt; {{literal this.return_type}}{{/if}}</h3>
66
</div>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{{#> layout}}
2-
<h3 class="title">Macro {{literal module}}::<span class="macro">{{name}}!</span>(..)</h3>
2+
<div class="title-wrapper"><h3 class="title">Macro {{literal module}}::<span class="macro">{{name}}!</span>(..)</h3><a class="overview" href="{{literal root_index}}">Overview</a></div>
33
{{#if doc}}{{literal doc}}{{/if}}
44
{{/layout}}

crates/rune/src/doc/static/module.html.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{#> layout}}
2-
<h3 class="title">Module {{literal module}}</h3>
2+
<div class="title-wrapper"><h3 class="title">Module {{literal module}}</h3><a class="overview" href="{{literal root_index}}">Overview</a></div>
33
{{#if doc}}{{literal doc}}{{/if}}
44

55
{{#if types}}

crates/rune/src/doc/static/runedoc.css.hbs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,16 @@ p > code {
197197
padding: 0 0.125em;
198198
}
199199

200+
.overview {
201+
color: var(--link-color);
202+
}
203+
204+
.title-wrapper {
205+
display: flex;
206+
justify-content: space-between;
207+
align-items: center;
208+
}
209+
200210
.title {
201211
font-size: 1.5rem;
202212
line-height: 1.25;

crates/rune/src/doc/static/type.html.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{#> layout}}
2-
<h3 class="title">{{what}} {{literal module}}::<span class="{{what_class}}">{{name}}</span></h3>
2+
<div class="title-wrapper"><h3 class="title">{{what}} {{literal module}}::<span class="{{what_class}}">{{name}}</span></h3><a class="overview" href="{{literal root_index}}">Overview</a></div>
33
{{#if doc}}{{literal doc}}{{/if}}
44

55
{{#if methods}}

0 commit comments

Comments
 (0)
0