aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Alexander Foremny <aforemny@posteo.de>2023-10-05 10:57:59 +0200
committerLibravatar Alexander Foremny <aforemny@posteo.de>2023-10-05 10:57:59 +0200
commitb87674a9ad1aece973da49197182a08ac65cd2df (patch)
treef9f3dc22f05b3d8e1ce08198df209871c7ba5c75
parent6b76050f758917cf3552c20f99a4bfedd66049f2 (diff)
fix trailing newline in text extract, fix tests
-rw-r--r--Makefile6
-rw-r--r--app/Issue/Text.hs4
2 files changed, 5 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index b2783f3..43f25dc 100644
--- a/Makefile
+++ b/Makefile
@@ -1,13 +1,13 @@
test: test-sh test-elm test-nix
test-sh: tests/sh.sh
- cabal run anissue -- show tests/sh.sh | \
+ cabal run anissue -- list tests/sh.sh | \
cmp tests/expect
test-elm: tests/elm.elm
- cabal run anissue -- show tests/elm.elm | \
+ cabal run anissue -- list tests/elm.elm | \
cmp tests/expect
test-nix: tests/nix.nix
- cabal run anissue -- show tests/nix.nix | \
+ cabal run anissue -- list tests/nix.nix | \
cmp tests/expect
diff --git a/app/Issue/Text.hs b/app/Issue/Text.hs
index 2d3aac4..2637598 100644
--- a/app/Issue/Text.hs
+++ b/app/Issue/Text.hs
@@ -15,7 +15,7 @@ extractText :: FileType -> Text -> (Text, Maybe Text)
extractText fileType rawText = (title, description)
where
text = stripComments fileType $ stripLines rawText
- stripLines = T.unlines . map T.strip . T.lines
+ stripLines = T.intercalate "\n" . map T.strip . T.lines
(title, description') = second T.stripStart $ T.breakOn "\n\n" text
description
| T.null description' = Nothing
@@ -41,7 +41,7 @@ stripLineComments lineStart text =
)
text
where
- onLines f = T.unlines . map f . T.lines
+ onLines f = T.intercalate "\n" . map f . T.lines
stripBlockComment :: Text -> Text -> Text -> Text
stripBlockComment blockStart blockEnd text =