sclass HTMLFramer1 { S title; // will be HTML-encoded new L navItems; new LS contents; new LS headElements; bool navBeforeTitle; srecord NavItem(S link, S html) { bool targetBlank; } swappable S render() { ret hhtml(hhead(htitle(title) + lines(headElements)) + hbody( (navBeforeTitle ? renderNav() + renderTitle() : renderTitle() + renderNav()) + lines(contents))); } swappable S renderTitle() { ret h1(htmlEncode2(title)); } swappable S renderNav() { if (empty(navItems)) ret ""; ret p(joinWithVBar(map(navItems, ni -> ahref_possiblyTargetBlank(ni.link, ni.html, ni.targetBlank)))); } void addNavItem(S html) { navItems.add(new NavItem(null, html)); } void addNavItem(S link, S html, O... _) { navItems.add(setAll(new NavItem(link, html), filterParams(_, 'targetBlank))); } void addInHead(O html) { headElements.add(str(html)); } // add contents: TODO move things to head automatically void add(O html) { addIfNempty(contents, strOrEmpty(html)); } }