vxml
Core VXML tree types, parsers, validators, and serializers.
VXML is a generic XML-like tree with two node kinds: element nodes (V)
and text nodes (T). It can be serialized to a readable VXML text format,
HTML, or JSX-like output. This module also includes XML/HTML parsing helpers.
Types
An attribute on a VXML element node.
pub type Attr {
Attr(blame: blame.Blame, key: String, val: String)
}
Constructors
-
Attr(blame: blame.Blame, key: String, val: String)
pub type BadKey {
EmptyKey
IllegalKeyCharacter(String, String)
}
Constructors
-
EmptyKey -
IllegalKeyCharacter(String, String)
pub type BadTag {
EmptyTag
MalformedTag(String, String)
}
Constructors
-
EmptyTag -
MalformedTag(String, String)
pub type BadText {
EmptyText
IllegalTextCharacter(String, String)
}
Constructors
-
EmptyText -
IllegalTextCharacter(String, String)
pub type BadValue {
IllegalValueCharacter(String, String)
}
Constructors
-
IllegalValueCharacter(String, String)
One line of text inside a VXML text node.
pub type Line {
Line(blame: blame.Blame, content: String)
}
Constructors
-
Line(blame: blame.Blame, content: String)
A generic XML-like tree.
V is an element node. T is a text node containing one or more lines.
pub type VXML {
V(
blame: blame.Blame,
tag: String,
attrs: List(Attr),
children: List(VXML),
)
T(blame: blame.Blame, lines: List(Line))
}
Constructors
-
V( blame: blame.Blame, tag: String, attrs: List(Attr), children: List(VXML), ) -
T(blame: blame.Blame, lines: List(Line))
pub type VXMLParseError {
VXMLParseErrorAttributeAssignmentMissing(blame.Blame, String)
VXMLParseErrorBadTag(blame.Blame, BadTag)
VXMLParseErrorBadAttributeKey(blame.Blame, BadKey)
VXMLParseErrorIndentationTooLarge(blame.Blame, String)
VXMLParseErrorIndentationNotMultipleOfFour(blame.Blame, String)
VXMLParseErrorTextMissing(blame.Blame)
VXMLParseErrorTextNoClosingQuote(blame.Blame, String)
VXMLParseErrorTextNoOpeningQuote(blame.Blame, String)
VXMLParseErrorTextOutOfPlace(blame.Blame, String)
VXMLParseErrorCaretExpected(blame.Blame, String)
VXMLParseErrorNonUniqueRoot(Int)
}
Constructors
-
VXMLParseErrorAttributeAssignmentMissing(blame.Blame, String) -
VXMLParseErrorBadTag(blame.Blame, BadTag) -
VXMLParseErrorBadAttributeKey(blame.Blame, BadKey) -
VXMLParseErrorIndentationTooLarge(blame.Blame, String) -
VXMLParseErrorIndentationNotMultipleOfFour(blame.Blame, String) -
VXMLParseErrorTextMissing(blame.Blame) -
VXMLParseErrorTextNoClosingQuote(blame.Blame, String) -
VXMLParseErrorTextNoOpeningQuote(blame.Blame, String) -
VXMLParseErrorTextOutOfPlace(blame.Blame, String) -
VXMLParseErrorCaretExpected(blame.Blame, String) -
VXMLParseErrorNonUniqueRoot(Int)
pub type VXMLParseFileError {
IOError(simplifile.FileError)
DocumentError(VXMLParseError)
}
Constructors
-
IOError(simplifile.FileError) -
DocumentError(VXMLParseError)
pub type VXMLSerializationError {
VXMLSerializationError(
partial: List(io_lines.OutputLine),
blame: blame.Blame,
problem: VXMLSerializationProblem,
)
}
Constructors
-
VXMLSerializationError( partial: List(io_lines.OutputLine), blame: blame.Blame, problem: VXMLSerializationProblem, )
Values
pub fn html_repair(content: String) -> String
pub fn html_repair_close_void_tags(content: String) -> String
pub fn html_repair_escape_non_entity_ampersands(
content: String,
) -> String
pub fn html_repair_expand_boolean_attrs(
content: String,
) -> String
pub fn html_repair_remove_attrs_from_closing_tags(
content: String,
) -> String
pub fn parse_file(
path: String,
unique_root: Bool,
) -> Result(List(VXML), VXMLParseFileError)
Parse a file containing the VXML text format.
pub fn parse_input_lines(
lines: List(io_lines.InputLine),
unique_root: Bool,
) -> Result(List(VXML), VXMLParseError)
pub fn parse_string(
source: String,
filename: String,
unique_root: Bool,
) -> Result(List(VXML), VXMLParseError)
Parse a string containing the VXML text format.
pub fn parse_xml(
content: String,
filename: String,
) -> Result(VXML, #(blame.Blame, String))
Parse an XML-like string into VXML.
pub fn parse_xml_input_lines(
lines: List(io_lines.InputLine),
) -> Result(VXML, #(blame.Blame, String))
Parse XML-like input lines into VXML.
pub const tag_pattern: String
pub fn validate_key(key: String) -> Result(String, BadKey)
Validate an attribute key for the VXML text format.
pub fn validate_tag(tag: String) -> Result(String, BadTag)
Validate an element tag for the VXML text format.
pub fn validate_value(value: String) -> Result(String, BadValue)
Validate an attribute value for the VXML text format.
pub const vxml_indent: Int
pub const vxml_line_delimiter: String
pub fn vxml_table(
vxml: VXML,
banner: String,
indent: Int,
) -> Result(String, VXMLSerializationError)
pub fn vxml_to_html_output_lines(
node: VXML,
indent: Int,
spaces: Int,
) -> List(io_lines.OutputLine)
Serialize one VXML node to HTML output lines.
pub fn vxml_to_jsx(
vxml: VXML,
starting_indent: Int,
indentation: Int,
) -> String
pub fn vxml_to_jsx_output_lines(
vxml: VXML,
starting_indent: Int,
indentation: Int,
) -> List(io_lines.OutputLine)
pub fn vxml_to_output_lines(
vxml: VXML,
) -> Result(List(io_lines.OutputLine), VXMLSerializationError)
Serialize one VXML node to VXML text-format output lines.
pub fn vxml_to_string(
vxml: VXML,
) -> Result(String, VXMLSerializationError)
Serialize one VXML node to the VXML text format.
pub fn vxmls_to_html_output_lines(
vxmls: List(VXML),
indent: Int,
spaces: Int,
) -> List(io_lines.OutputLine)
pub fn vxmls_to_jsx(
vxmls: List(VXML),
starting_indent: Int,
indentation: Int,
) -> String
pub fn vxmls_to_jsx_output_lines(
vxmls: List(VXML),
starting_indent: Int,
indentation: Int,
) -> List(io_lines.OutputLine)
pub fn vxmls_to_output_lines(
vxmls: List(VXML),
) -> Result(List(io_lines.OutputLine), VXMLSerializationError)
pub fn vxmls_to_string(
vxmls: List(VXML),
) -> Result(String, VXMLSerializationError)