ihp-hsx-0.18.0: JSX-like but for Haskell
Copyright(c) digitally induced GmbH 2022
Safe HaskellNone
LanguageHaskell2010

IHP.HSX.Parser

Description

 
Synopsis

Documentation

parseHsx :: SourcePos -> Text -> Either (ParseErrorBundle Text Void) Node Source #

Parses a HSX text and returns a Node

Example:

let filePath = "my-template"
let line = 0
let col = 0
let position = Megaparsec.SourcePos filePath (Megaparsec.mkPos line) (Megaparsec.mkPos col)
let hsxText = "<strong>Hello</strong>"

let (Right node) = parseHsx position hsxText

data Node Source #

Constructors

Node !Text ![Attribute] ![Node] !Bool 
TextNode !Text 
PreEscapedTextNode !Text

Used in script or style bodies

SplicedNode !Exp

Inline haskell expressions like {myVar} or {f "hello"}

Children ![Node] 
CommentNode !Text 

Instances

Instances details
Eq Node Source # 
Instance details

Defined in IHP.HSX.Parser

Methods

(==) :: Node -> Node -> Bool #

(/=) :: Node -> Node -> Bool #

Show Node Source # 
Instance details

Defined in IHP.HSX.Parser

Methods

showsPrec :: Int -> Node -> ShowS #

show :: Node -> String #

showList :: [Node] -> ShowS #

data Attribute Source #

Instances

Instances details
Eq Attribute Source # 
Instance details

Defined in IHP.HSX.Parser

Show Attribute Source # 
Instance details

Defined in IHP.HSX.Parser

data AttributeValue Source #

Instances

Instances details
Eq AttributeValue Source # 
Instance details

Defined in IHP.HSX.Parser

Show AttributeValue Source # 
Instance details

Defined in IHP.HSX.Parser

collapseSpace :: Text -> Text Source #

Replaces multiple space characters with a single one