diff options
author | Brad King <brad.king@kitware.com> | 2016-05-02 17:51:26 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-05-02 19:16:07 (GMT) |
commit | de370656612be4b0f1e25a68be2c5f7d44645b29 (patch) | |
tree | 0b14519c352fb464d28fb1b3f3128bee7b5deccb /Source/cmRST.cxx | |
parent | 845cb217a7d70b32aa26969bc829a846dcab9130 (diff) | |
download | CMake-de370656612be4b0f1e25a68be2c5f7d44645b29.zip CMake-de370656612be4b0f1e25a68be2c5f7d44645b29.tar.gz CMake-de370656612be4b0f1e25a68be2c5f7d44645b29.tar.bz2 |
cmRST: Parse toctree lines with Sphinx cross-reference syntax
Diffstat (limited to 'Source/cmRST.cxx')
-rw-r--r-- | Source/cmRST.cxx | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx index 67667ea..44d4289 100644 --- a/Source/cmRST.cxx +++ b/Source/cmRST.cxx @@ -46,7 +46,8 @@ cmRST::cmRST(std::ostream& os, std::string const& docroot): "):`(<*([^`<]|[^` \t]<)*)([ \t]+<[^`]*>)?`"), Substitution("(^|[^A-Za-z0-9_])" "((\\|[^| \t\r\n]([^|\r\n]*[^| \t\r\n])?\\|)(__|_|))" - "([^A-Za-z0-9_]|$)") + "([^A-Za-z0-9_]|$)"), + TocTreeLink("^.*[ \t]+<([^>]+)>$") { this->Replace["|release|"] = cmVersion::GetCMakeVersion(); } @@ -429,9 +430,18 @@ void cmRST::ProcessDirectiveTocTree() for(std::vector<std::string>::iterator i = this->MarkupLines.begin(); i != this->MarkupLines.end(); ++i) { - if(!i->empty() && i->find_first_of(":") == i->npos) + std::string const& line = *i; + if (!line.empty() && line[0] != ':') { - this->ProcessInclude(*i + ".rst", IncludeTocTree); + if (this->TocTreeLink.find(line)) + { + std::string const& link = this->TocTreeLink.match(1); + this->ProcessInclude(link + ".rst", IncludeTocTree); + } + else + { + this->ProcessInclude(line + ".rst", IncludeTocTree); + } } } } |