suckless-script html fix

This commit is contained in:
voidlizard 2025-02-02 18:28:53 +03:00
parent d0e8c6741d
commit 599725fbd5
1 changed files with 7 additions and 2 deletions

View File

@ -935,6 +935,11 @@ internalEntries = do
_ -> do _ -> do
throwIO (BadFormException @C nil) throwIO (BadFormException @C nil)
entry $ bindMatch "replicate" $ \case
[LitIntVal n, e] -> pure $ mkList (replicate (fromIntegral n) e)
_ -> pure nil
entry $ bindMatch "repeat" $ nil_ $ \case entry $ bindMatch "repeat" $ nil_ $ \case
[LitIntVal n, Lambda [] b] -> do [LitIntVal n, Lambda [] b] -> do
replicateM_ (fromIntegral n) (applyLambda [] b []) replicateM_ (fromIntegral n) (applyLambda [] b [])
@ -1590,7 +1595,7 @@ internalEntries = do
| ListVal [TextLike k, TextLike v] <- a | ListVal [TextLike k, TextLike v] <- a
] & mconcat ] & mconcat
let body = case concatTerms hsep content of let body = case concatTerms hsep (flattenList (mkList content)) of
TextLike s -> s TextLike s -> s
_ -> mempty _ -> mempty
@ -1678,7 +1683,7 @@ compareLists (x:xs) (y:ys) =
concatTerms :: forall ann c . IsContext c => ( [Doc ann] -> Doc ann) -> [Syntax c] -> Syntax c concatTerms :: forall ann c . IsContext c => ( [Doc ann] -> Doc ann) -> [Syntax c] -> Syntax c
concatTerms s = \case concatTerms s = \case
[ListVal xs] -> do [ListVal xs] -> do
mkStr @c ( show $ s (fmap fmt xs) ) mkStr @c ( show $ pretty $ concatTerms s xs )
xs -> mkStr ( show $ s (fmap fmt xs) ) xs -> mkStr ( show $ s (fmap fmt xs) )