dauglyon / textTemplater

jquery tool for making and filling text templates.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

textTemplater

textTemplater contains user-facing and Perl backend tools for building and filling user-defined templates.

Requires: jQuery, jQueryUI.sortable, Bootstrap CSS/JS;

JavaScript

Functionality is contained with the textTemplater global object.

# textTemplater.builder(selector, variables)
Creates a template-building form within the element idetified with the selector. The variables array should contain a strings to be used as variable names. Returns a new builder object. alt

# builder.form()
Returns the DOM node of the template-building form.

# builder.getTemplate()
Returns the template representation of the contents of the template-building form. For example, {__FIELD__Name}-{Year} would be returned for the configuration above.

# textTemplater.filler(selector, template)
Creates a template-filling form within the element idetified with the selector. The template string should comply with the following rules. Any substring matching the pattern {__FIELD__.+?} will be treated as a user-editable field. Any remaining substrings matching the pattern {.+?} will be treated as non-user-editable variables. The string should contain no other characters matching ({|}). Returns a new filler object.
alt

# filler.form()
Returns the DOM node of the template-filling form.

# filler.getTemplate()
Returns the template representation of the contents of the template-filling form. For example, Foo-{Year} would be returned for the configuration above.

# textTemplater.populateTemplate(templateString, template)
Given a template string templateString and an object template with {'variable':'value'} key/value pairs, this function populates the template with the given strings and returns the populated string.

Perl

Functionality is contained with the TextTemplater package.

# TextTemplater::populate(templateString, template)
Given a template string templateString and a hashref template with {'variable':'value'} key/value pairs, this function populates the template with the given strings and returns the populated string.

# TextTemplater::variables(templateString)
Given a template string templateString returns an array of variable name strings.

About

jquery tool for making and filling text templates.


Languages

Language:JavaScript 62.1%Language:HTML 21.7%Language:CSS 13.1%Language:Perl 3.0%