I do not think that there is something built in. Fortunately, Hamlet is easy to use helper functions. For example, if your elements are string strings, you can simply use Data.List.intercalate
to add commas between them.
The values in the list are
If you want to do more interesting things, you can write functions to work with Hamlet values. For example, here is a function that adds commas and "and" between the values ββof Hamlet in the list.
commaify [x] = x commaify [x, y] = [hamlet|^{x} and ^{y}|] commaify (x:xs) = [hamlet|^{x}, ^{commaify xs}|]
In this case, the syntax ^{...}
is used to insert one Hamlet value into another. Now we can use this to write a list of underlined words separated by commas.
The values in the list are ^{commaify (map underline list)} and that is it.
Here, underline
is just a small helper function to create something more interesting than plain text.
underline word = [hamlet|<u>
When rendering this gives the following result.
The values in the list are <u>foo</u>, <u>bar</u> and <u>baz</u> and that is it.
source share