From 5771dd2f15f871eb44b31fa84d67fa587654b770 Mon Sep 17 00:00:00 2001 From: Simon Harvey Date: Mon, 1 Mar 2010 12:15:25 +0000 Subject: Documentation: Comply with "XHTML 1.0 Strict" Ensure that the HTML documentation generated by CMake complies with "XHTML 1.0 Strict": - All tags are properly closed and DOCTYPE is specified - Useful for downstream XML-processors (e.g. for extracting section titles) See issue #10338. Signed-off-by: Simon Harvey --- Source/cmDocumentationFormatterHTML.cxx | 66 +++++++++++++++++++++------------ 1 file changed, 43 insertions(+), 23 deletions(-) diff --git a/Source/cmDocumentationFormatterHTML.cxx b/Source/cmDocumentationFormatterHTML.cxx index 09aff8d..6ced1e4 100644 --- a/Source/cmDocumentationFormatterHTML.cxx +++ b/Source/cmDocumentationFormatterHTML.cxx @@ -39,7 +39,7 @@ static void cmDocumentationPrintHTMLChar(std::ostream& os, char c) os << "&"; break; case '\n': - os << "
"; + os << "
"; break; default: os << c; @@ -125,23 +125,33 @@ void cmDocumentationFormatterHTML { if (name) { - os << "

" << name << "

\n"; + os << "

" << name << "

\n"; } - os << "\n" ; } for(std::vector::const_iterator op = entries.begin(); @@ -164,7 +174,7 @@ void cmDocumentationFormatterHTML this->PrintHTMLEscapes(os, op->Brief.c_str()); if(op->Full.size()) { - os << "
\n "; + os << "
\n "; this->PrintFormatted(os, op->Full.c_str()); } os << "\n"; @@ -194,6 +204,7 @@ void cmDocumentationFormatterHTML::PrintParagraph(std::ostream& os, { os << "

"; this->PrintHTMLEscapes(os, text); + os << "

\n"; } //---------------------------------------------------------------------------- @@ -201,7 +212,12 @@ void cmDocumentationFormatterHTML::PrintHeader(const char* docname, const char* appname, std::ostream& os) { - os << ""; + os << "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"" + << " \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n"; + os << "<html xmlns=\"http://www.w3.org/1999/xhtml\"" + << " xml:lang=\"en\" lang=\"en\">\n"; + os << "<head><meta http-equiv=\"Content-Type\" " + << "content=\"text/html;charset=utf-8\" /><title>"; os << docname << " - " << appname; os << "\n"; } @@ -253,16 +269,20 @@ void cmDocumentationFormatterHTML return; } - os << "

Master Index " + os << "

Master Index " << "CMake " << cmVersion::GetCMakeVersion() - << "

\n"; - os << "

\n"; + + if (!sections.empty()) { - std::string name = sections[i]-> - GetName((this->GetForm())); - os << "
  • " << name << "
  • \n"; + os << "
      \n"; + for(unsigned int i=0; i < sections.size(); ++i) + { + std::string name = sections[i]->GetName((this->GetForm())); + os << "
    • " << name << "
    • \n"; + } + os << "
    \n"; } - os << "\n"; } -- cgit v0.12