summaryrefslogtreecommitdiffstats
path: root/src/Zettel/Transclusion.hs
diff options
context:
space:
mode:
authorYann Herklotz <git@yannherklotz.com>2023-05-13 20:48:37 +0100
committerYann Herklotz <git@yannherklotz.com>2023-05-13 20:48:37 +0100
commit1cdedbb50ed5ff9aea4a5ecf78e512dc52cc03af (patch)
treeff231a5d04bd5d81611b60be715bd70b99da0c8a /src/Zettel/Transclusion.hs
parent6b797b52d65e0b174205bb12bc5075fed1825724 (diff)
downloadzk-visual-1cdedbb50ed5ff9aea4a5ecf78e512dc52cc03af.tar.gz
zk-visual-1cdedbb50ed5ff9aea4a5ecf78e512dc52cc03af.zip
Add a command line interface
Diffstat (limited to 'src/Zettel/Transclusion.hs')
-rw-r--r--src/Zettel/Transclusion.hs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/Zettel/Transclusion.hs b/src/Zettel/Transclusion.hs
index 617a475..63e1271 100644
--- a/src/Zettel/Transclusion.hs
+++ b/src/Zettel/Transclusion.hs
@@ -9,6 +9,10 @@ import Text.Pandoc.Walk (walk, query)
import Zettel.Common
import Zettel.Types
+between :: Char -> Char -> Text -> Text
+between c1 c2 t =
+ T.drop 1 . T.takeWhile (c2 /=) $ T.dropWhile (c1 /=) t
+
attrValue :: Text -> Text -> Maybe Text
attrValue t v = viaNonEmpty head . drop 1 . dropWhile (/= v) $ T.words t