changed connections labels : reverse mode with diminutifs

This commit is contained in:
2018-05-15 16:25:34 +02:00
parent 3d376ffc95
commit 98024437fa
3 changed files with 50 additions and 41 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+48 -39
View File
@@ -36,40 +36,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:[
'Partie',
{full:'Partie',dim:'Part.'},
{
'prop':'Proposition', // \d\d
'app' :'Appendice',
'agd' :'Definition generale des affections',
'pr' :'Preface',
'ad' :'Definiton des affections',
'ap' :'Appendice',
'c' :'Corollaire',
'p' :'Postulat',
'd' :'Definition',
'a' :'Axiome',
'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.'},
},
{
// \d\d
// \d
'cd' :'Corollaire Demonstration',
'sc' :'Scolie',
'd' :'Demonstration',
'c' :'Corollaire',
'a' :'Axiome',
'l' :'Lemme',
'p' :'Postulat',
'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.'},
},
{
// \d
'e':'Explication',
'sc':'Scolie',
'e' :{full:'Explication', dim:'Exp.'},
'sc' :{full:'Scolie', dim:'Scol.'},
'c' :{full:'Corollaire', dim:'Cor.'},
},
{
'd':'Demonstration',
'c':'Corollaire',
'a':'Axiome',
'sc':'Scolie',
'd' :{full:'Demonstration', dim:'Demo.'},
'c' :{full:'Corollaire', dim:'Cor.'},
'a' :{full:'Axiome', dim:'Ax.'},
'sc' :{full:'Scolie', dim:'Scol.'},
}
],
@@ -161,26 +163,33 @@ module.exports = {
// /^(\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)?$/
var breadcrumb = ""
var m = id.match(this.rx_id);
var mode = 'full';
if(m){
m.shift();
// console.log("id", m);
for (let i = 0; i < m.length; i++) { // we loop through match result variables
// console.log('m[i]', m[i]);
// removing undefined
m_clean = [];
for (let i = 0; i < m.length; i++) {
if(typeof m[i] !== 'undefined'){
m_clean.push(m[i]);
}
}
// console.log('m_clean', m_clean);
for (let i = m_clean.length-1; i >= 0; i--) { // we loop through match result variables
// console.log('m_clean['+i+']', m_clean[i]);
if(i == 0){ // first digit is part number
breadcrumb += `${this.id_strct[i]} ${m[i]}`
breadcrumb += ` ${this.id_strct[i]['dim']} ${m_clean[i]}`
}else{
if(typeof m[i] !== 'undefined'){
if(isNaN(m[i])){ // if not a number we get the label
breadcrumb += ` ${this.id_strct[i][m[i]]}`
}else{ // if its a number
if(i == 1){ // we just add the number to the breadcrumb preceded by 'Proposition'
breadcrumb += ` ${this.id_strct[i]['prop']} ${m[i]}`
}else{ // we just add the number to the breadcrumb
breadcrumb += ` ${m[i]}`
}
// display mode
mode = i !== m_clean.length-1 ? 'dim' : 'full';
if(isNaN(m_clean[i])){ // if not a number we get the label
breadcrumb += ` ${this.id_strct[i][m_clean[i]][mode]}`
}else{ // if its a number
if(i == 1){ // we just add the number to the breadcrumb preceded by 'Proposition'
breadcrumb += ` ${this.id_strct[i]['prop'][mode]} ${m_clean[i]}`
}else{ // we just add the number to the breadcrumb
breadcrumb += ` ${m_clean[i]}`
}
}else{ // if variable is not defined we are at the end of the id
break
}
}
}