aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2009-07-11 01:08:31 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2009-07-11 01:08:31 +0000
commit667b8f62eafd6c474bb2adaf1cafa47378247db1 (patch)
tree06522f5e28faf395bfd669434733690ed5fba54c /src/Text
parentbe06503e1017002c22476b214cea77a39124e528 (diff)
downloadpandoc-667b8f62eafd6c474bb2adaf1cafa47378247db1.tar.gz
Improved clarity of titleTransform in RST reader.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1592 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Readers/RST.hs14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs
index 4fe6ada5e..884d6f0e6 100644
--- a/src/Text/Pandoc/Readers/RST.hs
+++ b/src/Text/Pandoc/Readers/RST.hs
@@ -75,14 +75,12 @@ promoteHeaders _ [] = []
-- promote all the other headers.
titleTransform :: [Block] -- ^ list of blocks
-> ([Block], [Inline]) -- ^ modified list of blocks, title
-titleTransform ((Header 1 head1):(Header 2 head2):rest) = -- title subtitle
- if (any (isHeader 1) rest) || (any (isHeader 2) rest)
- then ((Header 1 head1):(Header 2 head2):rest, [])
- else ((promoteHeaders 2 rest), head1 ++ [Str ":", Space] ++ head2)
-titleTransform ((Header 1 head1):rest) = -- title, no subtitle
- if (any (isHeader 1) rest)
- then ((Header 1 head1):rest, [])
- else ((promoteHeaders 1 rest), head1)
+titleTransform ((Header 1 head1):(Header 2 head2):rest) |
+ not (any (isHeader 1) rest || any (isHeader 2) rest) = -- both title & subtitle
+ (promoteHeaders 2 rest, head1 ++ [Str ":", Space] ++ head2)
+titleTransform ((Header 1 head1):rest) |
+ not (any (isHeader 1) rest) = -- title, no subtitle
+ (promoteHeaders 1 rest, head1)
titleTransform blocks = (blocks, [])
parseRST :: GenParser Char ParserState Pandoc