added lat and en languages, handeled new data structure : titles and filet

This commit is contained in:
Bachir Soussi Chiadmi
2017-10-12 14:24:27 +02:00
parent df788ba0b7
commit 72602b3e12
12 changed files with 11108 additions and 10363 deletions
+7 -2
View File
@@ -9,8 +9,10 @@
module.exports = {
lang:'fr',
langs:[
{'lc':'lat', 'label':'lat', 'db':'0-LAT-ethicadb.json'},
{'lc':'fr', 'label':'fr', 'db':'2-Appuhn-FR-ethicadb.json'},
{'lc':'bra', 'label':'bra', 'db':'ethica-bresilen.json'}
{'lc':'bra', 'label':'bra', 'db':'ethica-bresilen.json'},
{'lc':'en', 'label':'en', 'db':'3-Elwes-EN-ethicadb.json'}
],
data:[],
loaded_dbs:0,
@@ -48,7 +50,7 @@ module.exports = {
xobj.send(null);
},
onJSONLoaded: function(lc, json, callback){
console.log('onDBLoaded');
console.log('onDBLoaded '+lc);
this.data[lc] = JSON.parse(json);
this.loaded_dbs ++;
//
@@ -82,6 +84,9 @@ module.exports = {
for (id in this.data_byid[this.langs[0].lc]) {
item = this.data_byid[this.langs[0].lc][id];
// console.log(item);
// skeep titles as they don't have structure data
if(item.type == "title") continue;
obj = {
'to':[],
'from':[],
+20 -7
View File
@@ -269,19 +269,32 @@ var _Part = {
m("h1", {'class':'part'}, m.trust(markdown.renderInline(this.title))),
// create text node
this.enonces.map(function(e){
// console.log(e.text);
return m(_Enonce, Object.assign({"partid":this.id},e))
console.log(e.type);
switch (e.type) {
case "title":
// handle titles
return m("h2", {'class':'title'}, m.trust(markdown.renderInline(e.title)));
break;
case "filet":
// handle filets
return m("h4", {'class':'filet'}, m.trust(markdown.renderInline(e.title)));
break;
default:
// or build structure
return m(_Enonce, Object.assign({"partid":this.id},e));
}
})
]
)
}
}
// ______
// /_ __/_______ ___
// / / / ___/ _ \/ _ \
// / / / / / __/ __/
// /_/ /_/ \___/\___/
// ____ __ _
// / _/___ / / (_)___ ___
// / // __ \/ / / / __ \/ _ \
// _/ // / / / /___/ / / / / __/
// /___/_/ /_/_____/_/_/ /_/\___/
module.exports = {
view: function(){
console.log('_Inline view', _dbs.lang);
+19 -6
View File
@@ -302,7 +302,20 @@ var _Part = {
// create text node
this.enonces.map(function(e){
// console.log(e.text);
return m(_Enonce, Object.assign({"partid":this.id},e))
// return m(_Enonce, Object.assign({"partid":this.id},e))
switch (e.type) {
case "title":
// handle titles
return m("h2", {'class':'title'}, m.trust(markdown.renderInline(e.title)));
break;
case "filet":
// handle filets
return m("h4", {'class':'filet'}, m.trust(markdown.renderInline(e.title)));
break;
default:
// or build structure
return m(_Enonce, Object.assign({"partid":this.id},e));
}
})
]
)
@@ -310,11 +323,11 @@ var _Part = {
}
// ____ __
// / __ \____ / /______
// / / / / __ \/ __/ ___/
// / /_/ / /_/ / /_(__ )
// /_____/\____/\__/____/
// ______
// /_ __/_______ ___
// / / / ___/ _ \/ _ \
// / / / / / __/ __/
// /_/ /_/ \___/\___/
module.exports = {
view: function(){
// console.log('_Tree view', _dbs.lang);