Suppress unused var, beautify code, avoid 1 extra newline.
There remains extra newlines in text Formatter output but the parser does not seem to be the culprit. The formatter should be.
This commit is contained in:
parent
751713f54b
commit
62b589b4cd
|
@ -724,7 +724,6 @@ void cmDocumentation::addCMakeStandardDocSections()
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmDocumentation::addCTestStandardDocSections()
|
void cmDocumentation::addCTestStandardDocSections()
|
||||||
{
|
{
|
||||||
cmDocumentationSection *sec;
|
|
||||||
// This is currently done for backward compatibility reason
|
// This is currently done for backward compatibility reason
|
||||||
// We may suppress some of these.
|
// We may suppress some of these.
|
||||||
addCMakeStandardDocSections();
|
addCMakeStandardDocSections();
|
||||||
|
@ -749,12 +748,16 @@ void cmDocumentation::addCPackStandardDocSections()
|
||||||
static void trim(std::string& s)
|
static void trim(std::string& s)
|
||||||
{
|
{
|
||||||
std::string::size_type pos = s.find_last_not_of(' ');
|
std::string::size_type pos = s.find_last_not_of(' ');
|
||||||
if(pos != std::string::npos) {
|
if(pos != std::string::npos)
|
||||||
|
{
|
||||||
s.erase(pos + 1);
|
s.erase(pos + 1);
|
||||||
pos = s.find_first_not_of(' ');
|
pos = s.find_first_not_of(' ');
|
||||||
if(pos != std::string::npos) s.erase(0, pos);
|
if(pos != std::string::npos) s.erase(0, pos);
|
||||||
}
|
}
|
||||||
else s.erase(s.begin(), s.end());
|
else
|
||||||
|
{
|
||||||
|
s.erase(s.begin(), s.end());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int cmDocumentation::GetStructuredDocFromFile(
|
int cmDocumentation::GetStructuredDocFromFile(
|
||||||
|
@ -792,7 +795,8 @@ int cmDocumentation::GetStructuredDocFromFile(
|
||||||
if(line.size() && line[0] == '#')
|
if(line.size() && line[0] == '#')
|
||||||
{
|
{
|
||||||
/* handle structured doc context */
|
/* handle structured doc context */
|
||||||
if (line[1]=='#') {
|
if (line[1]=='#')
|
||||||
|
{
|
||||||
std::string mkword = line.substr(2,std::string::npos);
|
std::string mkword = line.substr(2,std::string::npos);
|
||||||
if (mkword=="macro")
|
if (mkword=="macro")
|
||||||
{
|
{
|
||||||
|
@ -904,7 +908,10 @@ int cmDocumentation::GetStructuredDocFromFile(
|
||||||
inBrief = false;
|
inBrief = false;
|
||||||
full = "";
|
full = "";
|
||||||
} else {
|
} else {
|
||||||
full += "\n";
|
if (full.length()>0)
|
||||||
|
{
|
||||||
|
full += "\n";
|
||||||
|
}
|
||||||
// the first paragraph of full has ended
|
// the first paragraph of full has ended
|
||||||
inFullFirstParagraph = false;
|
inFullFirstParagraph = false;
|
||||||
}
|
}
|
||||||
|
@ -949,18 +956,18 @@ int cmDocumentation::GetStructuredDocFromFile(
|
||||||
*text += "\n";
|
*text += "\n";
|
||||||
newParagraph = true;
|
newParagraph = true;
|
||||||
}
|
}
|
||||||
// Skip #, and leave space for pre-formatted
|
// Skip #, and leave space for pre-formatted
|
||||||
if (inFullFirstParagraph)
|
if (inFullFirstParagraph)
|
||||||
{
|
{
|
||||||
std::string temp = line.c_str()+1;
|
std::string temp = line.c_str()+1;
|
||||||
trim(temp);
|
trim(temp);
|
||||||
*text += " " + temp;
|
*text += " " + temp;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*text += line.c_str()+1;
|
*text += line.c_str()+1;
|
||||||
*text += "\n";
|
*text += "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(line[1] == ' ')
|
else if(line[1] == ' ')
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue