Skip to content

Commit b391542

Browse files
committed
rustdoc: Attach the doc writer to the doc extractor
1 parent a8428a8 commit b391542

File tree

1 file changed

+5
-30
lines changed

1 file changed

+5
-30
lines changed

src/rustdoc/rustdoc.rs

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,6 @@ import std::io;
1717
import io::writer_util;
1818
import std::map;
1919

20-
#[doc(
21-
brief = "Documents a single crate item.",
22-
args(rd = "Rustdoc context",
23-
item = "AST item to document")
24-
)]
25-
fn doc_item(ctxt: gen::ctxt, item: @ast::item) {
26-
let _fndoc0 = attr_parser::parse_fn(item.ident, item.id, item.attrs);
27-
28-
alt item.node {
29-
ast::item_const(ty, expr) { }
30-
ast::item_fn(decl, _, _) {
31-
gen::write_fndoc(ctxt, item.ident, _fndoc0, decl);
32-
}
33-
ast::item_mod(_mod) { }
34-
ast::item_ty(ty, typarams) { }
35-
ast::item_tag(variant, typarams) { }
36-
ast::item_res(_, _, _, _, _) { }
37-
};
38-
}
39-
4020
#[doc(
4121
brief = "Main function.",
4222
desc = "Command-line arguments:
@@ -51,14 +31,9 @@ fn main(argv: [str]) {
5131
ret;
5232
}
5333

54-
let crate = parse::from_file(argv[1]);
55-
56-
let w = io::stdout();
57-
let ctxt = { ps: pprust::rust_printer(w), w: w };
58-
gen::write_header(ctxt, argv[1]);
59-
60-
let v = visit::mk_simple_visitor(@{
61-
visit_item: bind doc_item(ctxt, _)
62-
with *visit::default_simple_visitor()});
63-
visit::visit_crate(*crate, (), v);
34+
let source_file = argv[1];
35+
let default_name = source_file;
36+
let crate = parse::from_file(source_file);
37+
let doc = extract::extract(crate, default_name);
38+
gen::write_markdown(doc, crate, io::stdout());
6439
}

0 commit comments

Comments
 (0)