Stream: shorthand
Topic: Setting xhtml via FSH?
Jean Duteau (Mar 27 2020 at 01:43):
I am trying to set some Narrative in my examples. The Narrative.div is xhtml datatype and I can't see in the docs or via trial-and-error how to set an xhtml datatype to something.
Nick Freiter (Mar 27 2020 at 11:50):
You can use a string to set xhtml values. Specifically it may be easiest to use a multiline string, which starts and ends with """
, as shown in this example:
* text.div = """ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Title of document</title> </head> <body> some content </body> </html>"""
One thing to be wary of is indentation. Experimenting with this has made me realize that SUSHI has a bug that will cause the beginning of a non-indented line to be chopped off if the same multiline string contains indented lines. So for now if you can just keep everything non-indented, multiline strings should work, and we will fix that bug soon.
Last updated: Apr 12 2022 at 19:14 UTC