Skip to content

Commit dc74fe0

Browse files
committed
---
yaml --- r: 7359 b: refs/heads/master c: ba41342 h: refs/heads/master i: 7357: dfff3c6 7355: 8ac3d05 7351: 7528263 7343: f364ae5 7327: d2f47f5 7295: cbb1ea9 v: v3
1 parent ac8f6ee commit dc74fe0

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: ab86642e35220cd1469b9eb288ab084625d77c5d
2+
refs/heads/master: ba41342279a7949d746f9de0d7211efc5070929a

trunk/src/rustdoc/gen.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,16 @@ fn write_header(ctxt: ctxt, title: str) {
2525
ctxt.w.write_line(#fmt("%s %s", hashes, title));
2626
}
2727

28+
fn subsection(ctxt: ctxt, f: fn&()) {
29+
ctxt.depth += 1u;
30+
f();
31+
ctxt.depth -= 1u;
32+
}
33+
2834
fn write_crate(
2935
ctxt: ctxt,
3036
doc: doc::cratedoc
3137
) {
32-
ctxt.depth = 1u;
3338
write_header(ctxt, #fmt("Crate %s", doc.topmod.name));
3439
write_top_module(ctxt, doc.topmod);
3540
}
@@ -53,19 +58,22 @@ fn write_mod_contents(
5358
moddoc: doc::moddoc
5459
) {
5560
for fndoc in *moddoc.fns {
56-
write_fn(ctxt, fndoc);
61+
subsection(ctxt) {||
62+
write_fn(ctxt, fndoc);
63+
}
5764
}
5865

5966
for moddoc in *moddoc.mods {
60-
write_mod(ctxt, moddoc);
67+
subsection(ctxt) {||
68+
write_mod(ctxt, moddoc);
69+
}
6170
}
6271
}
6372

6473
fn write_fn(
6574
ctxt: ctxt,
6675
doc: doc::fndoc
6776
) {
68-
ctxt.depth = 2u;
6977
write_header(ctxt, #fmt("Function `%s`", doc.name));
7078
alt doc.brief {
7179
some(brief) {

0 commit comments

Comments
 (0)