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:{}, 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)?$/, 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:[ id_strct:[
'Partie', {full:'Partie',dim:'Part.'},
{ {
'prop':'Proposition', // \d\d 'prop':{full:'Proposition', dim:'Prop.'}, // \d\d
'app' :'Appendice', 'app' :{full:'Appendice', dim:'App.'},
'agd' :'Definition generale des affections', 'agd' :{full:'Definition generale des affections'},
'pr' :'Preface', 'pr' :{full:'Preface', dim:'Pref.'},
'ad' :'Definiton des affections', 'ad' :{full:'Definiton des affections'},
'ap' :'Appendice', 'ap' :{full:'Appendice', dim:'App.'},
'c' :'Corollaire', 'c' :{full:'Corollaire', dim:'Cor.'},
'p' :'Postulat', 'p' :{full:'Postulat', dim:'Post.'},
'd' :'Definition', 'd' :{full:'Definition', dim:'Def.'},
'a' :'Axiome', 'a' :{full:'Axiome', dim:'Ax.'},
}, },
{ {
// \d\d // \d\d
// \d // \d
'cd' :'Corollaire Demonstration', 'cd' :{full:'Corollaire Demonstration'},
'sc' :'Scolie', 'sc' :{full:'Scolie', dim:'Scol.'},
'd' :'Demonstration', 'd' :{full:'Demonstration', dim:'Demo.'},
'c' :'Corollaire', 'c' :{full:'Corollaire', dim:'Cor.'},
'a' :'Axiome', 'a' :{full:'Axiome', dim:'Ax.'},
'l' :'Lemme', 'l' :{full:'Lemme', dim:'Lem.'},
'p' :'Postulat', 'p' :{full:'Postulat', dim:'Post.'},
'e' :{full:'Explication', dim:'Exp.'},
}, },
{ {
// \d // \d
'e':'Explication', 'e' :{full:'Explication', dim:'Exp.'},
'sc':'Scolie', 'sc' :{full:'Scolie', dim:'Scol.'},
'c' :{full:'Corollaire', dim:'Cor.'},
}, },
{ {
'd':'Demonstration', 'd' :{full:'Demonstration', dim:'Demo.'},
'c':'Corollaire', 'c' :{full:'Corollaire', dim:'Cor.'},
'a':'Axiome', 'a' :{full:'Axiome', dim:'Ax.'},
'sc':'Scolie', '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)?$/ // /^(\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 breadcrumb = ""
var m = id.match(this.rx_id); var m = id.match(this.rx_id);
var mode = 'full';
if(m){ if(m){
m.shift(); m.shift();
// console.log("id", m); // removing undefined
for (let i = 0; i < m.length; i++) { // we loop through match result variables m_clean = [];
// console.log('m[i]', m[i]); 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 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{ }else{
if(typeof m[i] !== 'undefined'){ // display mode
if(isNaN(m[i])){ // if not a number we get the label mode = i !== m_clean.length-1 ? 'dim' : 'full';
breadcrumb += ` ${this.id_strct[i][m[i]]}` if(isNaN(m_clean[i])){ // if not a number we get the label
}else{ // if its a number breadcrumb += ` ${this.id_strct[i][m_clean[i]][mode]}`
if(i == 1){ // we just add the number to the breadcrumb preceded by 'Proposition' }else{ // if its a number
breadcrumb += ` ${this.id_strct[i]['prop']} ${m[i]}` if(i == 1){ // we just add the number to the breadcrumb preceded by 'Proposition'
}else{ // we just add the number to the breadcrumb breadcrumb += ` ${this.id_strct[i]['prop'][mode]} ${m_clean[i]}`
breadcrumb += ` ${m[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
} }
} }
} }