Hello. Can anyone tell me what the HTML DSL equiva...
# ktor
p
Hello. Can anyone tell me what the HTML DSL equivalent of
Copy code
<section  data-markdown> ... </section>
would be? In other words, how are tag attributes with no values expressed in the DSL?
s
I guess it can have any value, like "true"
p
Yes, I know how to express tag attributes with values.
Copy code
<section  id="test"> ... </section>
is written as:
Copy code
section { attributes["id"] = "test" }
but I am asking about the case where the tag attribute is not assigned a value.
An example of the html I am trying to generate is line 39 of this file: https://github.com/hakimel/reveal.js/blob/0582f57517c97a4c7bfeb58762138c78883f94c5/examples/markdown.html#L39 You can see the
Copy code
data-markdown
tag attribute is not assigned a value.
s
Does it work when you write
<section  data-markdown> ... </section>
as
section { attributes["data-markdown"] = "true" }
? I don't remember JS well but I think it should. In JS, there should be the same problem of accessing attributes without values, I think there should be just any value
p
If you assign it "true" it generates:
Copy code
<section data-markdown="true"> ... </section>
which is not the same thing (and causes problems).
s
causes problems
Then I don't know. But actually I'm interested what problems does it cause. Why do you need exactly ``<section data-markdown> ... </section>`` without a value of the attribute?
p
I am wrapping the reveal.js framework and and adding the "true" value results in the markdown not displaying properly. I do not know JS well enough to dig into the problem. I just want to give it what it wants.
t
<section  data-markdown>
is same to
<section  data-markdown="data-markdown">
You may see attributes without the equals sign or a value. That is a shorthand for providing the empty string in HTML, or the attribute’s name in XML.
To be clear, the values "`true`" and "`false`" are not allowed on boolean attributes.
p
Thank you very much @tateisu.