diff options
author | Alex Neundorf <neundorf@kde.org> | 2012-06-21 21:06:08 (GMT) |
---|---|---|
committer | Alex Neundorf <neundorf@kde.org> | 2012-06-21 21:06:08 (GMT) |
commit | 38df155dd394efd45dff887028b2e1a4c0969b03 (patch) | |
tree | 3f4d3c0c989321d01f1cfa1a4c2d8e6d045741ff | |
parent | e6a935f39b2d15677830fdba8090d8c725165ca9 (diff) | |
download | CMake-38df155dd394efd45dff887028b2e1a4c0969b03.zip CMake-38df155dd394efd45dff887028b2e1a4c0969b03.tar.gz CMake-38df155dd394efd45dff887028b2e1a4c0969b03.tar.bz2 |
documentation: preparation for making the man section configurable
This patch adds a man section number, which is then used by the
DocumentationFormatterMan. The section number is right now always 1,
detecting this from the file name will be the next step.
Alex
-rw-r--r-- | Source/cmDocumentation.cxx | 11 | ||||
-rw-r--r-- | Source/cmDocumentation.h | 7 | ||||
-rw-r--r-- | Source/cmDocumentationFormatterMan.cxx | 8 | ||||
-rw-r--r-- | Source/cmDocumentationFormatterMan.h | 3 | ||||
-rw-r--r-- | Source/cmakemain.cxx | 2 |
5 files changed, 21 insertions, 10 deletions
diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index 904a157..0f44e19 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -221,7 +221,7 @@ DOCUMENT_INTRO(CompatCommands, "cmakecompat", cmDocumentation::cmDocumentation() :CurrentFormatter(0) { - this->SetForm(TextForm); + this->SetForm(TextForm, 0); this->addCommonStandardDocSections(); this->ShowGenerators = true; } @@ -594,7 +594,7 @@ bool cmDocumentation::PrintRequestedDocumentation(std::ostream& os) i != this->RequestedHelpItems.end(); ++i) { - this->SetForm(i->HelpForm); + this->SetForm(i->HelpForm, i->ManSection); this->CurrentArgument = i->Argument; // If a file name was given, use it. Otherwise, default to the // given stream. @@ -1269,9 +1269,9 @@ bool cmDocumentation::CheckOptions(int argc, const char* const* argv, } //---------------------------------------------------------------------------- -void cmDocumentation::Print(Form f, std::ostream& os) +void cmDocumentation::Print(Form f, int manSection, std::ostream& os) { - this->SetForm(f); + this->SetForm(f, manSection); this->Print(os); } @@ -1879,7 +1879,7 @@ void cmDocumentation::CreateFullDocumentation() } //---------------------------------------------------------------------------- -void cmDocumentation::SetForm(Form f) +void cmDocumentation::SetForm(Form f, int manSection) { switch(f) { @@ -1890,6 +1890,7 @@ void cmDocumentation::SetForm(Form f) this->CurrentFormatter = &this->DocbookFormatter; break; case ManForm: + this->ManFormatter.SetManSection(manSection); this->CurrentFormatter = &this->ManFormatter; break; case TextForm: diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h index a3f8e44..3fcea8f 100644 --- a/Source/cmDocumentation.h +++ b/Source/cmDocumentation.h @@ -108,7 +108,7 @@ public: * Print documentation in the given form. All previously added * sections will be generated. */ - void Print(Form f, std::ostream& os); + void Print(Form f, int manSection, std::ostream& os); /** * Print documentation in the current form. All previously added @@ -190,7 +190,7 @@ public: std::vector<cmDocumentationEntry>& commands, cmake* cm); private: - void SetForm(Form f); + void SetForm(Form f, int manSection); void SetDocName(const char* docname); bool CreateSingleModule(const char* fname, @@ -247,11 +247,12 @@ private: struct RequestedHelpItem { - RequestedHelpItem():HelpForm(TextForm), HelpType(None) {} + RequestedHelpItem():HelpForm(TextForm), HelpType(None), ManSection(1) {} cmDocumentationEnums::Form HelpForm; cmDocumentationEnums::Type HelpType; std::string Filename; std::string Argument; + int ManSection; }; std::vector<RequestedHelpItem> RequestedHelpItems; diff --git a/Source/cmDocumentationFormatterMan.cxx b/Source/cmDocumentationFormatterMan.cxx index 0c6d878..4123c85 100644 --- a/Source/cmDocumentationFormatterMan.cxx +++ b/Source/cmDocumentationFormatterMan.cxx @@ -19,9 +19,15 @@ cmDocumentationFormatterMan::cmDocumentationFormatterMan() :cmDocumentationFormatter() +,ManSection(1) { } +void cmDocumentationFormatterMan::SetManSection(int manSection) +{ + this->ManSection = manSection; +} + void cmDocumentationFormatterMan ::PrintSection(std::ostream& os, const cmDocumentationSection §ion, @@ -87,7 +93,7 @@ void cmDocumentationFormatterMan::PrintHeader(const char* docname, this->EscapeText(s_docname); this->EscapeText(s_appname); - os << ".TH " << s_docname << " 1 \"" + os << ".TH " << s_docname << " " << this->ManSection << " \"" << cmSystemTools::GetCurrentDateTime("%B %d, %Y").c_str() << "\" \"" << s_appname << " " << cmVersion::GetCMakeVersion() diff --git a/Source/cmDocumentationFormatterMan.h b/Source/cmDocumentationFormatterMan.h index 11b5acb..b3d069c 100644 --- a/Source/cmDocumentationFormatterMan.h +++ b/Source/cmDocumentationFormatterMan.h @@ -22,6 +22,8 @@ class cmDocumentationFormatterMan : public cmDocumentationFormatter public: cmDocumentationFormatterMan(); + void SetManSection(int manSection); + virtual cmDocumentationEnums::Form GetForm() const { return cmDocumentationEnums::ManForm;} @@ -35,6 +37,7 @@ public: private: void EscapeText(std::string& man_text); + int ManSection; }; #endif diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 0b1d121..11a4267 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -418,7 +418,7 @@ int do_cmake(int ac, char** av) { doc.ClearSections(); doc.SetSection("NOTE", cmDocumentationNOTE); - doc.Print(cmDocumentation::UsageForm, std::cerr); + doc.Print(cmDocumentation::UsageForm, 0, std::cerr); return 1; } return result; |