.render2() almost working...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2019-04-24 04:17:07 +03:00
parent 74bbd02a87
commit 09e4cb26ad

View File

@ -1473,7 +1473,8 @@ var BaseBrowserPrototype = {
items.join('\n') items.join('\n')
: items : items
}, },
// XXX
// XXX still need to wrap inline lists of items (groups and friends)...
render2: function(options, renderer){ render2: function(options, renderer){
var that = this var that = this
// XXX Q: should options and context be distinguished only via // XXX Q: should options and context be distinguished only via
@ -1486,7 +1487,13 @@ var BaseBrowserPrototype = {
// lists can have their own unique sets of options // lists can have their own unique sets of options
// independently of the root list... // independently of the root list...
//options: options || this.options || {}, //options: options || this.options || {},
options: Object.assign(Object.create(this.options || {}), options || {}), options: Object.assign(
Object.create(this.options || {}),
// XXX is this the correct way to setup defaults???
{
iterateNonIterable: true,
},
options || {}),
} }
: options : options
options = context.options options = context.options
@ -1502,6 +1509,7 @@ var BaseBrowserPrototype = {
// XXX call renderers... // XXX call renderers...
return ( return (
// inline... // inline...
// XXX need to wrap groups/inline stuff...
(item == null && sublist) ? (item == null && sublist) ?
// NOTE: here we are forcing rendering of the // NOTE: here we are forcing rendering of the
// inline browser/list, i.e. ignoring // inline browser/list, i.e. ignoring
@ -1509,16 +1517,17 @@ var BaseBrowserPrototype = {
nested(true) nested(true)
// nested... // nested...
: sublist ? : sublist ?
renderer.renderNested( [renderer.renderNested(
that.renderNestedHeader(item, i, context), renderer.renderNestedHeader(item, i, context),
nested(), nested(),
item, item,
context) context)]
// normal item... // normal item...
: that.renderItem(item, i, context) : [renderer.renderItem(item, i, context)]
) }, ) },
function(func, path, sublist, options){ function(func, i, path, sublist, options){
return sublist.render2(context) }) return sublist.render2(context) },
options)
return context.root === this ? return context.root === this ?
renderer.renderList(items, context) renderer.renderList(items, context)