Fix parsing of identify #74

Open
wants to merge 1 commit into
from
+9 −7
Split
View
@@ -104,7 +104,7 @@ function parseIdentify(input) {
props = [prop],
prevIndent = 0,
indents = [indent],
- currentLine, comps, indent, i;
+ currentLine, comps, indent, i, propName;
lines.shift(); //drop first line (Image: name.jpg)
@@ -113,15 +113,17 @@ function parseIdentify(input) {
indent = currentLine.search(/\S/);
if (indent >= 0) {
comps = currentLine.split(': ');
- if (indent > prevIndent) indents.push(indent);
- while (indent < prevIndent && props.length) {
- indents.pop();
- prop = props.pop();
- prevIndent = indents[indents.length - 1];
+ if(propName != 'histogram') {
+ if (indent > prevIndent) indents.push(indent);
+ while (indent < prevIndent && props.length) {
+ indents.pop();
+ prop = props.pop();
+ prevIndent = indents[indents.length - 1];
+ }
}
if (comps.length < 2) {
props.push(prop);
- prop = prop[currentLine.split(':')[0].trim().toLowerCase()] = {};
+ prop = prop[propName = currentLine.split(':')[0].trim().toLowerCase()] = {};
} else {
prop[comps[0].trim().toLowerCase()] = comps[1].trim()
}