Jsonnet library to generate XML/HTML.
jb install github.com/Duologic/jsonml-libsonnet@main
local ml = import 'github.com/Duologic/jsonml-libsonnet/main.libsonnet';
local head = ml.tag.new('head');
local body =
ml.tag.new('body')
+ ml.tag.withElements(
ml.tag.new('h1')
+ ml.tag.withElements(
ml.literal.new('title')
)
);
local html =
ml.tag.new('html')
+ ml.tag.withAttributes(
ml.attribute.new('lang', 'en')
)
+ ml.tag.withElements([
head,
body,
]);
html.manifest()
attribute.new(name, value)
PARAMETERS:
- name (
string
) - value (
boolean
,null
,number
,string
)
attribute.withName(value)
PARAMETERS:
- value (
string
)
attribute.withType()
attribute.withValue(value)
PARAMETERS:
- value (
boolean
,null
,number
,string
)
literal.new(value)
PARAMETERS:
- value (
string
)
literal.withType()
literal.withValue(value)
PARAMETERS:
- value (
string
)
tag.new(name)
PARAMETERS:
- name (
string
)
tag.withAttributes(value)
PARAMETERS:
- value (
array
)
tag.withAttributesMixin(value)
PARAMETERS:
- value (
array
)
tag.withElements(value)
PARAMETERS:
- value (
array
)
tag.withElementsMixin(value)
PARAMETERS:
- value (
array
)
tag.withName(value)
PARAMETERS:
- value (
string
)
tag.withType()