1 /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
2 file Copyright.txt or https://cmake.org/licensing for details. */
5 #include "cmConfigure.h" // IWYU pragma: keep
13 #include "cmsys/RegularExpression.hxx"
16 * \brief Perform basic .rst processing for command-line help
18 * This class implements a subset of reStructuredText and Sphinx
19 * document processing. It is used to print command-line help.
21 * If you modify the capabilities of this class, be sure to update
22 * the Help/manual/cmake-developer.7.rst documentation and to update
23 * the Tests/CMakeLib/testRST.(rst|expect) test input and output.
28 cmRST(std::ostream& os, std::string docroot);
29 bool ProcessFile(std::string const& fname, bool isModule = false);
47 DirectiveParsedLiteral,
48 DirectiveLiteralBlock,
54 void ProcessRST(std::istream& is);
55 void ProcessModule(std::istream& is);
57 void ProcessLine(std::string const& line);
58 void NormalLine(std::string const& line);
59 void OutputLine(std::string const& line, bool inlineMarkup);
60 std::string ReplaceSubstitutions(std::string const& line);
61 void OutputMarkupLines(bool inlineMarkup);
62 bool ProcessInclude(std::string file, IncludeType type);
63 void ProcessDirectiveParsedLiteral();
64 void ProcessDirectiveLiteralBlock();
65 void ProcessDirectiveCodeBlock();
66 void ProcessDirectiveReplace();
67 void ProcessDirectiveTocTree();
68 static void UnindentLines(std::vector<std::string>& lines);
73 bool OutputLinePending = false;
74 bool LastLineEndedInColonColon = false;
75 MarkupType Markup = MarkupNone;
76 DirectiveType Directive = DirectiveNone;
77 cmsys::RegularExpression CMakeDirective;
78 cmsys::RegularExpression CMakeModuleDirective;
79 cmsys::RegularExpression ParsedLiteralDirective;
80 cmsys::RegularExpression CodeBlockDirective;
81 cmsys::RegularExpression ReplaceDirective;
82 cmsys::RegularExpression IncludeDirective;
83 cmsys::RegularExpression TocTreeDirective;
84 cmsys::RegularExpression ProductionListDirective;
85 cmsys::RegularExpression NoteDirective;
86 cmsys::RegularExpression VersionDirective;
87 cmsys::RegularExpression ModuleRST;
88 cmsys::RegularExpression CMakeRole;
89 cmsys::RegularExpression InlineLink;
90 cmsys::RegularExpression InlineLiteral;
91 cmsys::RegularExpression Substitution;
92 cmsys::RegularExpression TocTreeLink;
94 std::vector<std::string> MarkupLines;
96 std::map<std::string, std::string> Replace;
97 std::set<std::string> Replaced;
98 std::string ReplaceName;