aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/FB2.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text/Pandoc/Writers/FB2.hs')
-rw-r--r--src/Text/Pandoc/Writers/FB2.hs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Writers/FB2.hs b/src/Text/Pandoc/Writers/FB2.hs
index 3b5d04427..04d676307 100644
--- a/src/Text/Pandoc/Writers/FB2.hs
+++ b/src/Text/Pandoc/Writers/FB2.hs
@@ -42,6 +42,7 @@ import Text.Pandoc.Shared (capitalize, isURI, orderedListMarkers,
makeSections, tshow, stringify)
import Text.Pandoc.Writers.Shared (lookupMetaString, toLegacyTable)
import Data.Generics (everywhere, mkT)
+import qualified GHC.Show
-- | Data to be written at the end of the document:
-- (foot)notes, URLs, references, images.
@@ -61,7 +62,7 @@ newFB = FbRenderState { footnotes = [], imagesToFetch = []
, writerOptions = def }
data ImageMode = NormalImage | InlineImage deriving (Eq)
-instance Show ImageMode where
+instance GHC.Show.Show ImageMode where
show NormalImage = "imageType"
show InlineImage = "inlineImageType"
@@ -143,8 +144,11 @@ author ss =
[fname, lname] -> [ el "first-name" fname
, el "last-name" lname ]
(fname:rest) -> [ el "first-name" fname
- , el "middle-name" (T.concat . init $ rest)
- , el "last-name" (last rest) ]
+ , el "middle-name"
+ (maybe mempty T.concat
+ (viaNonEmpty init rest))
+ , el "last-name"
+ (fromMaybe mempty (viaNonEmpty last rest)) ]
[] -> []
in list $ el "author" (names ++ email)