From 2024327746747989f47dec3859e2ca4bc66267c3 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 5 Apr 2019 08:12:39 -0400 Subject: Help: Remove empty literal block markup in RESOURCE target property This was added accidentally by commit 456e0fb64f (Help: Improve documentation formating, 2019-04-01). --- Help/prop_tgt/RESOURCE.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Help/prop_tgt/RESOURCE.rst b/Help/prop_tgt/RESOURCE.rst index 6ada637..e5a1cb6 100644 --- a/Help/prop_tgt/RESOURCE.rst +++ b/Help/prop_tgt/RESOURCE.rst @@ -11,7 +11,7 @@ directory (eg. ``Resources`` directory for macOS) inside the bundle. On non-Apple platforms these files may be installed using the ``RESOURCE`` option to the :command:`install(TARGETS)` command. -Following example of Application Bundle:: +Following example of Application Bundle: .. code-block:: cmake -- cgit v0.12 From a9b38a17571bca0801594adf85fef59fac51d6ba Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 5 Apr 2019 08:13:43 -0400 Subject: cmRST: Fix crash on empty markup block --- Source/cmRST.cxx | 6 ++++++ Tests/CMakeLib/testRST.expect | 4 ++++ Tests/CMakeLib/testRST.rst | 4 ++++ 3 files changed, 14 insertions(+) diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx index b7216b0..2064275 100644 --- a/Source/cmRST.cxx +++ b/Source/cmRST.cxx @@ -457,6 +457,12 @@ void cmRST::UnindentLines(std::vector& lines) size_t trailingEmpty = std::distance(rit, cmFindNot(cmReverseRange(lines), std::string())); + if ((leadingEmpty + trailingEmpty) >= lines.size()) { + // All lines are empty. The markup block is empty. Leave only one. + lines.resize(1); + return; + } + std::vector::iterator contentEnd = cmRotate( lines.begin(), lines.begin() + leadingEmpty, lines.end() - trailingEmpty); lines.erase(contentEnd, lines.end()); diff --git a/Tests/CMakeLib/testRST.expect b/Tests/CMakeLib/testRST.expect index d7b91d1..c19ee94 100644 --- a/Tests/CMakeLib/testRST.expect +++ b/Tests/CMakeLib/testRST.expect @@ -83,6 +83,10 @@ or after a paragraph ending in two colons:: but not after a line ending in two colons:: in the middle of a paragraph. +A literal block can be empty:: + + + .. productionlist:: grammar: `production` production: "content rendered" diff --git a/Tests/CMakeLib/testRST.rst b/Tests/CMakeLib/testRST.rst index 633219f..d2d1140 100644 --- a/Tests/CMakeLib/testRST.rst +++ b/Tests/CMakeLib/testRST.rst @@ -90,6 +90,10 @@ or after a paragraph ending in two colons:: but not after a line ending in two colons:: in the middle of a paragraph. +A literal block can be empty:: + + + .. productionlist:: grammar: `production` production: "content rendered" -- cgit v0.12