summaryrefslogtreecommitdiff
path: root/Pancake
diff options
context:
space:
mode:
authordefanor <defanor@uberspace.net>2017-11-05 13:36:57 +0300
committerdefanor <defanor@uberspace.net>2017-11-05 13:36:57 +0300
commit3f4c70e68bf7723192e8a3f1caa1f22b1d72a256 (patch)
tree7233794fc00941ef3e049c22795a28935f47e998 /Pancake
parent1344f11abc7514c5d11b8b49fbd2337569c1cf0c (diff)
Provide current URI to pancake-mode
And add a command for displaying and copying it.
Diffstat (limited to 'Pancake')
-rw-r--r--Pancake/Printing.hs7
1 files changed, 4 insertions, 3 deletions
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 '\\' = "\\\\"