Major reformatting of auto-generated reST documentation.

Introduces reST directives and roles in a "bro" domain that Sphinx
will be taught to recognize.
This commit is contained in:
Jon Siwek 2011-03-22 16:05:59 -05:00
parent 384fa03c26
commit bbe7c98ab3
11 changed files with 132 additions and 45 deletions

View file

@ -607,39 +607,57 @@ void ID::DescribeExtended(ODesc* d) const
}
}
void ID::DescribeReST(ODesc* d) const
void ID::DescribeReST(ODesc* d, bool is_role) const
{
d->Add(".. bro:id:: ");
d->Add(name);
if ( is_role )
{
if ( is_type )
d->Add(":bro:type:`");
else
d->Add(":bro:id:`");
d->Add(name);
d->Add("`");
}
else
{
if ( is_type )
d->Add(".. bro:type:: ");
else
d->Add(".. bro:id:: ");
d->Add(name);
}
d->PushIndent();
d->NL();
if ( type )
{
d->Add(".. bro:type:: ");
d->Add(":Type: ");
if ( ! is_type && type->GetTypeID() )
{
d->Add("`");
d->Add(":bro:type:`");
d->Add(type->GetTypeID());
d->Add("`");
}
else
type->DescribeReST(d);
d->NL();
}
if ( attrs )
{
d->Add(":Attributes: ");
attrs->DescribeReST(d);
d->NL();
}
if ( val && type &&
type->InternalType() != TYPE_INTERNAL_OTHER &&
type->InternalType() != TYPE_INTERNAL_VOID )
{
d->NL();
d->Add(".. bro:val:: ");
d->Add(":Init: ");
val->DescribeReST(d);
d->NL();
}
}
#ifdef DEBUG