::const_iterator op = entries.begin();
op != entries.end();)
{
if(op->Name.size())
{
os << "\n";
}
else
{
this->PrintFormatted(os, op->Brief.c_str());
os << "\n";
++op;
}
}
}
void cmDocumentationFormatterHTML::PrintPreformatted(std::ostream& os,
const char* text)
{
os << "";
this->PrintHTMLEscapes(os, text);
os << "
\n ";
}
void cmDocumentationFormatterHTML::PrintParagraph(std::ostream& os,
const char* text)
{
os << "";
this->PrintHTMLEscapes(os, text);
os << "
\n";
}
//----------------------------------------------------------------------------
void cmDocumentationFormatterHTML::PrintHeader(const char* docname,
const char* appname,
std::ostream& os)
{
os << "\n";
os << "\n";
os << "";
os << docname << " - " << appname;
os << "\n";
}
//----------------------------------------------------------------------------
void cmDocumentationFormatterHTML::PrintFooter(std::ostream& os)
{
os << "\n";
}
//----------------------------------------------------------------------------
void cmDocumentationFormatterHTML::PrintHTMLEscapes(std::ostream& os,
const char* text)
{
// Hyperlink prefixes.
static const char* hyperlinks[] = {"http://", "ftp://", "mailto:", 0};
// Print each character.
for(const char* p = text; *p;)
{
// Handle hyperlinks specially to make them active.
bool found_hyperlink = false;
for(const char** h = hyperlinks; !found_hyperlink && *h; ++h)
{
if(strncmp(p, *h, strlen(*h)) == 0)
{
p = cmDocumentationPrintHTMLLink(os, p);
found_hyperlink = true;
}
}
// Print other characters normally.
if(!found_hyperlink)
{
cmDocumentationPrintHTMLChar(os, *p++);
}
}
}
void cmDocumentationFormatterHTML
::PrintIndex(std::ostream& os,
std::vector& sections)
{
// skip the index if only the help for a single item is printed
if ((sections.size() == 1)
&& (sections[0]->GetName(this->GetForm()) != 0 )
&& (std::string(sections[0]->GetName(this->GetForm())) == "SingleItem"))
{
return;
}
os << "\n";
if (!sections.empty())
{
os << "\n";
for(unsigned int i=0; i < sections.size(); ++i)
{
std::string name = sections[i]->GetName((this->GetForm()));
os << " - " << name << "
\n";
}
os << "
\n";
}
}