rustdoc: Move document model into doc module
This commit is contained in:
parent
e32cf827ff
commit
140fbd3019
|
@ -0,0 +1,14 @@
|
||||||
|
type cratedoc = {
|
||||||
|
mods: [moddoc]
|
||||||
|
};
|
||||||
|
|
||||||
|
type moddoc = {
|
||||||
|
fns: [fndoc]
|
||||||
|
};
|
||||||
|
|
||||||
|
type fndoc = {
|
||||||
|
brief: str,
|
||||||
|
desc: option::t<str>,
|
||||||
|
return: option::t<str>,
|
||||||
|
args: map::hashmap<str, str>
|
||||||
|
};
|
|
@ -8,3 +8,4 @@
|
||||||
#[crate_type = "bin"];
|
#[crate_type = "bin"];
|
||||||
|
|
||||||
mod parse;
|
mod parse;
|
||||||
|
mod doc;
|
|
@ -22,21 +22,6 @@ type rustdoc = {
|
||||||
w: io::writer
|
w: io::writer
|
||||||
};
|
};
|
||||||
|
|
||||||
type cratedoc = {
|
|
||||||
mods: [moddoc]
|
|
||||||
};
|
|
||||||
|
|
||||||
type moddoc = {
|
|
||||||
fns: [fndoc]
|
|
||||||
};
|
|
||||||
|
|
||||||
type fndoc = {
|
|
||||||
brief: str,
|
|
||||||
desc: option::t<str>,
|
|
||||||
return: option::t<str>,
|
|
||||||
args: map::hashmap<str, str>
|
|
||||||
};
|
|
||||||
|
|
||||||
#[doc(
|
#[doc(
|
||||||
brief = "Documents a single function.",
|
brief = "Documents a single function.",
|
||||||
args(rd = "Rustdoc context",
|
args(rd = "Rustdoc context",
|
||||||
|
@ -44,7 +29,7 @@ type fndoc = {
|
||||||
doc = "Function docs extracted from attributes",
|
doc = "Function docs extracted from attributes",
|
||||||
_fn = "AST object representing this function")
|
_fn = "AST object representing this function")
|
||||||
)]
|
)]
|
||||||
fn doc_fn(rd: rustdoc, ident: str, doc: fndoc, decl: ast::fn_decl) {
|
fn doc_fn(rd: rustdoc, ident: str, doc: doc::fndoc, decl: ast::fn_decl) {
|
||||||
rd.w.write_line("## Function `" + ident + "`");
|
rd.w.write_line("## Function `" + ident + "`");
|
||||||
rd.w.write_line(doc.brief);
|
rd.w.write_line(doc.brief);
|
||||||
alt doc.desc {
|
alt doc.desc {
|
||||||
|
@ -84,7 +69,7 @@ fn doc_fn(rd: rustdoc, ident: str, doc: fndoc, decl: ast::fn_decl) {
|
||||||
args(items = "Doc attribute contents"),
|
args(items = "Doc attribute contents"),
|
||||||
return = "Parsed function docs."
|
return = "Parsed function docs."
|
||||||
)]
|
)]
|
||||||
fn parse_compound_fndoc(items: [@ast::meta_item]) -> fndoc {
|
fn parse_compound_fndoc(items: [@ast::meta_item]) -> doc::fndoc {
|
||||||
let brief = none;
|
let brief = none;
|
||||||
let desc = none;
|
let desc = none;
|
||||||
let return = none;
|
let return = none;
|
||||||
|
|
Loading…
Reference in New Issue