Skip to content

Commit

Permalink
Merge pull request #242 from Gizra/237
Browse files Browse the repository at this point in the history
Improve parsing of brother name.
  • Loading branch information
Carlos Mantilla committed Feb 27, 2014
2 parents cc42995 + 5be9edc commit 49506a8
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions Gruntfile.js
Expand Up @@ -905,12 +905,24 @@ module.exports = function (grunt) {
if (child.node.type !== 'chronological' && !child.node.hasChronologicalChildren) { if (child.node.type !== 'chronological' && !child.node.hasChronologicalChildren) {
child.node.brothers = _.filter(setSiblingsInfo(childs), function(brother) { child.node.brothers = _.filter(setSiblingsInfo(childs), function(brother) {
// Clean the name property. // Clean the name property.
var label; var label = undefined;


brother._name = brother.name; brother._name = brother.name;
brother.name = he.decode(brother.name); brother.name = he.decode(brother.name);


brother.name = (label = brother.name.match(/[:\d+:|:_:]+ (.*)/)) ? label.pop() : brother.name; brother.result = brother.name.match(/^:\d+: (.*)|^:_: (.*)/);
if (brother.result) {
brother._result = [];
brother.result.forEach(function(item) {
if (typeof item !== 'undefined') {
brother._result.push(item);
}
});
brother._result = new Array(brother._result);
label = brother._result.pop();
}

brother.name = (label) ? label.pop() : brother.name;


return brother.guid !== child.node.guid && !brother._name.match(/:\d+:/); return brother.guid !== child.node.guid && !brother._name.match(/:\d+:/);
}); });
Expand Down

0 comments on commit 49506a8

Please sign in to comment.