2007-09-19 17:05:28 +04:00
|
|
|
/*=========================================================================
|
|
|
|
|
|
|
|
Program: CMake - Cross-Platform Makefile Generator
|
|
|
|
Module: $RCSfile$
|
|
|
|
Language: C++
|
|
|
|
Date: $Date$
|
|
|
|
Version: $Revision$
|
|
|
|
|
|
|
|
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
|
|
|
|
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
|
|
|
|
|
|
|
|
This software is distributed WITHOUT ANY WARRANTY; without even
|
|
|
|
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
PURPOSE. See the above copyright notices for more information.
|
|
|
|
|
|
|
|
=========================================================================*/
|
|
|
|
|
|
|
|
#include "cmDocumentationFormatterMan.h"
|
2007-10-22 20:49:09 +04:00
|
|
|
#include "cmDocumentationSection.h"
|
2007-09-19 17:05:28 +04:00
|
|
|
|
|
|
|
#include "cmSystemTools.h"
|
|
|
|
#include "cmVersion.h"
|
|
|
|
|
|
|
|
|
|
|
|
cmDocumentationFormatterMan::cmDocumentationFormatterMan()
|
|
|
|
:cmDocumentationFormatter()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2007-10-22 20:49:09 +04:00
|
|
|
void cmDocumentationFormatterMan
|
|
|
|
::PrintSection(std::ostream& os,
|
|
|
|
const cmDocumentationSection §ion,
|
|
|
|
const char* name)
|
2007-09-19 17:05:28 +04:00
|
|
|
{
|
|
|
|
if(name)
|
|
|
|
{
|
|
|
|
os << ".SH " << name << "\n";
|
|
|
|
}
|
2007-10-22 20:49:09 +04:00
|
|
|
|
|
|
|
const std::vector<cmDocumentationEntry> &entries =
|
|
|
|
section.GetEntries();
|
|
|
|
for(std::vector<cmDocumentationEntry>::const_iterator op = entries.begin();
|
|
|
|
op != entries.end(); ++op)
|
2007-09-19 17:05:28 +04:00
|
|
|
{
|
2007-10-22 20:49:09 +04:00
|
|
|
if(op->Name.size())
|
2007-09-19 17:05:28 +04:00
|
|
|
{
|
|
|
|
os << ".TP\n"
|
2007-10-22 20:49:09 +04:00
|
|
|
<< ".B " << (op->Name.size()?op->Name.c_str():"*") << "\n";
|
|
|
|
this->PrintFormatted(os, op->Brief.c_str());
|
|
|
|
this->PrintFormatted(os, op->Full.c_str());
|
2007-09-19 17:05:28 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
os << ".PP\n";
|
2007-10-22 20:49:09 +04:00
|
|
|
this->PrintFormatted(os, op->Brief.c_str());
|
2007-09-19 17:05:28 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void cmDocumentationFormatterMan::PrintPreformatted(std::ostream& os,
|
|
|
|
const char* text)
|
|
|
|
{
|
|
|
|
std::string man_text = text;
|
|
|
|
cmSystemTools::ReplaceString(man_text, "\\", "\\\\");
|
|
|
|
os << man_text << "\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
void cmDocumentationFormatterMan::PrintParagraph(std::ostream& os,
|
|
|
|
const char* text)
|
|
|
|
{
|
|
|
|
std::string man_text = text;
|
|
|
|
cmSystemTools::ReplaceString(man_text, "\\", "\\\\");
|
|
|
|
os << man_text << "\n\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void cmDocumentationFormatterMan::PrintHeader(const char* name,
|
|
|
|
std::ostream& os)
|
|
|
|
{
|
|
|
|
os << ".TH " << name << " 1 \""
|
|
|
|
<< cmSystemTools::GetCurrentDateTime("%B %d, %Y").c_str()
|
2007-09-19 17:59:34 +04:00
|
|
|
<< "\" \"" << name
|
2007-09-19 17:05:28 +04:00
|
|
|
<< " " << cmVersion::GetCMakeVersion()
|
|
|
|
<< "\"\n";
|
|
|
|
}
|
|
|
|
|