1 # @squeep/html-template-helper
3 Simplistic helpers for rendering HTML and boilerplate.
5 Specific to Squeep Framework Applications, this module has strong opinions and makes many assumptions.
10 - `htmlPage(pagePathLevel, ctx, options, main = [])`
11 - `dateOrNot(date, otherwise)`
12 - `dateFormat(date, pInf nInf, otherwise)`
13 - `timeElement(date, options)`
14 - `secondsToPeriod(seconds)`
15 - `indented(intent, list)`
16 - `UL(items, indent, attributes, itemAttributesGenerator)`
17 - `OL(items, indent, attributes, itemAttributesGenerator)`
18 - `LI(item, indent, attributes)`
22 The context is referenced for authenticated user information, as well as messaging.
24 - `ctx.session.authenticatedIdentifier`
25 - `ctx.session.authenticatedProfile`
27 If either of these are present, navigation links are added to the page header allowing the user to manage their account or log out.
28 The links will point relatively to `/admin/settings` and `/admin/logout`, respectively.
32 If present, added as a query parameter (`r`, for redirect) to the logout link.
37 Lists of errors and notices to show at top of page, before main content.
38 `initContext` will create the arrays.
42 - `options.pageTitle` - title and h1
43 - `options.headElements` - list of items added to <head>
44 - `options.bodyAttributes` - object entries get mapped to k="v", included on body element
45 - `options.logoUrl` - appears beside h1 if set
46 - `options.footerEntries` - array of content at bottom of page
47 - `options.navLink` - array of {href, text, class} included in page header
48 - `options.errorHeading` - h2 for error section
49 - `options.errorContent` - additional information included ahead of list of errors
50 - `options.notificationHeading` - h2 for notice section
51 - `options.notificationContent` - additional information included ahead of list of notices
56 `LintHtml` class is a simple wrapper around html-validate package which can report issues with generated html strings.