json-to-html-parser v0.0.0
Description
Each object from the JSON represents an HTML element. If the object contains a property called "elements" - array, the HTML element must adopt the elements nested in that array.
The types of HTML elements that the walker (processor, parser) supports are:
- "container" (block element)
- "label" (inline element)
- "fieldset" (fieldset element)
- "textfield" (input type text element)
- "password" (input type password element)
- "textarea" (textarea element)
- "checkbox" (input type checkbox element)
- "radio" (input type radio element)
- "dropdown" (select element)
- "submit" (input type submit element)
If an object contains a "label" property, the HTML form element must be printed together with a element, both wrapper inside a new "container" element, unless they are already nested inside a "container" - then we don't explicitly print new container. Field labels must be displayed on the left, unless the field is from the following types: "checkbox" or "radio" - then the label is shown on the right of the field. The value of the "label" property is used for text in the .
If an object has an "html" property, the value of that property must be set as inner HTML to the element. Then come the elements defined in "elements" property (if any).
Running
node parse index.json - creates a index.html file
8 years ago