// https://github.com/mjmlio/mjml/blob/master/packages/mjml-section/src/index.js#L221 /// <summary> /// RenderWrappedChildren /// </summary> /// <returns></returns> public override string RenderChildren() { if (!this.Children.Any()) { return(string.Empty); } StringBuilder sb = new StringBuilder(); sb.Append(@" <!--[if mso | IE]> <tr> <![endif]-->"); foreach (var childComponent in Children) { string childContent = childComponent.RenderMjml(); if (string.IsNullOrWhiteSpace(childContent)) { continue; } if (childComponent.IsRawElement()) { sb.Append(childContent); } else { sb.Append($@" <!--[if mso | IE]> <td {HtmlAttributes(new Dictionary<string, string> { {"align", GetAttribute("align") }, {"class", CssHelper.SuffixCssClasses(GetAttribute("css-class"), "outlook") }, {"style", (childComponent as BodyComponent).Styles("tdOutlook") } })} > <![endif]--> "); sb.Append(childContent); sb.Append($@" <!--[if mso | IE]> </td> <![endif]--> "); } } sb.Append($@" <!--[if mso | IE]> </tr> <![endif]--> "); return(sb.ToString()); }
public override string RenderMjml() { return($@" {TagHelpers.ConditionalTag($@" <td {HtmlAttributes(new Dictionary<string, string> { { "style", "td" }, { "class", CssHelper.SuffixCssClasses(GetAttribute("css-class"), "outlook") } })}> ")} {RenderContent()} {TagHelpers.ConditionalTag($@" </td> ")} "); }
public string RenderBefore() { return($@" <!--[if mso | IE]> <table {HtmlAttributes(new Dictionary<string, string> { {"align", "center" }, {"border", "0" }, {"cellpadding", "0" }, {"cellspacing", "0" }, {"class", CssHelper.SuffixCssClasses(GetAttribute("css-class"), "outlook") }, {"style", InlineCss( new Dictionary<string, string> { { "width", $"{GetContainerOuterWidth()}px" } }) }, {"width", $"{GetContainerOuterWidth()}" } })} > <tr> <td style=""line-height:0px;font-size:0px;mso-line-height-rule:exactly;""> <![endif]--> "); }