cmRST: Add support for the note and productionlist directives
Simply print out the lines as normal paragraph text. Teach the CMakeLib.testRST test to cover this syntax. Update the cmake-developer.7 manual to document support for the directives.
This commit is contained in:
parent
6e900fbe69
commit
450b515ad0
|
@ -68,11 +68,21 @@ literal block after ``::``
|
||||||
space. We prefer the ``::`` to appear at the end of a paragraph
|
space. We prefer the ``::`` to appear at the end of a paragraph
|
||||||
line instead of as its own line.
|
line instead of as its own line.
|
||||||
|
|
||||||
|
``note`` directive
|
||||||
|
Call out a side note. The command-line help processor prints the
|
||||||
|
block content as if the lines were normal paragraph text with
|
||||||
|
interpretation.
|
||||||
|
|
||||||
``parsed-literal`` directive
|
``parsed-literal`` directive
|
||||||
Add a literal block with markup interpretation. The command-line
|
Add a literal block with markup interpretation. The command-line
|
||||||
help processor prints the block content without the leading
|
help processor prints the block content without the leading
|
||||||
directive line and with common indentation replaced by one space.
|
directive line and with common indentation replaced by one space.
|
||||||
|
|
||||||
|
``productionlist`` directive
|
||||||
|
Render context-free grammar productions. The command-line help
|
||||||
|
processor prints the block content as if the lines were normal
|
||||||
|
paragraph text with interpretation.
|
||||||
|
|
||||||
``replace`` directive
|
``replace`` directive
|
||||||
Define a ``|substitution|`` replacement.
|
Define a ``|substitution|`` replacement.
|
||||||
The command-line help processor requires a substitution replacement
|
The command-line help processor requires a substitution replacement
|
||||||
|
|
|
@ -34,6 +34,8 @@ cmRST::cmRST(std::ostream& os, std::string const& docroot):
|
||||||
ReplaceDirective("^.. (\\|[^|]+\\|) replace::[ \t]*(.*)$"),
|
ReplaceDirective("^.. (\\|[^|]+\\|) replace::[ \t]*(.*)$"),
|
||||||
IncludeDirective("^.. include::[ \t]+([^ \t\n]+)$"),
|
IncludeDirective("^.. include::[ \t]+([^ \t\n]+)$"),
|
||||||
TocTreeDirective("^.. toctree::[ \t]*(.*)$"),
|
TocTreeDirective("^.. toctree::[ \t]*(.*)$"),
|
||||||
|
ProductionListDirective("^.. productionlist::[ \t]*(.*)$"),
|
||||||
|
NoteDirective("^.. note::[ \t]*(.*)$"),
|
||||||
ModuleRST("^#\\[(=*)\\[\\.rst:$"),
|
ModuleRST("^#\\[(=*)\\[\\.rst:$"),
|
||||||
CMakeRole("(:cmake)?:("
|
CMakeRole("(:cmake)?:("
|
||||||
"command|generator|variable|module|policy|"
|
"command|generator|variable|module|policy|"
|
||||||
|
@ -227,6 +229,16 @@ void cmRST::ProcessLine(std::string const& line)
|
||||||
this->Directive = DirectiveTocTree;
|
this->Directive = DirectiveTocTree;
|
||||||
this->MarkupLines.push_back(this->TocTreeDirective.match(1));
|
this->MarkupLines.push_back(this->TocTreeDirective.match(1));
|
||||||
}
|
}
|
||||||
|
else if(this->ProductionListDirective.find(line))
|
||||||
|
{
|
||||||
|
// Output productionlist directives and their content normally.
|
||||||
|
this->NormalLine(line);
|
||||||
|
}
|
||||||
|
else if(this->NoteDirective.find(line))
|
||||||
|
{
|
||||||
|
// Output note directives and their content normally.
|
||||||
|
this->NormalLine(line);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// An explicit markup start followed nothing but whitespace and a
|
// An explicit markup start followed nothing but whitespace and a
|
||||||
// blank line does not consume any indented text following.
|
// blank line does not consume any indented text following.
|
||||||
|
|
|
@ -84,6 +84,8 @@ private:
|
||||||
cmsys::RegularExpression ReplaceDirective;
|
cmsys::RegularExpression ReplaceDirective;
|
||||||
cmsys::RegularExpression IncludeDirective;
|
cmsys::RegularExpression IncludeDirective;
|
||||||
cmsys::RegularExpression TocTreeDirective;
|
cmsys::RegularExpression TocTreeDirective;
|
||||||
|
cmsys::RegularExpression ProductionListDirective;
|
||||||
|
cmsys::RegularExpression NoteDirective;
|
||||||
cmsys::RegularExpression ModuleRST;
|
cmsys::RegularExpression ModuleRST;
|
||||||
cmsys::RegularExpression CMakeRole;
|
cmsys::RegularExpression CMakeRole;
|
||||||
cmsys::RegularExpression Substitution;
|
cmsys::RegularExpression Substitution;
|
||||||
|
|
|
@ -76,6 +76,13 @@ or after a paragraph ending in two colons::
|
||||||
but not after a line ending in two colons::
|
but not after a line ending in two colons::
|
||||||
in the middle of a paragraph.
|
in the middle of a paragraph.
|
||||||
|
|
||||||
|
.. productionlist::
|
||||||
|
grammar: `production`
|
||||||
|
production: "content rendered"
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
Notes are called out.
|
||||||
|
|
||||||
substituted text with multiple lines becomes one line
|
substituted text with multiple lines becomes one line
|
||||||
|
|
||||||
End of first include.
|
End of first include.
|
||||||
|
|
|
@ -83,6 +83,13 @@ or after a paragraph ending in two colons::
|
||||||
but not after a line ending in two colons::
|
but not after a line ending in two colons::
|
||||||
in the middle of a paragraph.
|
in the middle of a paragraph.
|
||||||
|
|
||||||
|
.. productionlist::
|
||||||
|
grammar: `production`
|
||||||
|
production: "content rendered"
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
Notes are called out.
|
||||||
|
|
||||||
.. |substitution| replace::
|
.. |substitution| replace::
|
||||||
|nested substitution|
|
|nested substitution|
|
||||||
with multiple lines becomes one line
|
with multiple lines becomes one line
|
||||||
|
|
Loading…
Reference in New Issue