fixed summary, fix dot dot title on filtred, fixed breadcrumb translation
This commit is contained in:
@@ -51,7 +51,10 @@ var _Dot = {
|
||||
// remove img
|
||||
this.summary = this.text.replace(/!\[[^\]]+\]\([^\)]+\)/g, "");
|
||||
// get portion of text
|
||||
this.summary = this.summary.match('([^ ]*[ ]{0,1}){1,6}')[0];
|
||||
// this.summary = this.summary.match('([^ ]*[ ]{0,1}){1,6}')[0];
|
||||
// https://stackoverflow.com/questions/5454235/shorten-string-without-cutting-words-in-javascript
|
||||
// this.summary = this.summary.replace(/^(.{18}[^\s]*).*/, "$1");
|
||||
this.summary = this.summary.substr(0, this.summary.lastIndexOf(' ', 30));
|
||||
// end underscores (italic) splited by summarizing
|
||||
this.summary = this.summary.trim().replace(/_([^_]+)$/g, "_$1_");
|
||||
// remove brackets (links) splited by summarizing
|
||||
@@ -161,7 +164,7 @@ var _Dot = {
|
||||
}//, m('span') // , m.trust("🗙")
|
||||
),
|
||||
// Title
|
||||
m('span', {'class':'title'}, m.trust(this.nested ? this.breadcrumb : this.title)),
|
||||
m('span', {'class':'title'}, m.trust(this.nested || _dbs.active_type_filter ? this.breadcrumb : this.title)),
|
||||
// full text
|
||||
m('section', {
|
||||
'class':'text',
|
||||
@@ -207,7 +210,7 @@ var _Dot = {
|
||||
onclick(e){
|
||||
if(!vn.state.opened) vn.state.opened = 1;
|
||||
}
|
||||
}, m.trust(this.nested ? this.breadcrumb : this.title)),
|
||||
}, m.trust(this.nested || _dbs.active_type_filter ? this.breadcrumb : this.title)),
|
||||
m('p', {
|
||||
'class':'summary',
|
||||
onclick(e){
|
||||
@@ -315,6 +318,9 @@ var _Part = {
|
||||
e.lang = vn.attrs.lang;
|
||||
switch (e.type) {
|
||||
case "title":
|
||||
// if(_dbs.active_type_filter){
|
||||
// console.log('filter:', _dbs.active_type_filter, 'title:',e.title);
|
||||
// }
|
||||
// handle titles
|
||||
return !_dbs.active_type_filter
|
||||
? m("h2", {'class':'title'}, m.trust(markdown.renderInline(e.title)))
|
||||
|
||||
+34
-30
@@ -5,6 +5,7 @@
|
||||
// / (__ ) /_/ / / / /
|
||||
// __/ /____/\____/_/ /_/
|
||||
// /___/
|
||||
var _i18n = require('./i18n');
|
||||
|
||||
module.exports = {
|
||||
langs:[
|
||||
@@ -38,42 +39,42 @@ module.exports = {
|
||||
data_strct:{},
|
||||
rx_id:/^(\d)(app|agd|\d\d|pr|ad|ap|c|p|d|a)(cd|sc|\d\d|d|c|a|l|p|\d)?(e|\d|sc)?(d|c|a|sc)?$/,
|
||||
id_strct:[
|
||||
{full:'Partie',dim:'Part.'},
|
||||
{full:'partie',dim:'part.'},
|
||||
{
|
||||
'prop':{full:'Proposition', dim:'Prop.'}, // \d\d
|
||||
'app' :{full:'Appendice', dim:'App.'},
|
||||
'agd' :{full:'Definition generale des affections'},
|
||||
'pr' :{full:'Preface', dim:'Pref.'},
|
||||
'ad' :{full:'Definiton des affections'},
|
||||
'ap' :{full:'Appendice', dim:'App.'},
|
||||
'c' :{full:'Corollaire', dim:'Cor.'},
|
||||
'p' :{full:'Postulat', dim:'Post.'},
|
||||
'd' :{full:'Definition', dim:'Def.'},
|
||||
'a' :{full:'Axiome', dim:'Ax.'},
|
||||
'prop':{full:'proposition', dim:'prop.'}, // \d\d
|
||||
'app' :{full:'appendice', dim:'app.'},
|
||||
'agd' :{full:'def-gen-affect'},
|
||||
'pr' :{full:'preface', dim:'pref.'},
|
||||
'ad' :{full:'def-affect'},
|
||||
'ap' :{full:'appendice', dim:'app.'},
|
||||
'c' :{full:'corollaire', dim:'cor.'},
|
||||
'p' :{full:'postulat', dim:'post.'},
|
||||
'd' :{full:'definition', dim:'def.'},
|
||||
'a' :{full:'axiom', dim:'ax.'},
|
||||
},
|
||||
{
|
||||
// \d\d
|
||||
// \d
|
||||
'cd' :{full:'Corollaire Demonstration'},
|
||||
'sc' :{full:'Scolie', dim:'Scol.'},
|
||||
'd' :{full:'Demonstration', dim:'Demo.'},
|
||||
'c' :{full:'Corollaire', dim:'Cor.'},
|
||||
'a' :{full:'Axiome', dim:'Ax.'},
|
||||
'l' :{full:'Lemme', dim:'Lem.'},
|
||||
'p' :{full:'Postulat', dim:'Post.'},
|
||||
'e' :{full:'Explication', dim:'Exp.'},
|
||||
'cd' :{full:'corollaire-demo'},
|
||||
'sc' :{full:'scolie', dim:'scol.'},
|
||||
'd' :{full:'demonstration', dim:'demo.'},
|
||||
'c' :{full:'corollaire', dim:'cor.'},
|
||||
'a' :{full:'axiom', dim:'ax.'},
|
||||
'l' :{full:'lemme', dim:'lem.'},
|
||||
'p' :{full:'postulat', dim:'post.'},
|
||||
'e' :{full:'explication', dim:'exp.'},
|
||||
},
|
||||
{
|
||||
// \d
|
||||
'e' :{full:'Explication', dim:'Exp.'},
|
||||
'sc' :{full:'Scolie', dim:'Scol.'},
|
||||
'c' :{full:'Corollaire', dim:'Cor.'},
|
||||
'e' :{full:'explication', dim:'exp.'},
|
||||
'sc' :{full:'scolie', dim:'scol.'},
|
||||
'c' :{full:'corollaire', dim:'cor.'},
|
||||
},
|
||||
{
|
||||
'd' :{full:'Demonstration', dim:'Demo.'},
|
||||
'c' :{full:'Corollaire', dim:'Cor.'},
|
||||
'a' :{full:'Axiome', dim:'Ax.'},
|
||||
'sc' :{full:'Scolie', dim:'Scol.'},
|
||||
'd' :{full:'demonstration', dim:'demo.'},
|
||||
'c' :{full:'corollaire', dim:'cor.'},
|
||||
'a' :{full:'axiom', dim:'ax.'},
|
||||
'sc' :{full:'scolie', dim:'scol.'},
|
||||
}
|
||||
],
|
||||
// loading progress
|
||||
@@ -154,6 +155,8 @@ module.exports = {
|
||||
this.data_byid[l] = {};
|
||||
this.data_bytype[l] = {};
|
||||
this.types[l] = [];
|
||||
_i18n.setLang(l);
|
||||
|
||||
// loop through parts
|
||||
for (let p in this.data[l]) {
|
||||
if(this.data[l][p].type !== "intro"){
|
||||
@@ -249,13 +252,14 @@ module.exports = {
|
||||
breadcrumb_array.unshift(`${this.id_strct[i]['dim']} ${m_clean[i]}`);
|
||||
}else{
|
||||
// display mode
|
||||
mode = i !== m_clean.length-1 ? 'dim' : 'full';
|
||||
if(isNaN(m_clean[i])){ // if not a number we get the label
|
||||
breadcrumb_array.unshift(`${this.id_strct[i][m_clean[i]][mode]}`);
|
||||
// mode = i !== m_clean.length-1 ? 'dim' : 'full';
|
||||
mode = 'full';
|
||||
if(typeof m_clean[i] !== 'undefined' && isNaN(m_clean[i])){ // if not a number we get the label
|
||||
breadcrumb_array.unshift(_i18n.t(`${this.id_strct[i][m_clean[i]][mode]}`));
|
||||
// breadcrumb_array.splice(1, 0, `${m_clean[i]}`);
|
||||
}else{ // if its a number
|
||||
if(i == 1){ // we just add the number to the breadcrumb preceded by 'Proposition'
|
||||
breadcrumb_array.unshift(`${this.id_strct[i]['prop'][mode]} ${m_clean[i]}`);
|
||||
breadcrumb_array.unshift(_i18n.t(`${this.id_strct[i]['prop'][mode]}`) + ` ${m_clean[i]}`);
|
||||
}else{ // we just add the number to the breadcrumb behind the last added item
|
||||
// breadcrumb_array.unshift(`${m_clean[i]}`);
|
||||
// debugger;
|
||||
|
||||
@@ -63,6 +63,12 @@ module.exports = {
|
||||
'bra':'definições',
|
||||
'lat':'definitione'
|
||||
},
|
||||
'def.':{
|
||||
'en':'def.',
|
||||
'fr':'def.',
|
||||
'bra':'def.',
|
||||
'lat':'def.'
|
||||
},
|
||||
'explication':{
|
||||
'en':'explanation',
|
||||
'fr':'explication',
|
||||
@@ -75,24 +81,48 @@ module.exports = {
|
||||
'bra':'axioma',
|
||||
'lat':'axiomata'
|
||||
},
|
||||
'ax.':{
|
||||
'en':'ax.',
|
||||
'fr':'ax.',
|
||||
'bra':'ax.',
|
||||
'lat':'ax.'
|
||||
},
|
||||
'proposition':{
|
||||
'en':'proposition',
|
||||
'fr':'proposition',
|
||||
'bra':'proposiçaõ',
|
||||
'lat':'propositio'
|
||||
},
|
||||
'prop.':{
|
||||
'en':'prop.',
|
||||
'fr':'prop.',
|
||||
'bra':'prop.',
|
||||
'lat':'prop.'
|
||||
},
|
||||
'demonstration':{
|
||||
'en':'demonstration',
|
||||
'fr':'demonstration',
|
||||
'bra':'demonstraçaõ',
|
||||
'lat':'demonstratio'
|
||||
},
|
||||
'demo.':{
|
||||
'en':'demo.',
|
||||
'fr':'demo.',
|
||||
'bra':'demo.',
|
||||
'lat':'demo.'
|
||||
},
|
||||
'corollaire':{
|
||||
'en':'corollary',
|
||||
'fr':'corollaire',
|
||||
'bra':'corolário',
|
||||
'lat':'corollarium'
|
||||
},
|
||||
'cor.':{
|
||||
'en':'cor.',
|
||||
'fr':'cor.',
|
||||
'bra':'cor.',
|
||||
'lat':'cor.'
|
||||
},
|
||||
'prop-axiom':{
|
||||
'en':'prop-axiom',
|
||||
'fr':'prop-axiom',
|
||||
@@ -105,6 +135,12 @@ module.exports = {
|
||||
'bra':'escólio',
|
||||
'lat':'scholium'
|
||||
},
|
||||
'scol.':{
|
||||
'en':'schol.',
|
||||
'fr':'scol.',
|
||||
'bra':'escól.',
|
||||
'lat':'schol.'
|
||||
},
|
||||
'appendice':{
|
||||
'en':'appendix',
|
||||
'fr':'appendice',
|
||||
@@ -129,6 +165,12 @@ module.exports = {
|
||||
'bra':'lema',
|
||||
'lat':'lemma'
|
||||
},
|
||||
'lem.':{
|
||||
'en':'lem.',
|
||||
'fr':'lem.',
|
||||
'bra':'lem.',
|
||||
'lat':'lem.'
|
||||
},
|
||||
'lemme-demonstration':{
|
||||
'en':'lemma-demo',
|
||||
'fr':'lemme-demo',
|
||||
@@ -153,6 +195,12 @@ module.exports = {
|
||||
'bra':'postulado',
|
||||
'lat':'postulata'
|
||||
},
|
||||
'post.':{
|
||||
'en':'post.',
|
||||
'fr':'post.',
|
||||
'bra':'post.',
|
||||
'lat':'post.'
|
||||
},
|
||||
'def-affect':{
|
||||
'en':'definitions of the emotions',
|
||||
'fr':'définitions des affections',
|
||||
|
||||
Reference in New Issue
Block a user