Skip to content

Commit

Permalink
add td to columns
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon Arnold committed Jan 5, 2016
1 parent ed05eb8 commit 36d4c81
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ Inky.prototype = {
},

// Description:
// Awww yiss. Kickstarts the whole parser. Takes in HTML loaded via Cheerio as an argument,
// checks if there are any custom components. If there are, it replaces the nested components,
// Awww yiss. Kickstarts the whole parser. Takes in HTML loaded via Cheerio as an argument,
// checks if there are any custom components. If there are, it replaces the nested components,
// traverses the DOM and replaces them with email markup.
//
// Arguments:
Expand Down Expand Up @@ -91,7 +91,7 @@ Inky.prototype = {
setTagArray: function() {
var arr = [];
var self = this;

for (val in self.zfTags) {
arr.push(self.zfTags[val]);
}
Expand Down Expand Up @@ -123,7 +123,7 @@ Inky.prototype = {
},

// Description:
// Checks if an element is an element with a td included. Currently it's a manual check.
// Checks if an element is an element with a td included. Currently it's a manual check.
// Array was populated from the markup from the component factory.
//
// Arguments:
Expand Down Expand Up @@ -313,7 +313,7 @@ Inky.prototype = {
$(moreNested).each(function(idx, el) {
// call a recursion to replace all nested elements
self.scaffoldElements($, $(el));
});
});

},

Expand Down Expand Up @@ -361,7 +361,7 @@ Inky.prototype = {
switch (type) {
case self.zfTags.callout:
if (component.parent() && self.isTdElement(component.parent()[0].name)) {
output = '<table><tbody><tr><td class="callout ' + compAttr +'">' + inner + '</td></tr></tbody></table>';
output = '<table><tbody><tr><td class="callout ' + compAttr +'">' + inner + '</td></tr></tbody></table>';
}
else {
output = '<td class="callout ' + compAttr +'">' + inner + '</td>';
Expand All @@ -371,10 +371,10 @@ Inky.prototype = {
case self.zfTags.button:
// if parent is a callout, you don't need the tds
if (component.parent() && self.isTdElement(component.parent()[0].name)) {
output = '<table class="button ' + compAttr +'"><tbody><tr><td>' + inner + '</td></tr></tbody></table>';
output = '<table class="button ' + compAttr +'"><tbody><tr><td>' + inner + '</td></tr></tbody></table>';
}
else {
output = '<td><table class="button ' + compAttr +'"><tbody><tr><td>' + inner + '</td></tr></tbody></table></td>';
output = '<td><table class="button ' + compAttr +'"><tbody><tr><td>' + inner + '</td></tr></tbody></table></td>';
}
break;

Expand All @@ -389,7 +389,7 @@ Inky.prototype = {
case self.zfTags.columns:
output = self.makeCols($, component, 'columns');
break;

case self.zfTags.row:
output = '<table class="row ' + compAttr + '"><tbody><tr>'+ inner + '</tr></tbody></table>';
break;
Expand All @@ -408,7 +408,7 @@ Inky.prototype = {

output = '<tr><td><img src="https://raw.githubusercontent.com/arvida/emoji-cheat-sheet.com/master/public/graphics/emojis/octopus.png" /></tr></td>';
break;
default:
default:
// unless it's a special element, just grab the inside
// another cheerio quirk
inner = $.html(element);
Expand All @@ -420,7 +420,7 @@ Inky.prototype = {
},

// Description:
// Returns output for inline list elements.
// Returns output for inline list elements.
//
// Arguments:
// $ (obj), col (obj), orientation (str): cheerio, the list, whether vertical/horizontal list
Expand Down Expand Up @@ -494,8 +494,8 @@ Inky.prototype = {

} else {
output = '<td class="wrapper ' + colClass + '">';
}
output += '<table class="' + colSize + 'columns">';
}
output += '<table class="' + colSize + 'columns"><td>';

// if the nested component is an element, find the children
// NOTE: this is to avoid a cheerio quirk where it will still pass
Expand All @@ -516,7 +516,7 @@ Inky.prototype = {
}
});

output += '</table></td>';
output += '</td></table></td>';

}
else if (type === 'subcolumns') {
Expand All @@ -527,7 +527,7 @@ Inky.prototype = {
}
else {
output = '<td class="sub-columns' + colClass + ' ' + colSize +'">' + inner + '</td>';
}
}
}
else {
return;
Expand All @@ -552,4 +552,4 @@ Inky.prototype = {
},
};

module.exports = new Inky();
module.exports = new Inky();

0 comments on commit 36d4c81

Please sign in to comment.