Refactor rst parsing for console output
authorTeemu Murtola <teemu.murtola@gmail.com>
Tue, 2 Jun 2015 10:26:30 +0000 (13:26 +0300)
committerTeemu Murtola <teemu.murtola@gmail.com>
Thu, 4 Jun 2015 12:11:04 +0000 (14:11 +0200)
commit1e7d2af2ea3b3fc3dfeae17baaec30b5bca4e1ab
tree70fc6b2abb49be083d4e6e7ba8563cd2beab42b0
parent62306b648487ec9e7345507a17d9927eada0b9e9
Refactor rst parsing for console output

Move code from helpwritercontext.cpp into a separate class in
rstparser.*, and structure it more cleanly.  The logic is mostly the
same as earlier, but the new structure also makes it easier to fix
some issues.  In particular, since the code now first identifies what
the next paragraph is, and uses a separate loop to format it, it is much
easier to adapt the formatting to the contents of the paragraph.
Add comments for the complicated paragraph parsing logic.

To support this change, make TextLineWrapper not produce whitespace-only
lines if requested to indent an empty line.

Add tests for fixed/enhanced functionality.

Change-Id: I690dcf1578780d5fb0016d41da1e67dca96bd08c
docs/doxygen/user/onlinehelp.md
src/gromacs/onlinehelp-doc.h
src/gromacs/onlinehelp/helpwritercontext.cpp
src/gromacs/onlinehelp/rstparser.cpp [new file with mode: 0644]
src/gromacs/onlinehelp/rstparser.h [new file with mode: 0644]
src/gromacs/onlinehelp/tests/helpwritercontext.cpp
src/gromacs/onlinehelp/tests/refdata/HelpWriterContextTest_FormatsLiteralTextWithIndentation.xml [new file with mode: 0644]
src/gromacs/onlinehelp/tests/refdata/HelpWriterContextTest_FormatsTitles.xml
src/gromacs/utility/stringutil.cpp
src/gromacs/utility/tests/refdata/TextLineWrapperTest_HandlesIndentWithEmptyLines.xml [new file with mode: 0644]
src/gromacs/utility/tests/stringutil.cpp