TapConsumer.prototype._parseIndented = function () { // pull yamlish block out var ind = this._indent , ys , ye , yind , diag //console.error(ind, this._indent) for (var i = 0, l = ind.length; i < l; i ++) { var line = ind[i] , lt = line.trim() if (!ys) { ys = line.match(/^(\s*)---(.*)$/) if (ys) { yind = ys[1] diag = [ys[2]] //console.error([line,ys, diag]) continue } else if (lt) this.emit("data", lt) } else if (ys && !ye) { if (line === yind + "...") ye = true else { diag.push(line.substr(yind.length)) } } else if (ys && ye && lt) this.emit("data", lt) } if (diag) { //console.error('about to parse', diag) diag = yamlish.decode(diag.join("\n")) //console.error('parsed', diag) Object.keys(diag).forEach(function (k) { //console.error(this._current, k) if (!this._current.hasOwnProperty(k)) this._current[k] = diag[k] }, this) } }
console.log(err); } var lyrics; var song_to_lyric_dict; try { // Preload lyrics. var lyricdata = (fs.readFileSync(LYRIC_FILE) .toString("utf-8") .trim() .split('\n') .map(function(x){return x.replace(/ *\#.*$/g,"");}) .filter(function(x){return x.trim().length;}) .join("\n")); var lyricdatadict = yaml.decode(lyricdata); lyrics = []; song_to_lyric_dict = {}; // Maps lyrics to song names // Add lyrics to the lyric list. for (var songname in lyricdatadict) { if (lyricdatadict.hasOwnProperty(songname)) { var lyriclines = (lyricdatadict[songname] .split("\n") .map(function(l){return l.trim();}) .filter(function(x){return x.length;})); // Add each of these lyric lines to the lyrics for (var i = 0,l=lyriclines.length; i<l; i++) { lyrics.push(lyriclines[i]); song_to_lyric_dict[lyriclines[i]] = songname; }