fixed summary, fix dot dot title on filtred, fixed breadcrumb translation

This commit is contained in:
2018-11-03 17:31:47 +01:00
parent 4a3e6f2379
commit def5176164
13 changed files with 292 additions and 338 deletions
+9 -3
View File
@@ -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)))