This commit is contained in:
Bachir Soussi Chiadmi
2017-10-15 18:16:21 +02:00
parent c2670d0ec7
commit 36a73919c4
5 changed files with 33 additions and 27 deletions
+10 -9
View File
@@ -29,11 +29,12 @@ var _Dot = {
// console.log('setuptext', vn);
// construct text
this.text = markdown.render(vn.attrs.text);
this.text = vn.attrs.text || '';
this.rendered_text = markdown.render(this.text);
// construct summary
// TODO: summary needs more work (strip tags, markdown render)
this.summary = vn.attrs.text.match('([^ ]*[ ]{0,1}){1,6}')[0];
this.summary = this.text.match('([^ ]*[ ]{0,1}){1,6}')[0];
this.summary = this.summary.trim().replace(/_([^_]+)$/g, "_$1_");
this.summary = this.summary.replace(/\[([^\]]+)$/g, "$1");
this.summary = markdown.renderInline(this.summary) + " …";
@@ -128,7 +129,7 @@ var _Dot = {
vn.dom.querySelector('nav.links>div[uid="'+id+'"]>.summary').click();
}
}
}, m.trust(this.text)),
}, m.trust(this.rendered_text)),
// links from
this.links.from.length
? m('nav', {'class':'links from'}, this.links.from.map(function(id){
@@ -246,16 +247,16 @@ var _Enonce = {
// // console.log('Enonce on init', vn);
this.partid = vn.attrs.partid;
this.id = vn.attrs.id;
this.title = vn.attrs.title;
this.title = vn.attrs.title || "";
this.text = vn.attrs.text;
this.childs = vn.attrs.childs;
this.childs = vn.attrs.childs || [];
// this.nested = vn.attrs.nested || false;
},
onbeforeupdate:function(vn, old) {
// console.log(vn.attrs.childs);
this.title = vn.attrs.title;
this.title = vn.attrs.title || "";
this.text = vn.attrs.text;
this.childs = vn.attrs.childs;
this.childs = vn.attrs.childs || [];
// this.nested = vn.attrs.nested || false;
// if(vn.attrs.id == '1d1') console.log('_Enonce UPDATE, text :', vn.attrs.text);
},
@@ -281,12 +282,12 @@ var _Enonce = {
var _Part = {
oninit: function(vn){
this.id = vn.attrs.id;
this.title = vn.attrs.title;
this.title = vn.attrs.title || "";
this.enonces = vn.attrs.enonces;
},
onbeforeupdate: function(vn, old){
// console.log('_Part, onbeforeupdate old',old);
this.title = vn.attrs.title;
this.title = vn.attrs.title || "";
this.enonces = vn.attrs.enonces;
},
view: function(vn){