moving processing of single line into separate function

master
Matt Huntington 10 years ago
parent 3925b51093
commit 4270a91c3c

@ -40,11 +40,7 @@ module.exports = function(input){
previous_line_num_tabs = current_line_num_tabs; previous_line_num_tabs = current_line_num_tabs;
} }
var parseFile = function(data){ var processSingleLine = function(i){
lines = data.split('\n');
for(var i = 0; i < lines.length; i++){
if(lines[i] !== ''){
if(lines[ i + 1 ] === '' && (i === 0 || lines[ i - 1 ] === '')){
html += popHTMLStack(-1, previous_line_num_tabs); html += popHTMLStack(-1, previous_line_num_tabs);
previous_line_num_tabs = -1; previous_line_num_tabs = -1;
if(lines[i].indexOf('.') > 0){ if(lines[i].indexOf('.') > 0){
@ -54,6 +50,14 @@ module.exports = function(input){
} else { } else {
html += '<h1>' + lines[i] + '</h1>\n'; html += '<h1>' + lines[i] + '</h1>\n';
} }
}
var parseFile = function(data){
lines = data.split('\n');
for(var i = 0; i < lines.length; i++){
if(lines[i] !== ''){
if(lines[ i + 1 ] === '' && (i === 0 || lines[ i - 1 ] === '')){
processSingleLine(i);
} else { } else {
processList(i); processList(i);
} }

Loading…
Cancel
Save