added intro

This commit is contained in:
Bachir Soussi Chiadmi
2017-10-18 12:30:38 +02:00
parent 50a22a57dc
commit f45f05be04
12 changed files with 1243 additions and 1083 deletions
+12 -8
View File
@@ -12,7 +12,8 @@ module.exports = {
{
'lc':'lat',
'label':'Latin (Carl Gebhardt)',
'db':'0-LAT-ethicadb.json'},
'db':'0-LAT-ethicadb.json'
},
{
'lc':'fr',
'label':'Français (Traduction par Charles Appuhn)',
@@ -70,6 +71,7 @@ module.exports = {
this.loaded_dbs ++;
//
if (this.loaded_dbs == this.langs.length) {
console.log('All db loaded : data', this.data);
this.parseByID(callback);
}
@@ -79,13 +81,15 @@ module.exports = {
// console.log('l', l);
this.data_byid[l] = {};
for (p in this.data[l]) {
// console.log(this.data[l][p]);
for (e in this.data[l][p].enonces) {
// console.log('e',e);
this.data_byid[l][this.data[l][p].enonces[e].id] = this.data[l][p].enonces[e];
for (c in this.data[l][p].enonces[e].childs){
// console.log(_db[p][e][c]);
this.data_byid[l][this.data[l][p].enonces[e].childs[c].id] = this.data[l][p].enonces[e].childs[c];
if(this.data[l][p].type !== "intro"){
// console.log(this.data[l][p]);
for (e in this.data[l][p].enonces) {
// console.log('e',e);
this.data_byid[l][this.data[l][p].enonces[e].id] = this.data[l][p].enonces[e];
for (c in this.data[l][p].enonces[e].childs){
// console.log(_db[p][e][c]);
this.data_byid[l][this.data[l][p].enonces[e].childs[c].id] = this.data[l][p].enonces[e].childs[c];
}
}
}
}
+9 -4
View File
@@ -13,7 +13,10 @@ var markdown = require('markdown-it')()
module.exports = {
view: function(vn){
return m('header', [
m('h1', 'Ethica'),
m('hgroup', [
m('h1', 'Ethica'),
m('h2', 'Benedictus Spinoza')
]),
// m('nav', {'id':'parts-nav'}, [
//
// ]),
@@ -40,9 +43,11 @@ var _PartsNav = {
m('h3', 'Parts'),
m('ul', _dbs.data[lang].map(function(p){
// console.log("anchors, part", p);
return m('li', [
m('a', {'href':'#'+p.id}, m.trust(markdown.renderInline(p.title)))
]);
if(p.id !== "intro"){
return m('li', [
m('a', {'href':'#'+p.id}, m.trust(markdown.renderInline(p.title)))
]);
}
})
)
]);
+26 -2
View File
@@ -303,6 +303,26 @@ var _Part = {
}
}
// ____ __
// / _/___ / /__________
// / // __ \/ __/ ___/ __ \
// _/ // / / / /_/ / / /_/ /
// /___/_/ /_/\__/_/ \____/
var _Intro = {
oninit : function(vn){
console.log('_Intro : oninit : vn', vn);
this.id = vn.attrs.id;
this.text = vn.attrs.text || '';
},
onbeforeupdate : function(vn, old){
this.id = vn.attrs.id;
this.text = vn.attrs.text || '';
},
view : function(vn){
return m("section", {'class':'intro'}, m("p",m.trust(markdown.renderInline(this.text))));
}
}
// ____ __ _
// / _/___ / / (_)___ ___
// / // __ \/ / / / __ \/ _ \
@@ -321,8 +341,12 @@ module.exports = {
return [
m(_Header),
m('main', {id:"content", 'class':'inline'}, _dbs.data[vn.attrs.lang].map(function(p){
// console.log("MAP _dbs", p);
return m(_Part,p);
console.log("MAP _dbs", p);
if(p.id == 'intro'){
return m(_Intro,p);
}else{
return m(_Part,p);
}
})
),
m(_Footer)
+25 -1
View File
@@ -322,6 +322,26 @@ var _Part = {
}
}
// ____ __
// / _/___ / /__________
// / // __ \/ __/ ___/ __ \
// _/ // / / / /_/ / / /_/ /
// /___/_/ /_/\__/_/ \____/
var _Intro = {
oninit : function(vn){
console.log('_Intro : oninit : vn', vn);
this.id = vn.attrs.id;
this.text = vn.attrs.text || '';
},
onbeforeupdate : function(vn, old){
this.id = vn.attrs.id;
this.text = vn.attrs.text || '';
},
view : function(vn){
return m("section", {'class':'intro'}, m("p",m.trust(markdown.renderInline(this.text))));
}
}
// ______
// /_ __/_______ ___
@@ -341,7 +361,11 @@ module.exports = {
return [
m(_Header),
m('main', {id:"content", 'class':'tree'}, _dbs.data[vn.attrs.lang].map(function(p){
return m(_Part,p);
if(p.id == 'intro'){
return m(_Intro,p);
}else{
return m(_Part,p);
}
})
),
m(_Footer)