diff options
Diffstat (limited to 'hs/Vimwiki/Man.hs')
-rw-r--r-- | hs/Vimwiki/Man.hs | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/hs/Vimwiki/Man.hs b/hs/Vimwiki/Man.hs index dde9028..35d6383 100644 --- a/hs/Vimwiki/Man.hs +++ b/hs/Vimwiki/Man.hs @@ -1,26 +1,28 @@ {-# LANGUAGE OverloadedStrings - , ImportQualifiedPost + , CPP #-} module Vimwiki.Man where import Data.Map (Map) -import Data.Map qualified as M +import qualified Data.Map as M import Data.Maybe (fromMaybe) import Data.String (IsString) -import Data.Text hiding (tail) import Network.URI import Text.Pandoc (Inline (Str)) import Util (nullToMaybe) +import Data.Text.Compat -manRewriter :: (Text -> Maybe Text -> Maybe Text -> Text) -> [Inline] -> URI -> ([Inline], Text) +manRewriter :: (PandocStr -> Maybe PandocStr -> Maybe PandocStr -> PandocStr) + -> [Inline] -> URI -> ([Inline], PandocStr) manRewriter manImpl _ uri - = ([Str $ path <> "(" <> (fromMaybe "?" section') <> ")"] + = ([Str . conv $ path <> "(" <> (fromMaybe "?" section') <> ")"] , manImpl path section' language') - where path :: Text - path = pack $ uriPath uri - section' = pack . tail <$> nullToMaybe (uriFragment uri) - language' = pack . tail <$> nullToMaybe (uriQuery uri) + where path :: PandocStr + path = conv $ uriPath uri + section' = conv . tail <$> nullToMaybe (uriFragment uri) + language' = conv . tail <$> nullToMaybe (uriQuery uri) + archMan :: (Semigroup a, IsString a) => a -> Maybe a -> Maybe a -> a archMan page section' language' |