From 3f4c70e68bf7723192e8a3f1caa1f22b1d72a256 Mon Sep 17 00:00:00 2001 From: defanor Date: Sun, 5 Nov 2017 13:36:57 +0300 Subject: Provide current URI to pancake-mode And add a command for displaying and copying it. --- Pancake/Printing.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'Pancake') diff --git a/Pancake/Printing.hs b/Pancake/Printing.hs index 9790a6b..a385751 100644 --- a/Pancake/Printing.hs +++ b/Pancake/Printing.hs @@ -51,8 +51,8 @@ putSexpLn s = liftIO $ do hFlush stdout -- | Prints rendered lines as s-expressions. -showSexps :: MonadIO m => [RendererOutput] -> m () -showSexps ro = +showSexps :: MonadIO m => URI -> [RendererOutput] -> m () +showSexps uri ro = -- would be nicer to use some library for this, but they tend to be -- abandoned, and the task is simple enough to do it here putSexpLn [ "render" @@ -62,7 +62,8 @@ showSexps ro = , list $ "identifiers" : map (\(i, l) -> list [encodeStr i, show l]) (rIdentifiers ro) , list $ "links" - : map (\uri -> encodeStr $ uriToString id uri "") (rLinks ro)] + : map (\u -> encodeStr $ uriToString id u "") (rLinks ro) + , list ["uri", ".", encodeStr $ uriToString id uri ""]] where encodeStr s = concat ["\"", concatMap escape s, "\""] escape '\\' = "\\\\" -- cgit v1.2.3