Dim convert As WiLConverter
convert.initialize(False)
'This section and its helper subs will expand quite a bit for all the attributes, inline style, and content stuff
Dim viewMap As Map = convert.parseVariant(variantList)
Dim mainMap As Map = viewMap.Remove("*")
'Translate the properties of the view maps to HTML terms
Dim translatedMaps As Map = CreateMap()
For Each viewName As String In viewMap.Keys
Dim propMap As Map = addLowerCase(viewMap.Get(viewName))
'translateView is the sub that does item by item conversion - I omitted it here (it is pretty boring)
translatedMaps.Put(viewName, translateView (propMap, viewMap, mainMap))
Next
'It isn't hard to build the generic view tree - it is a utility method of WiLConverter
Dim viewTree As Map = convert.mapToTree(translatedMaps)
'We do need to convert the htmtag property of the root and its children (recursively)
Dim lst As List = emptyList
For Each vwname As String In viewTree.Keys
Dim viewMap As Map = viewTree.Get(vwname)
lst.Add(convertToNew(viewMap))
Next
'add the html - head - body containers and body contents to a miniHTM map - using the HM helper code module works too
Dim children As List = emptyList
Dim headElements As List = emptyList
headElements.Add(CreateMap("title": mainMap.Get("title").as(String).replace(QUOTE,"")))
children.Add(CreateMap("head": CreateMap("children": headElements)))
Dim bodyElements As List = emptyList
bodyElements.Add(lst.Get(0))
Dim color As String = mainMap.Get("basecolor")
If color<> "" Then
If color.StartsWith("0x") Then color = "#" & color.SubString(4).toLowerCase
Dim colstr As String = $"background-color: ${color};"$
children.Add(CreateMap("body": CreateMap("style": colstr, "children": bodyElements)))
Else
children.Add(CreateMap("body": CreateMap("children": bodyElements)))
End If
Dim htmlMap As Map = CreateMap("html": CreateMap("lang": "en", "children": children))
'use MiniHTML to do the heavy lifting
Dim mht As MiniHtml
mht.initialize("")
File.WriteString(File.DirApp, "test.htm", mht.fromMap(htmlMap).build)