function TagShort() {
    let data = {
        tag: null,
    };
    return {
        oninit: function(vnode) {
            console.log('TagShort.oninit');
            for (let key in vnode.attrs){
                data[key] = vnode.attrs[key];
            };
        },
        onbeforeupdate: function(vnode) {
            console.log('TagShort.onbeforeupdate');
            for (let key in vnode.attrs){
                data[key] = vnode.attrs[key];
            };
        },
        view: function(vnode) {
            console.log('TagShort.view');
            console.log(data);
            if (data.tag!=null) {
                return [
                    m('i', {class: 'fa fa-tag me-1'}),
                    m(m.route.Link, {class: "text-decoration-none me-2", href: `/tag/${data.tag.id}`}, data.tag.name),
                ]
            }
        }
    }
};
function TagsShort() {
    let data = {
        tags: null,
    };
    function tag_render(tag, tagIdx) {
        return [
            m('i', {class: 'fa fa-tag me-1'}),
            m(m.route.Link, {class: "text-decoration-none font-monospace me-2", href: `/tag/${tag.id}`}, tag.name),
        ]
    };
    function tags_render() {
        return data.tags.map(tag_render);
    };
    return {
        oninit: function(vnode) {
            console.log('TagsShort.oninit');
            for (let key in vnode.attrs){
                data[key] = vnode.attrs[key];
            };
        },
        onbeforeupdate: function(vnode) {
            console.log('TagsShort.onbeforeupdate');
            for (let key in vnode.attrs){
                data[key] = vnode.attrs[key];
            };
        },
        view: function(vnode) {
            console.log('TagsShort.view');
            if (data.tags!=null) {
                return m('div', {class: 'row'},
                    m('div', {class: 'col text-muted py-2'},
                        m('small', tags_render())
                    )
                );
            }
        }
    }
};
