Skip to content

Commit

Permalink
Remove special parsing support for some tags.
Browse files Browse the repository at this point in the history
Those correspond to the elements that don't have content (i.e with
`const` call in the rendering function).
  • Loading branch information
noteed committed Jun 19, 2024
1 parent f5e63da commit d87f215
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
6 changes: 6 additions & 0 deletions src/Slab/Evaluate.hs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ defaultEnv =
-- fragment. We need to be able to define @Div@ though.
("div", Frag ["content"] emptyEnv [BlockElem Div NoSym [] [BlockDefault "content" []]])
, ("br", Block (BlockElem Br NoSym [] []))
, ("hr", Block (BlockElem Hr NoSym [] []))
, ("meta", Block (BlockElem Meta NoSym [] []))
, ("link", Block (BlockElem Link NoSym [] []))
, ("source", Block (BlockElem Source NoSym [] []))
, ("img", Block (BlockElem Img NoSym [] []))
, ("input", Block (BlockElem Input NoSym [] []))
]

--------------------------------------------------------------------------------
Expand Down
11 changes: 1 addition & 10 deletions src/Slab/Parse.hs
Original file line number Diff line number Diff line change
Expand Up @@ -291,11 +291,7 @@ parserElem =
case name of
"html" -> pure Html
"body" -> pure Body
-- @div@ is now a fragment (function) in the environment.
-- "div" -> pure Div
"span" -> pure Span
-- "br" -> pure Br
"hr" -> pure Hr
"h1" -> pure H1
"h2" -> pure H2
"h3" -> pure H3
Expand All @@ -304,19 +300,15 @@ parserElem =
"h6" -> pure H6
"header" -> pure Header
"head" -> pure Head
"meta" -> pure Meta
"main" -> pure Main
"audio" -> pure Audio
"a" -> pure A
"code" -> pure Code
"img" -> pure Img
"iframe" -> pure IFrame
"input" -> pure Input
"i" -> pure I
"pre" -> pure Pre
"p" -> pure P
"ul" -> pure Ul
"link" -> pure Link
"li" -> pure Li
"title" -> pure Title
"table" -> pure Table
Expand All @@ -337,7 +329,6 @@ parserElem =
"script" -> pure Script
"style" -> pure Style
"small" -> pure Small
"source" -> pure Source
"svg" -> pure Svg
"textarea" -> pure Textarea
"canvas" -> pure Canvas
Expand Down Expand Up @@ -437,7 +428,7 @@ parserText :: Parser Text
parserText = T.pack <$> lexeme (some (noneOf ['\n'])) <?> "text content"

parserIdentifier :: Parser Text
parserIdentifier = T.pack <$> lexeme (some (noneOf (" .=(){}\n" :: String))) <?> "identifier"
parserIdentifier = T.pack <$> lexeme (some (noneOf (" .=#(){}\n" :: String))) <?> "identifier"

--------------------------------------------------------------------------------
parserInclude :: Parser (L.IndentOpt Parser Block Block)
Expand Down

0 comments on commit d87f215

Please sign in to comment.