Skip to content

Commit

Permalink
For manpages remove trailing dash when no brief description
Browse files Browse the repository at this point in the history
  • Loading branch information
artur-kink committed Sep 25, 2016
1 parent d4beb39 commit 98d3f8e
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 9 deletions.
3 changes: 3 additions & 0 deletions src/classdef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -954,6 +954,9 @@ void ClassDef::writeBriefDescription(OutputList &ol,bool exampleFlag)
if (hasBriefDescription())
{
ol.startParagraph();
ol.disableAllBut(OutputGenerator::Man);
ol.writeString(" - ");
ol.enableAll();
ol.generateDoc(briefFile(),briefLine(),this,0,
briefDescription(),TRUE,FALSE,0,TRUE,FALSE);
ol.pushGeneratorState();
Expand Down
5 changes: 4 additions & 1 deletion src/dirdef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,16 @@ void DirDef::writeDetailedDescription(OutputList &ol,const QCString &title)

void DirDef::writeBriefDescription(OutputList &ol)
{
if (!briefDescription().isEmpty() && Config_getBool(BRIEF_MEMBER_DESC))
if (hasBriefDescription())
{
DocRoot *rootNode = validatingParseDoc(
briefFile(),briefLine(),this,0,briefDescription(),TRUE,FALSE);
if (rootNode && !rootNode->isEmpty())
{
ol.startParagraph();
ol.disableAllBut(OutputGenerator::Man);
ol.writeString(" - ");
ol.enableAll();
ol.writeDoc(rootNode,this,0);
ol.pushGeneratorState();
ol.disable(OutputGenerator::RTF);
Expand Down
5 changes: 4 additions & 1 deletion src/filedef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,14 +365,17 @@ void FileDef::writeDetailedDescription(OutputList &ol,const QCString &title)

void FileDef::writeBriefDescription(OutputList &ol)
{
if (!briefDescription().isEmpty() && Config_getBool(BRIEF_MEMBER_DESC))
if (hasBriefDescription())
{
DocRoot *rootNode = validatingParseDoc(briefFile(),briefLine(),this,0,
briefDescription(),TRUE,FALSE,0,TRUE,FALSE);

if (rootNode && !rootNode->isEmpty())
{
ol.startParagraph();
ol.disableAllBut(OutputGenerator::Man);
ol.writeString(" - ");
ol.enableAll();
ol.writeDoc(rootNode,this,0);
ol.pushGeneratorState();
ol.disable(OutputGenerator::RTF);
Expand Down
17 changes: 12 additions & 5 deletions src/groupdef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -711,8 +711,11 @@ void GroupDef::writeDetailedDescription(OutputList &ol,const QCString &title)
|| !documentation().isEmpty() || !inbodyDocumentation().isEmpty()
)
{
ol.pushGeneratorState();
ol.disableAllBut(OutputGenerator::Man); // always print title for man page
if (pageDict->count()!=countMembers()) // not only pages -> classical layout
{
ol.enableAll();
ol.pushGeneratorState();
ol.disable(OutputGenerator::Html);
ol.writeRuler();
Expand All @@ -721,10 +724,11 @@ void GroupDef::writeDetailedDescription(OutputList &ol,const QCString &title)
ol.disableAllBut(OutputGenerator::Html);
ol.writeAnchor(0,"details");
ol.popGeneratorState();
ol.startGroupHeader();
ol.parseText(title);
ol.endGroupHeader();
}
ol.startGroupHeader();
ol.parseText(title);
ol.endGroupHeader();
ol.popGeneratorState();

// repeat brief description
if (!briefDescription().isEmpty() && Config_getBool(REPEAT_BRIEF))
Expand Down Expand Up @@ -762,13 +766,16 @@ void GroupDef::writeDetailedDescription(OutputList &ol,const QCString &title)

void GroupDef::writeBriefDescription(OutputList &ol)
{
if (!briefDescription().isEmpty() && Config_getBool(BRIEF_MEMBER_DESC))
if (hasBriefDescription())
{
DocRoot *rootNode = validatingParseDoc(briefFile(),briefLine(),this,0,
briefDescription(),TRUE,FALSE,0,TRUE,FALSE);
if (rootNode && !rootNode->isEmpty())
{
ol.startParagraph();
ol.disableAllBut(OutputGenerator::Man);
ol.writeString(" - ");
ol.enableAll();
ol.writeDoc(rootNode,this,0);
ol.pushGeneratorState();
ol.disable(OutputGenerator::RTF);
Expand All @@ -789,6 +796,7 @@ void GroupDef::writeBriefDescription(OutputList &ol)
}
delete rootNode;
}
ol.writeSynopsis();
}

void GroupDef::writeGroupGraph(OutputList &ol)
Expand Down Expand Up @@ -1091,7 +1099,6 @@ void GroupDef::writeDocumentation(OutputList &ol)
ol.pushGeneratorState();
ol.disableAllBut(OutputGenerator::Man);
ol.endTitleHead(getOutputFileBase(),name());
ol.parseText(title);
ol.popGeneratorState();
ol.endHeaderSection();
ol.startContents();
Expand Down
2 changes: 1 addition & 1 deletion src/mangen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ void ManGenerator::endTitleHead(const char *,const char *name)
t << ".ad l" << endl;
t << ".nh" << endl;
t << ".SH NAME" << endl;
t << name << " \\- ";
t << name;
firstCol=FALSE;
paragraph=TRUE;
inHeader=TRUE;
Expand Down
3 changes: 3 additions & 0 deletions src/namespacedef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,9 @@ void NamespaceDef::writeBriefDescription(OutputList &ol)
if (rootNode && !rootNode->isEmpty())
{
ol.startParagraph();
ol.disableAllBut(OutputGenerator::Man);
ol.writeString(" - ");
ol.enableAll();
ol.writeDoc(rootNode,this,0);
ol.pushGeneratorState();
ol.disable(OutputGenerator::RTF);
Expand Down
9 changes: 8 additions & 1 deletion src/pagedef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,19 @@ void PageDef::writePageDocumentation(OutputList &ol)
}

ol.startTextBlock();
QCString docStr = documentation()+inbodyDocumentation();
if (!docStr.isEmpty())
{
ol.disableAllBut(OutputGenerator::Man);
ol.writeString(" - ");
ol.enableAll();
}
ol.generateDoc(
docFile(), // fileName
docLine(), // startLine
this, // context
0, // memberdef
documentation()+inbodyDocumentation(), // docStr
docStr, // docStr
TRUE, // index words
FALSE // not an example
);
Expand Down

0 comments on commit 98d3f8e

Please sign in to comment.