Skip to content

Commit f249817

Browse files
committed
show template arguments from source for classes
finishes #4
1 parent 006aa63 commit f249817

File tree

2 files changed

+35
-27
lines changed

2 files changed

+35
-27
lines changed

src/builder/shared.rs

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -352,32 +352,36 @@ pub fn fmt_base_classes<'e, T: ASTEntry<'e>>(entry: &T, kw: &str, builder: &Buil
352352

353353
HtmlElement::new("div")
354354
.with_classes(&["entity", "class"])
355-
.with_child(Html::span(&["keyword", "space-after"], kw))
356-
.with_child(Html::span(&["name"], entry.name().as_str()))
357-
.with_child_opt((!bases.is_empty()).then_some(
358-
Html::span(&["space-before", "space-after"], ":")
359-
))
360-
.with_children(bases.into_iter()
361-
.map(|base| HtmlList::new([
362-
base.get_accessibility().map(|a|
363-
Html::span(
364-
&["keyword", "space-after"],
365-
match a {
366-
Accessibility::Public => "public",
367-
Accessibility::Private => "private",
368-
Accessibility::Protected => "protected",
369-
}
370-
)
371-
),
372-
base.is_virtual_base().then_some(
373-
Html::span(&["keyword", "space-after"], "virtual")
374-
),
375-
base.get_type().map(|ty| fmt_type(&ty, builder))
376-
].into_iter().flatten().collect()).into())
377-
.intersperse_with(|| Html::span(&["space-after"], ",").into())
378-
.collect()
355+
.with_child_opt(fmt_template_args(entry.entity(), builder))
356+
.with_child(HtmlElement::new("span")
357+
.with_class("class-decl")
358+
.with_child(Html::span(&["keyword", "space-after"], kw))
359+
.with_child(Html::span(&["name"], entry.entity().get_name().unwrap_or("_".into()).as_str()))
360+
.with_child_opt((!bases.is_empty()).then_some(
361+
Html::span(&["space-before", "space-after"], ":")
362+
))
363+
.with_children(bases.into_iter()
364+
.map(|base| HtmlList::new([
365+
base.get_accessibility().map(|a|
366+
Html::span(
367+
&["keyword", "space-after"],
368+
match a {
369+
Accessibility::Public => "public",
370+
Accessibility::Private => "private",
371+
Accessibility::Protected => "protected",
372+
}
373+
)
374+
),
375+
base.is_virtual_base().then_some(
376+
Html::span(&["keyword", "space-after"], "virtual")
377+
),
378+
base.get_type().map(|ty| fmt_type(&ty, builder))
379+
].into_iter().flatten().collect()).into())
380+
.intersperse_with(|| Html::span(&["space-after"], ",").into())
381+
.collect()
382+
)
383+
.with_child(Html::span(&["space-before"], "{ ... }"))
379384
)
380-
.with_child(Html::span(&["space-before"], "{ ... }"))
381385
.into()
382386
}
383387

templates/content.css

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -559,11 +559,15 @@ details.entity-desc[open] > summary .feather-chevron-right {
559559
color: var(--flash-orange);
560560
}
561561

562-
.entity.class > .name, .class.name {
562+
.entity.class, .entity.struct {
563+
flex-direction: column;
564+
}
565+
566+
.entity.class > .class-decl > .name, .class.name {
563567
color: var(--flash-yellow);
564568
}
565569

566-
.entity.struct > .name, .struct.name {
570+
.entity.struct > .class-decl > .name, .struct.name {
567571
color: var(--flash-yellow);
568572
}
569573

0 commit comments

Comments
 (0)