rustdoc: Cleanup
This commit is contained in:
parent
6e0bcb5bd0
commit
04294e437b
@ -14,7 +14,7 @@ type fndoc = ~{
|
|||||||
id: ast_id,
|
id: ast_id,
|
||||||
name: str,
|
name: str,
|
||||||
brief: str,
|
brief: str,
|
||||||
desc: option::t<str>,
|
desc: option<str>,
|
||||||
return: option<retdoc>,
|
return: option<retdoc>,
|
||||||
args: [(str, str)]
|
args: [(str, str)]
|
||||||
};
|
};
|
||||||
|
@ -24,7 +24,6 @@ fn moddoc_from_mod(
|
|||||||
module: ast::_mod,
|
module: ast::_mod,
|
||||||
name: ast::ident,
|
name: ast::ident,
|
||||||
_attrs: [ast::attribute]
|
_attrs: [ast::attribute]
|
||||||
|
|
||||||
) -> doc::moddoc {
|
) -> doc::moddoc {
|
||||||
~{
|
~{
|
||||||
name: name,
|
name: name,
|
||||||
|
@ -19,6 +19,10 @@ fn write_markdown(
|
|||||||
write_top_module(ctxt, doc.topmod);
|
write_top_module(ctxt, doc.topmod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn write_header(ctxt: ctxt, name: str) {
|
||||||
|
ctxt.w.write_line("# Crate " + name);
|
||||||
|
}
|
||||||
|
|
||||||
fn write_top_module(
|
fn write_top_module(
|
||||||
ctxt: ctxt,
|
ctxt: ctxt,
|
||||||
moddoc: doc::moddoc
|
moddoc: doc::moddoc
|
||||||
@ -48,29 +52,9 @@ fn write_mod_contents(
|
|||||||
|
|
||||||
fn write_fn(
|
fn write_fn(
|
||||||
ctxt: ctxt,
|
ctxt: ctxt,
|
||||||
fndoc: doc::fndoc
|
doc: doc::fndoc
|
||||||
) {
|
) {
|
||||||
write_fndoc(ctxt, fndoc.name, fndoc);
|
ctxt.w.write_line("## Function `" + doc.name + "`");
|
||||||
}
|
|
||||||
|
|
||||||
#[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(doc.brief);
|
ctxt.w.write_line(doc.brief);
|
||||||
alt doc.desc {
|
alt doc.desc {
|
||||||
some(_d) {
|
some(_d) {
|
||||||
|
@ -2,7 +2,10 @@ import rustc::syntax::ast;
|
|||||||
|
|
||||||
export run;
|
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({
|
let fold = fold::fold({
|
||||||
fold_fn: fn~(
|
fold_fn: fn~(
|
||||||
f: fold::fold<@ast::crate>,
|
f: fold::fold<@ast::crate>,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user