rustdoc: Cleanup

This commit is contained in:
Brian Anderson 2012-01-16 15:44:10 -08:00
parent 6e0bcb5bd0
commit 04294e437b
4 changed files with 11 additions and 25 deletions

View File

@ -14,7 +14,7 @@ type fndoc = ~{
id: ast_id,
name: str,
brief: str,
desc: option::t<str>,
desc: option<str>,
return: option<retdoc>,
args: [(str, str)]
};

View File

@ -24,7 +24,6 @@ fn moddoc_from_mod(
module: ast::_mod,
name: ast::ident,
_attrs: [ast::attribute]
) -> doc::moddoc {
~{
name: name,

View File

@ -19,6 +19,10 @@ fn write_markdown(
write_top_module(ctxt, doc.topmod);
}
fn write_header(ctxt: ctxt, name: str) {
ctxt.w.write_line("# Crate " + name);
}
fn write_top_module(
ctxt: ctxt,
moddoc: doc::moddoc
@ -48,29 +52,9 @@ fn write_mod_contents(
fn write_fn(
ctxt: ctxt,
fndoc: doc::fndoc
doc: doc::fndoc
) {
write_fndoc(ctxt, fndoc.name, fndoc);
}
#[doc(
brief = "Generate a crate document header.",
args(rd = "Rustdoc context",
name = "Crate name")
)]
fn write_header(ctxt: ctxt, name: str) {
ctxt.w.write_line("# Crate " + name);
}
#[doc(
brief = "Documents a single function.",
args(rd = "Rustdoc context",
ident = "Identifier for this function",
doc = "Function docs extracted from attributes",
_fn = "AST object representing this function")
)]
fn write_fndoc(ctxt: ctxt, ident: str, doc: doc::fndoc) {
ctxt.w.write_line("## Function `" + ident + "`");
ctxt.w.write_line("## Function `" + doc.name + "`");
ctxt.w.write_line(doc.brief);
alt doc.desc {
some(_d) {

View File

@ -2,7 +2,10 @@ import rustc::syntax::ast;
export run;
fn run(doc: doc::cratedoc, crate: @ast::crate) -> doc::cratedoc {
fn run(
doc: doc::cratedoc,
crate: @ast::crate
) -> doc::cratedoc {
let fold = fold::fold({
fold_fn: fn~(
f: fold::fold<@ast::crate>,