Skip to content

Commit d766b1d

Browse files
committed
fixes
1 parent d79046e commit d766b1d

File tree

2 files changed

+63
-48
lines changed

2 files changed

+63
-48
lines changed

src/html/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,6 @@ pub fn generate(
483483
href_resolver: options.href_resolver,
484484
usage_composer: options.usage_composer,
485485
rewrite_map: options.rewrite_map,
486-
hide_module_doc_title: file_mode == FileMode::SingleDts,
487486
sidebar_hide_all_symbols: file_mode == FileMode::SingleDts,
488487
file_mode,
489488
};
@@ -550,7 +549,8 @@ pub fn generate(
550549
let partitions_by_kind =
551550
partition::partition_nodes_by_entrypoint(&all_doc_nodes, true);
552551

553-
let all_symbols = pages::AllSymbolsCtx::new(&ctx, partitions_by_kind, &doc_nodes_by_url);
552+
let all_symbols =
553+
pages::AllSymbolsCtx::new(&ctx, partitions_by_kind, &doc_nodes_by_url);
554554

555555
if options.composable_output {
556556
files.insert(
@@ -627,7 +627,8 @@ pub fn generate(
627627
ctx.render(SymbolGroupCtx::TEMPLATE, &symbol_group_ctx),
628628
),
629629
]
630-
} else {let file_name =
630+
} else {
631+
let file_name =
631632
format!("{}/~/{}.html", short_path.path, symbol_group_ctx.name);
632633

633634
let page_ctx = pages::SymbolPageCtx {
@@ -652,8 +653,7 @@ pub fn generate(
652653
if options.composable_output {
653654
let file_name = format!(
654655
"{}/~/{}/redirect.json",
655-
short_path.path,
656-
current_symbol
656+
short_path.path, current_symbol
657657
);
658658

659659
vec![(file_name, serde_json::to_string(&redirect).unwrap())]

src/html/pages.rs

Lines changed: 58 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use super::sidepanels::SidepanelCtx;
33
use super::symbols::SymbolContentCtx;
44
use super::util::qualify_drilldown_name;
55
use super::util::BreadcrumbsCtx;
6+
use super::util::SectionHeaderCtx;
67
use super::DocNodeKindWithDrilldown;
78
use super::DocNodeWithContext;
89
use super::FileMode;
@@ -93,10 +94,9 @@ impl IndexCtx {
9394
partitions: Partition,
9495
file: Option<ShortPath>,
9596
) -> Self {
96-
let short_path =
97-
specifier
98-
.cloned()
99-
.map(|specifier| ShortPath::new(ctx, specifier));
97+
let short_path = specifier
98+
.cloned()
99+
.map(|specifier| ShortPath::new(ctx, specifier));
100100

101101
// will be default on index page with no main entrypoint
102102
let default = vec![];
@@ -105,13 +105,13 @@ impl IndexCtx {
105105
.and_then(|specifier| doc_nodes_by_url.get(specifier))
106106
.unwrap_or(&default);
107107

108-
let render_ctx = RenderContext::new(
109-
ctx,
110-
doc_nodes,
111-
short_path
112-
.as_ref()
113-
.map_or(UrlResolveKind::Root, UrlResolveKind::File),
114-
);
108+
let render_ctx = RenderContext::new(
109+
ctx,
110+
doc_nodes,
111+
short_path
112+
.as_ref()
113+
.map_or(UrlResolveKind::Root, UrlResolveKind::File),
114+
);
115115

116116
let module_doc = short_path.as_ref().map(|short_path| {
117117
super::jsdoc::ModuleDocCtx::new(&render_ctx, short_path, doc_nodes_by_url)
@@ -128,8 +128,23 @@ impl IndexCtx {
128128
HtmlHeadCtx::new(&root, "Index", ctx.package_name.as_ref(), None);
129129

130130
let all_symbols = if ctx.file_mode == FileMode::SingleDts {
131-
let sections =
132-
super::namespace::render_namespace(&render_ctx, partitions.clone());
131+
let sections = super::namespace::render_namespace(
132+
&render_ctx,
133+
partitions
134+
.clone()
135+
.into_iter()
136+
.map(|(title, nodes)| {
137+
(
138+
SectionHeaderCtx {
139+
title,
140+
href: None,
141+
doc: None,
142+
},
143+
nodes,
144+
)
145+
})
146+
.collect(),
147+
);
133148

134149
Some(SymbolContentCtx {
135150
id: String::new(),
@@ -183,36 +198,36 @@ impl AllSymbolsCtx {
183198
.map(|(path, nodes)| {
184199
let module_doc_nodes = doc_nodes_by_url.get(&path.specifier).unwrap();
185200

186-
let doc = module_doc_nodes
187-
.iter()
188-
.find(|n| n.kind == DocNodeKind::ModuleDoc)
189-
.and_then(|node| node.js_doc.doc.as_ref())
190-
.and_then(|doc| {
191-
markdown_to_html(
192-
&render_ctx,
193-
doc,
194-
MarkdownToHTMLOptions {
195-
summary: true,
196-
summary_prefer_title: true,
197-
render_toc: false,
198-
},
199-
)
200-
})
201-
.map(|markdown| markdown.html);
202-
203-
let header = crate::html::util::SectionHeaderCtx {
204-
title: path.display_name(),
205-
href: Some(render_ctx.ctx.href_resolver.resolve_path(
206-
render_ctx.get_current_resolve(),
207-
path.as_resolve_kind(),
208-
)),
209-
doc,
210-
};
211-
212-
(header, nodes)
213-
})
214-
.collect(),
215-
);
201+
let doc = module_doc_nodes
202+
.iter()
203+
.find(|n| n.kind == DocNodeKind::ModuleDoc)
204+
.and_then(|node| node.js_doc.doc.as_ref())
205+
.and_then(|doc| {
206+
markdown_to_html(
207+
&render_ctx,
208+
doc,
209+
MarkdownToHTMLOptions {
210+
summary: true,
211+
summary_prefer_title: true,
212+
render_toc: false,
213+
},
214+
)
215+
})
216+
.map(|markdown| markdown.html);
217+
218+
let header = crate::html::util::SectionHeaderCtx {
219+
title: path.display_name(),
220+
href: Some(render_ctx.ctx.href_resolver.resolve_path(
221+
render_ctx.get_current_resolve(),
222+
path.as_resolve_kind(),
223+
)),
224+
doc,
225+
};
226+
227+
(header, nodes)
228+
})
229+
.collect(),
230+
);
216231

217232
let html_head_ctx =
218233
HtmlHeadCtx::new("./", "All Symbols", ctx.package_name.as_ref(), None);

0 commit comments

Comments
 (0)