You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Challenge:
Imagine a UI that builds templates and lists and then executes them dynamically. Adding those lists as actions is not currently possible.
Solution:
Allow configure to accept custom lists. Besides a key and values, you can specify whether to support articlize and pluralize:
varSentencer=require('sentencer');Sentencer.configure({// the list of nouns to use. Sentencer provides its own if you don't have one!nounList: [],// the list of adjectives to use. Again, Sentencer comes with one!adjectiveList: [],customLists: [{key: "animal",values: ["dog","cat","horse","pig","elephant"],articlize: "an_animal",// if named, add action that calls articlizepluralize: "animals"// if named, add action that calls pluralize},{key: "band",values: ["The Beatles","The Who","Styx"],articlize: "",// no key or empty value, don't articlizepluralize: ""// no key or empty value, don't pluralize}],// additional actions for the template engine to use.// you can also redefine the preset actions here if you need to.// See the "Add your own actions" section below.actions: {my_action: function(){return"something";}}});
The templates available for custom lists:
"{{ animal }}"
// "dog", "cat", "horse", "pig", "elephant"
"{{ an_animal }}"
// "a dog", "a cat", "a horse", "a pig", "an elephant"
"{{ animals }}"
// "dogs", "cats", "horses", "pigs", "elephants"
"{{ band }}"
// "The Beatles", "The Who", "Styx"
"{{ a_band }}"
// ignore
"{{ bands }}"
// ignore
The text was updated successfully, but these errors were encountered:
Type: FEATURE REQUEST
Challenge:
Imagine a UI that builds templates and lists and then executes them dynamically. Adding those lists as actions is not currently possible.
Solution:
Allow
configure
to accept custom lists. Besides a key and values, you can specify whether to support articlize and pluralize:The templates available for custom lists:
The text was updated successfully, but these errors were encountered: