mirror of https://github.com/voidlizard/hbs2
wip
This commit is contained in:
parent
641c51447f
commit
3f901966ab
|
@ -42,8 +42,6 @@ import Control.Monad.Trans.Maybe
|
||||||
|
|
||||||
import Streaming.Prelude qualified as S
|
import Streaming.Prelude qualified as S
|
||||||
|
|
||||||
-- FIXME: move-to-suckless-conf
|
|
||||||
deriving stock instance Ord (Syntax C)
|
|
||||||
|
|
||||||
{- HLINT ignore "Functor law" -}
|
{- HLINT ignore "Functor law" -}
|
||||||
|
|
||||||
|
@ -199,7 +197,7 @@ list_ tpl a = do
|
||||||
|
|
||||||
Just (Simple (SimpleTemplate simple)) -> do
|
Just (Simple (SimpleTemplate simple)) -> do
|
||||||
for_ fixmies $ \(FixmeThin attr) -> do
|
for_ fixmies $ \(FixmeThin attr) -> do
|
||||||
let subst = [ (mksym k, mkstr @C v) | (k,v) <- HM.toList attr ]
|
let subst = [ (mkId k, mkstr @C v) | (k,v) <- HM.toList attr ]
|
||||||
let what = render (SimpleTemplate (inject subst simple))
|
let what = render (SimpleTemplate (inject subst simple))
|
||||||
& fromRight "render error"
|
& fromRight "render error"
|
||||||
|
|
||||||
|
@ -248,9 +246,9 @@ cat_ metaOnly hash = do
|
||||||
let origLen = maybe 0 fromIntegral fixmeEnd - maybe 0 fromIntegral fixmeStart & max 1
|
let origLen = maybe 0 fromIntegral fixmeEnd - maybe 0 fromIntegral fixmeStart & max 1
|
||||||
let lno = max 1 $ origLen + after + before
|
let lno = max 1 $ origLen + after + before
|
||||||
|
|
||||||
let dict = [ (mksym k, mkstr @C v) | (k,v) <- HM.toList fixmeAttr ]
|
let dict = [ (mkId k, mkstr @C v) | (k,v) <- HM.toList fixmeAttr ]
|
||||||
<>
|
<>
|
||||||
[ (mksym "before", mkstr @C (FixmeAttrVal $ Text.pack $ show bbefore))
|
[ (mkId (FixmeAttrName "before"), mkstr @C (FixmeAttrVal $ Text.pack $ show bbefore))
|
||||||
]
|
]
|
||||||
|
|
||||||
debug (pretty cmd)
|
debug (pretty cmd)
|
||||||
|
|
|
@ -28,6 +28,8 @@ import Data.Map qualified as Map
|
||||||
import System.FilePath
|
import System.FilePath
|
||||||
import Text.InterpolatedString.Perl6 (qc)
|
import Text.InterpolatedString.Perl6 (qc)
|
||||||
|
|
||||||
|
-- FIXME: move-to-suckless-conf
|
||||||
|
deriving stock instance Ord (Syntax C)
|
||||||
|
|
||||||
pattern StringLike :: forall {c} . String -> Syntax c
|
pattern StringLike :: forall {c} . String -> Syntax c
|
||||||
pattern StringLike e <- (stringLike -> Just e)
|
pattern StringLike e <- (stringLike -> Just e)
|
||||||
|
@ -309,8 +311,11 @@ commentKey fp =
|
||||||
|
|
||||||
type ContextShit c = (Data c, Data (Context c), IsContext c, Data (Syntax c))
|
type ContextShit c = (Data c, Data (Context c), IsContext c, Data (Syntax c))
|
||||||
|
|
||||||
mksym :: FixmeAttrName -> Id
|
class MkId a where
|
||||||
mksym (k :: FixmeAttrName) = Id ("$" <> coerce k)
|
mkId :: a -> Id
|
||||||
|
|
||||||
|
instance MkId FixmeAttrName where
|
||||||
|
mkId (k :: FixmeAttrName) = Id ("$" <> coerce k)
|
||||||
|
|
||||||
mkstr :: forall c . (IsContext c) => FixmeAttrVal -> Syntax c
|
mkstr :: forall c . (IsContext c) => FixmeAttrVal -> Syntax c
|
||||||
mkstr (s :: FixmeAttrVal) = Literal (noContext @c) (LitStr (coerce s))
|
mkstr (s :: FixmeAttrVal) = Literal (noContext @c) (LitStr (coerce s))
|
||||||
|
|
Loading…
Reference in New Issue