[Cmake-commits] [cmake-commits] alex committed cmDocumentation.cxx 1.69 1.70 cmDocumentationFormatter.cxx 1.2 1.3 cmDocumentationFormatterHTML.cxx 1.12 1.13

cmake-commits at cmake.org cmake-commits at cmake.org
Mon Jul 21 17:53:02 EDT 2008


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv12212

Modified Files:
	cmDocumentation.cxx cmDocumentationFormatter.cxx 
	cmDocumentationFormatterHTML.cxx 
Log Message:
ENH: handle HTML documentation for single items better: no warning about
ComputeSectionLinkPrefix, don't create an index for only one item

Alex


Index: cmDocumentation.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmDocumentation.cxx,v
retrieving revision 1.69
retrieving revision 1.70
diff -C 2 -d -r1.69 -r1.70
*** cmDocumentation.cxx	5 Mar 2008 16:05:20 -0000	1.69
--- cmDocumentation.cxx	21 Jul 2008 21:52:51 -0000	1.70
***************
*** 1351,1355 ****
                              const cmDocumentationEntry &entry)
  {
!   cmDocumentationSection *sec = new cmDocumentationSection("","");
    sec->Append(entry);
    this->AllSections["temp"] = sec;
--- 1351,1357 ----
                              const cmDocumentationEntry &entry)
  {
!   // the string "SingleItem" will be used in a few places to detect the case
!   // that only the documentation for a single item is printed
!   cmDocumentationSection *sec = new cmDocumentationSection("SingleItem","");
    sec->Append(entry);
    this->AllSections["temp"] = sec;

Index: cmDocumentationFormatterHTML.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmDocumentationFormatterHTML.cxx,v
retrieving revision 1.12
retrieving revision 1.13
diff -C 2 -d -r1.12 -r1.13
*** cmDocumentationFormatterHTML.cxx	5 May 2008 16:02:36 -0000	1.12
--- cmDocumentationFormatterHTML.cxx	21 Jul 2008 21:52:59 -0000	1.13
***************
*** 118,126 ****
                 const char* name)
  {
-   if(name)
-     {
-     os << "<h2><a name=\"section_" << name << "\"/>" << name << "</h2>\n";
-     }
- 
    std::string prefix = this->ComputeSectionLinkPrefix(name);
  
--- 118,121 ----
***************
*** 128,145 ****
      section.GetEntries();
  
!   os << "<ul>\n";
!   for(std::vector<cmDocumentationEntry>::const_iterator op 
!         = entries.begin(); op != entries.end(); ++ op )
      {
!     if(op->Name.size())
        {
!       os << "    <li><a href=\"#" << prefix << ":";
!       cmDocumentationPrintHTMLId(os, op->Name.c_str());
!       os << "\"><b><code>";
!       this->PrintHTMLEscapes(os, op->Name.c_str());
!       os << "</code></b></a></li>";
        }
      }
-   os << "</ul>\n" ;
  
    for(std::vector<cmDocumentationEntry>::const_iterator op = entries.begin(); 
--- 123,152 ----
      section.GetEntries();
  
!   // skip the index if the help for only a single item (--help-command,
!   // --help-policy, --help-property, --help-module) is printed
!   bool isSingleItemHelp = ((name!=0) && (strcmp(name, "SingleItem")==0));
! 
!   if (!isSingleItemHelp)
      {
!     if (name)
        {
!       os << "<h2><a name=\"section_" << name << "\"/>" << name << "</h2>\n";
        }
+ 
+     os << "<ul>\n";
+     for(std::vector<cmDocumentationEntry>::const_iterator op 
+          = entries.begin(); op != entries.end(); ++ op )
+       {
+       if(op->Name.size())
+          {
+          os << "    <li><a href=\"#" << prefix << ":";
+          cmDocumentationPrintHTMLId(os, op->Name.c_str());
+          os << "\"><b><code>";
+          this->PrintHTMLEscapes(os, op->Name.c_str());
+          os << "</code></b></a></li>";
+          }
+       }
+     os << "</ul>\n" ;
      }
  
    for(std::vector<cmDocumentationEntry>::const_iterator op = entries.begin(); 
***************
*** 241,244 ****
--- 248,259 ----
               std::vector<const cmDocumentationSection *>& 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 << "<h2><a name=\"section_Index\"/>Master Index</h2>\n";
    os << "<ul>\n";

Index: cmDocumentationFormatter.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmDocumentationFormatter.cxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -C 2 -d -r1.2 -r1.3
*** cmDocumentationFormatter.cxx	5 May 2008 16:02:36 -0000	1.2
--- cmDocumentationFormatter.cxx	21 Jul 2008 21:52:58 -0000	1.3
***************
*** 147,150 ****
--- 147,154 ----
      return "see";
      }
+   else if(name.find("SingleItem") != name.npos)
+     {
+     return "single_item";
+     }
    else
      {



More information about the Cmake-commits mailing list