This page describes the API of this Bootprint-module
Source file | bootprint-base @ 2.0.0-rc.2 / handlebars/templates/index.html.hbs |
---|---|
Structure |
|
Default template for rendering the HTML-page.
It can be replaced by another template if needed. However, in the average case,
it should be left unmodified since it calls partials that can be overridden instead.
The template includes the result of the Less-compiler (`main.css`)
and places the other partials (`base/header`, `base/body` and `base/footer`)
above, within and below a `div.container`-element.
@public
Source file | bootprint-json-schema @ 2.0.0-rc.3 / handlebars/partials/base/body.hbs |
---|---|
Uses partials | json-schema/schema, json-schema/definitions |
Used by | index.html |
Renders the main-schema as panel and the sub-schemas below.
This partial can be overridden if json-schema is only part of
what should be displayed.
@public
Source file | bootprint-base @ 2.0.0-rc.2 / handlebars/partials/base/footer.hbs |
---|---|
Used by | index.html |
This partial is displayed at the bottom of the HTML-body.
It is empty and can be overridden to include custom content in
the Bootprint-result.
@param {object} $context$ the whole input data
@public
Source file | bootprint-json-schema @ 2.0.0-rc.3 / handlebars/partials/base/header.hbs |
---|---|
Uses partials | json-schema/navbar |
Used by | index.html |
Renders the part at the top of the page, which is the navigation bar by default
This partial can be overridden in order to remove or change the navigation or
display additional data
@public
Source file | bootprint-base @ 2.0.0-rc.2 / handlebars/partials/base/html-head-extra.hbs |
---|---|
Used by | base/html-head |
This partial is added inside the <head>-tag, after the
other declarations of the "base/html-head"-partial.
@param {object} $context$ the whole input data
@public
Source file | bootprint-base @ 2.0.0-rc.2 / handlebars/partials/base/html-head.hbs |
---|---|
Uses partials | base/title, base/html-head-extra |
Used by | index.html |
This partial is rendered into the `<head>`-tag of the page.
Additional tags can be placed in the partial `base/html-head-extra.hbs`.
This partial can also be overridden to replace its contents, but beware
that changes to this file may happen without incrementing the major version.
@access private
Source file | bootprint-base @ 2.0.0-rc.2 / handlebars/partials/base/javascript-libs.hbs |
---|---|
Used by | index.html |
This partial is rendered below the `footer`-partial of the page. You can include
a javascript-bundle here that can be created by using `customize-engine-uglify`
Source file | bootprint-base @ 2.0.0-rc.2 / handlebars/partials/base/title.hbs |
---|---|
Used by | base/html-head |
This partial is rendered into the HTML-title in the `<head>`-tag of the page.
It can be overridden in order to display a custom title.
Source file | bootprint-json-schema @ 2.0.0-rc.3 / handlebars/partials/json-schema/allOf.hbs |
---|---|
Uses partials | json-schema/schema |
Used by | json-schema/schema |
Render the allOf keyword of a json-schema
@this {object} the json-schema
Source file | bootprint-json-schema @ 2.0.0-rc.3 / handlebars/partials/json-schema/anyOf.hbs |
---|---|
Uses partials | json-schema/schema |
Used by | json-schema/schema |
Render the anyOf keyword of a json-schema
@this {object} the json-schema
Source file | bootprint-json-schema @ 2.0.0-rc.3 / handlebars/partials/json-schema/array.hbs |
---|---|
Uses partials | json-schema/schema, json-schema/schema, json-schema/schema, json-schema/schema |
Used by | json-schema/schema |
Renders the array-specific keywords of a json-schema
@this {object} the json-schema
Source file | bootprint-json-schema @ 2.0.0-rc.3 / handlebars/partials/json-schema/const.hbs |
---|---|
Uses partials | json-schema/util/value |
Used by | json-schema/schema |
Render the "const" keyword of a json-schema
@this {object} the json-schema
Source file | bootprint-json-schema @ 2.0.0-rc.3 / handlebars/partials/json-schema/definitions.hbs |
---|---|
Uses partials | json-schema/schema |
Used by | base/body |
Renders the defintiions-property of the main-schema
@this {object} the json-schema
Source file | bootprint-json-schema @ 2.0.0-rc.3 / handlebars/partials/json-schema/draft-04/default.hbs |
---|---|
Uses partials | json-schema/util/value |
Used by | json-schema/examples-default |
Render default values as in draft-04 (without "examples")
Source file | bootprint-json-schema @ 2.0.0-rc.3 / handlebars/partials/json-schema/enum.hbs |
---|---|
Uses partials | json-schema/util/value |
Used by | json-schema/schema |
Render the enum keyword of a json-schema
@this {object} the json-schema
Render the "examples" and "default" keywords of a json-schema
@this {object} the json-schema
Source file | bootprint-json-schema @ 2.0.0-rc.3 / handlebars/partials/json-schema/format.hbs |
---|---|
Used by | json-schema/schema |
Render the "format" keyword of a json-schema
@this {object} the json-schema
Source file | bootprint-json-schema @ 2.0.0-rc.3 / handlebars/partials/json-schema/navbar.hbs |
---|---|
Used by | base/header |
Renders the navigation bar at the top of the page
@this {object} the json-schema
Source file | bootprint-json-schema @ 2.0.0-rc.3 / handlebars/partials/json-schema/not.hbs |
---|---|
Uses partials | json-schema/schema |
Used by | json-schema/schema |
Render the not keyword of a json-schema
@this {object} the json-schema
Source file | bootprint-json-schema @ 2.0.0-rc.3 / handlebars/partials/json-schema/number.hbs |
---|---|
Used by | json-schema/schema |
Render the number-specific keywords of a json-schema
@this {object} the json-schema
Render the object-specific keyword of a json-schema
@this {object} the json-schema
Source file | bootprint-json-schema @ 2.0.0-rc.3 / handlebars/partials/json-schema/oneOf.hbs |
---|---|
Uses partials | json-schema/schema |
Used by | json-schema/schema |
Render the oneOf keyword of a json-schema
@this {object} the json-schema
Source file | bootprint-json-schema @ 2.0.0-rc.3 / handlebars/partials/json-schema/ref.hbs |
---|---|
Used by | json-schema/schema |
Renders a single json-reference
@this {object} the object containing the $ref-property
Renders a json-schema. This is the entry-point of the schema.
@this {object} the json-schema
Source file | bootprint-json-schema @ 2.0.0-rc.3 / handlebars/partials/json-schema/string.hbs |
---|---|
Uses partials | json-schema/util/regex |
Used by | json-schema/schema |
Render the string-specific keywords of a json-schema
@this {object} the json-schema
Source file | bootprint-json-schema @ 2.0.0-rc.3 / handlebars/partials/json-schema/type.hbs |
---|---|
Used by | json-schema/schema |
Render the "type" keyword of a json-schema
@this {object} the json-schema
Source file | bootprint-json-schema @ 2.0.0-rc.3 / handlebars/partials/json-schema/util/regex.hbs |
---|---|
Used by | json-schema/object, json-schema/string |
Renders a regular express (e.g. for `patternProperties` and `pattern`)
Source file | bootprint-json-schema @ 2.0.0-rc.3 / handlebars/partials/json-schema/util/section.hbs |
---|---|
Uses partials | @partial-block |
Helper partial to render a section for a keyword (items, type, properties etc).
The partial is used as block-partial and the @partial-block is the contents of the
section.
@param {string} sections a coma-separated list of section names (i.e. items, additionalItems)
@param {string} title a title for the restrictions
@public
Renders a single default, enum or const value
@this {*} the value
Source file | bootprint-json-schema @ 2.0.0-rc.3 / handlebars/partials/json-schema/util/values.hbs |
---|---|
Uses partials | json-schema/util/value |
Render a list of example values
@this {*[]} the list of values
(from [email protected]/handlebars/helpers.js )
Default Handlebars-helpers for bootprint-base
Kind: global variable
- helpers
- .toUpperCase(value) ⇒
string
- .eachSorted() ⇒
string
- .equal(value1, value2) ⇒
boolean
- .md(`value`) ⇒
Handlebars.SafeString
- .ifeq(`v1`, `v2`)
- .json(value) ⇒
string
- .ifcontains(array, object, options) ⇒
string
- .htmlId(value) ⇒
string
- .toUpperCase(value) ⇒
Converts a string to uppercase
Kind: static method of helpers
Returns: string
- the uppercase string
Access: public
Param | Type | Description |
---|---|---|
value | string |
the input string |
This block-helper can be used to iterate objects sorted by key. It behaves like the built-in
{{#each ...}}
-helper except that it can only be used for objects and the output is in a
deterministic order (i.e. sorted).
Example template:
With the data { b: 'another one', a: 'first' }
, ignoring newlines and indents, this will output
1 of 2: a=first
2 of 2: b=another one
The helper will set the following @-values according to the Handlebars documentation:
@first
, @index
, @key
, @last
, @length
Kind: static method of helpers
Access: public
Checks whether two values a equal as in value1 == value2
(not ===
)
Kind: static method of helpers
Access: public
Param |
---|
value1 |
value2 |
Render a markdown-formatted text as HTML.
Kind: static method of helpers
Returns: Handlebars.SafeString
- a Handlebars-SafeString containing the provieded
markdown, rendered as HTML.
Access: public
Param | Type | Description |
---|---|---|
value |
string |
the markdown-formatted text |
options.hash.stripParagraph |
boolean |
the marked-md-renderer wraps generated HTML in a <p>-tag by default. If this options is set to true, the <p>-tag is stripped. |
Block helper that compares to values. The body is executed if both value equal. Example:
Kind: static method of helpers
Access: public
Param | Type | Description |
---|---|---|
v1 |
object |
the first value |
v2 |
object |
the second value |
Converts a javascript-object into a stringified highlighted JSON-object
Kind: static method of helpers
Access: public
Param | Type | Description |
---|---|---|
value | object |
the javascript object |
Executes the block, if an object is part of an array
Kind: static method of helpers
Access: public
Param | Type | Description |
---|---|---|
array | Array.<object> |
the array |
object | object |
the javascript object |
options | object |
the Handlebars options |
Replace all characters that may not be used in HTML id-attributes by '-'. There is still the restriction that IDs may only start with letters, which is not addressed by this helper.
Kind: static method of helpers
Returns: string
- the value after replacement and escaping
Access: public
Param | Type | Description |
---|---|---|
value | string |
the input value |
(from [email protected]/handlebars/helpers/index.js )
Default Handlebars-helpers for bootprint-json-schema
Kind: global variable
- helpers
- .json_schema__doclink(type, sectionName, options) ⇒
string
|Handlebars.SafeString
- .json_schema__if_version(...targetVersions)
- .json_schema__datatype(schema, types) ⇒
String
- .json_schema__number_range(schema, options) ⇒
string
- .json_schema__definition_id(name) ⇒
string
- .json_schema__count_range([min], [max], singular, plural) ⇒
string
|null
- .json_schema__subschema_name(url) ⇒
*
- .json_schema__is_required(schema, propertyName) ⇒
boolean
- .json_schema__could_be_numeric() ⇒
boolean
- .json_schema__could_be_of_type(type) ⇒
boolean
- .json_schema__split_coma(list) ⇒
Array.<string>
- .json_schema__is_array(value) ⇒
boolean
- .json_schema__has_any(schema, ...keywords) ⇒
boolean
- .json_schema__enumerate(items) ⇒
string
- .json_schema__doclink(type, sectionName, options) ⇒
Render a link to a json-schema docs section from the json-schema documentation. If the section does not exist, it is assumed to be a vendor extension. The mapping of names to section numbers can be found in the version-specific helper files.
Kind: static method of helpers
Returns: string
| Handlebars.SafeString
- a SafeString containing a link to the documentation or
'vender extension' if there is no section of the given name
Access: public
Param | Type | Description |
---|---|---|
type | string |
the type of section (keywords, formats) |
sectionName | string |
the section name (e.g. items) |
options | object |
the Handlebars options |
Executes the helper-block, if the version matches any of the specified target versions
Kind: static method of helpers
Access: public
Param | Type | Description |
---|---|---|
...targetVersions | string |
a list of schema-versions to match against (varargs) |
Returns the datatype of a schema as short formal string like array<string|integer>
Kind: static method of helpers
Returns: String
- a string like array<string|integer>
Access: public
Param | Type | Description |
---|---|---|
schema | object |
a json-schema |
types | string | Array.<string> |
one or more types of potentially multiple types in the schema that should be used right now. |
Return a string for the numeric range restriction of the given schema
(as determined by minimum
, maximum
, exclusiveMinimum
and exclusiveMaximum
properties).
The implementation is dispatched to version-specific behavior because draft-04
and draft-05
differ from draft-06
Kind: static method of helpers
Returns: string
- a string like 1 < x < 2
or x ≤ 5
Access: public
Param | Type | Description |
---|---|---|
schema | object |
the current (sub-)schema |
options | object |
the Handlebars options |
Compute the element-id for a definition panel
Kind: static method of helpers
Returns: string
- an id without invalid characters for HTML-ids
Access: public
Param | Type | Description |
---|---|---|
name | string |
the name of the definition (the key within the definitions object) |
Returns a prose-description of a number of things (e.g. "at least one item", "2 to 5 items")
Kind: static method of helpers
Returns: string
| null
- a prose-description or null
if there is no range
Access: public
Param | Type | Description |
---|---|---|
[min] | number |
the lower bound |
[max] | number |
the upper bound |
singular | string |
the "thing" in it singular form |
plural | string |
the "thing" it its plural form |
Extract then name of a subschema from a $ref property
Kind: static method of helpers
Access: public
Param | Type |
---|---|
url | string |
Returns "true", if the given propertyName is among the required properties of a schema
Kind: static method of helpers
Returns: boolean
- true, if the given propertyName is required
Access: public
Param | Type | Description |
---|---|---|
schema | object |
the json-schema to check for required properties of |
propertyName | string |
the property the name of the property |
Return true, if the type is numeric (integer or number) or could be numeric
The type could be numeric, if it is an array that includes number or integer, or if it is not specified.
Kind: static method of helpers
Returns: boolean
- true, if the type could be numeric
this: {undefined|string|string[]}
Access: public
Return true, if the dataType of a schema could be a given type
This includes an undefined type
property, an array type
-property that includes
the checke values and a string `type'-property that equals the checked value.
Kind: static method of helpers
Returns: boolean
- true, if the type of the schema could be the parameter
Access: public
Param | Type | Description |
---|---|---|
type | string |
the type to check the schema against |
Splits a coma-separated list into an array.
This helper can be used as nested-helper for other helpers that expect arrays
Kind: static method of helpers
Returns: Array.<string>
- the list items as array
Access: public
Param | Type | Description |
---|---|---|
list | string |
a coma-separated list of strings |
Returns true, if the value is an array
Kind: static method of helpers
Returns: boolean
- true, if the value is an array
Access: public
Param | Type | Description |
---|---|---|
value | * |
the value |
Checks, if the given schema contains any of the provided keywords (like "type" or "items")
Kind: static method of helpers
Returns: boolean
- true, if any of the keywords exists in the schema
Access: public
Param | Type | Description |
---|---|---|
schema | object |
a json-schema |
...keywords | string |
a list of keywords to check again |
Convert an array into a prose-enumeration
Kind: static method of helpers
Returns: string
- a written enumeration (a,b and c)
Access: public
Param | Type | Description |
---|---|---|
items | Array.<string> |
an array of strings (e.g. ['a','b','c']) |