| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Yamlet.Internal.Emit
Description
Building blocks of the YAML output.
This module is intended for internal use only, and may change without warning in subsequent releases.
Synopsis
- plainSyntax :: Bool -> Text -> Bool
- plainLines :: Bool -> Int -> [Int] -> Text -> Maybe Builder
- singleQuoted :: Text -> Maybe Builder
- singleQuotedLines :: Int -> [Int] -> Text -> Maybe Builder
- quotedPlain :: Text -> Builder
- quotedPlainLines :: Int -> [Int] -> Text -> Builder
- doubleQuoted :: Text -> Builder
- doubleQuotedLines :: Int -> [Int] -> Text -> Builder
- literalBlock :: Int -> Text -> Maybe (Builder, Builder)
- foldedBlock :: Int -> [Int] -> Text -> Maybe (Builder, Builder)
- hasKeepIndicator :: Text -> Bool
- needsIndentIndicator :: Text -> Bool
- indentStep :: Int
- tagText :: Text -> Builder
- tagHandles :: Node -> [Char]
- tagDirective :: Char -> Builder
- isPrintable :: Char -> Bool
- isScalarChar :: Char -> Bool
- spaces :: Int -> Builder
Scalars
plainSyntax :: Bool -> Text -> Bool Source #
The text reads back as the same text if it is a plain scalar on one line,
in a flow collection if the flag is set. The check ignores the schema, so
e.g. 12 passes.
plainLines :: Bool -> Int -> [Int] -> Text -> Maybe Builder Source #
A plain scalar on the lines that start at the positions, with the lines after the first one at the given indentation, if the text can be plain. It is in a flow collection if the flag is set.
singleQuoted :: Text -> Maybe Builder Source #
A single-quoted scalar on one line, if the text has no line breaks.
singleQuotedLines :: Int -> [Int] -> Text -> Maybe Builder Source #
A single-quoted scalar on the lines that start at the positions, as in
plainLines, if single quotes can hold the text.
quotedPlain :: Text -> Builder Source #
The quoted form of a plain scalar whose text cannot be plain: in single quotes, or in double quotes if the text has a tab or a character that single quotes cannot hold. A tab in single quotes is not visible.
quotedPlainLines :: Int -> [Int] -> Text -> Builder Source #
quotedPlain on the lines that start at the positions, as in
plainLines.
doubleQuoted :: Text -> Builder Source #
A double-quoted scalar with escapes for the characters that need them.
doubleQuotedLines :: Int -> [Int] -> Text -> Builder Source #
A double-quoted scalar on the lines that start at the positions, as in
plainLines. The escapes of the tabs keep them at the ends of the lines.
literalBlock :: Int -> Text -> Maybe (Builder, Builder) Source #
The header and the content lines of a literal block scalar, with the content at the given indentation.
foldedBlock :: Int -> [Int] -> Text -> Maybe (Builder, Builder) Source #
The header and the content lines of a folded block scalar, with the content at the given indentation. It has no keep indicator. Each line of the text becomes one line of the output, or several lines if the lines start at the positions.
hasKeepIndicator :: Text -> Bool Source #
A block scalar with the text has the keep indicator, so the empty lines at its end are its content. Without content, the clip indicator drops the line breaks too.
needsIndentIndicator :: Text -> Bool Source #
A block scalar with the text needs an indentation indicator, because its first line with content starts with a space or a tab. YAML 1.2 does not need the indicator for a tab, but libyaml rejects the block scalar without it. Parsers do not agree on the meaning of the indicator at the top level, so a caller there writes such a text with quotes.
Other
indentStep :: Int Source #
The number of spaces that the content of a block collection or a block scalar is indented by, relative to its parent. The output style is fixed.
tagText :: Text -> Builder Source #
A tag in the shortest form that reads back as the same tag. A tag that no
text can hold, e.g. an empty tag, becomes the non-specific tag !.
A global tag that is not a valid URI needs the directive of
tagDirective in its document.
tagHandles :: Node -> [Char] Source #
The handles for the tags of the node and the nodes in it that are not valid URIs, each once.
tagDirective :: Char -> Builder Source #
The %TAG directive of the handle for the tags that start with the
character, with the line break. The prefix is always an escape, because
e.g. a # after a space starts a comment.
isPrintable :: Char -> Bool Source #
c-printable without the line breaks and the byte order mark.
isScalarChar :: Char -> Bool Source #
A printable character that needs no escape in a scalar. YAML 1.1 reads U+2028 and U+2029 as line breaks, so they get escapes too.