Skip to content

Commit

Permalink
Merge pull request #198 from CaptainStack/master
Browse files Browse the repository at this point in the history
Add optional custom markupformatter parameter
  • Loading branch information
martinnormark committed Apr 8, 2020
2 parents 89510bf + 9ac3fc6 commit 1f5eab1
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions PreMailer.Net/PreMailer.Net/PreMailer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ public PreMailer(Stream stream, Uri baseUri = null)
/// <param name="stripIdAndClassAttributes">True to strip ID and class attributes</param>
/// <param name="removeComments">True to remove comments, false to leave them intact</param>
/// <returns>Returns the html input, with styles moved to inline attributes.</returns>
public static InlineResult MoveCssInline(string html, bool removeStyleElements = false, string ignoreElements = null, string css = null, bool stripIdAndClassAttributes = false, bool removeComments = false)
public static InlineResult MoveCssInline(string html, bool removeStyleElements = false, string ignoreElements = null, string css = null, bool stripIdAndClassAttributes = false, bool removeComments = false, IMarkupFormatter customFormatter = null)
{
return new PreMailer(html).MoveCssInline(removeStyleElements, ignoreElements, css, stripIdAndClassAttributes, removeComments);
return new PreMailer(html).MoveCssInline(removeStyleElements, ignoreElements, css, stripIdAndClassAttributes, removeComments, customFormatter);
}

/// <summary>
Expand All @@ -89,9 +89,9 @@ public static InlineResult MoveCssInline(string html, bool removeStyleElements =
/// <param name="stripIdAndClassAttributes">True to strip ID and class attributes</param>
/// <param name="removeComments">True to remove comments, false to leave them intact</param>
/// <returns>Returns the html input, with styles moved to inline attributes.</returns>
public static InlineResult MoveCssInline(Stream stream, bool removeStyleElements = false, string ignoreElements = null, string css = null, bool stripIdAndClassAttributes = false, bool removeComments = false)
public static InlineResult MoveCssInline(Stream stream, bool removeStyleElements = false, string ignoreElements = null, string css = null, bool stripIdAndClassAttributes = false, bool removeComments = false, IMarkupFormatter customFormatter = null)
{
return new PreMailer(stream).MoveCssInline(removeStyleElements, ignoreElements, css, stripIdAndClassAttributes, removeComments);
return new PreMailer(stream).MoveCssInline(removeStyleElements, ignoreElements, css, stripIdAndClassAttributes, removeComments, customFormatter);
}

/// <summary>
Expand All @@ -106,9 +106,9 @@ public static InlineResult MoveCssInline(Stream stream, bool removeStyleElements
/// <param name="stripIdAndClassAttributes">True to strip ID and class attributes</param>
/// <param name="removeComments">True to remove comments, false to leave them intact</param>
/// <returns>Returns the html input, with styles moved to inline attributes.</returns>
public static InlineResult MoveCssInline(Uri baseUri, string html, bool removeStyleElements = false, string ignoreElements = null, string css = null, bool stripIdAndClassAttributes = false, bool removeComments = false)
public static InlineResult MoveCssInline(Uri baseUri, string html, bool removeStyleElements = false, string ignoreElements = null, string css = null, bool stripIdAndClassAttributes = false, bool removeComments = false, IMarkupFormatter customFormatter = null)
{
return new PreMailer(html, baseUri).MoveCssInline(removeStyleElements, ignoreElements, css, stripIdAndClassAttributes, removeComments);
return new PreMailer(html, baseUri).MoveCssInline(removeStyleElements, ignoreElements, css, stripIdAndClassAttributes, removeComments, customFormatter);
}

/// <summary>
Expand All @@ -123,9 +123,9 @@ public static InlineResult MoveCssInline(Uri baseUri, string html, bool removeSt
/// <param name="stripIdAndClassAttributes">True to strip ID and class attributes</param>
/// <param name="removeComments">True to remove comments, false to leave them intact</param>
/// <returns>Returns the html input, with styles moved to inline attributes.</returns>
public static InlineResult MoveCssInline(Uri baseUri, Stream stream, bool removeStyleElements = false, string ignoreElements = null, string css = null, bool stripIdAndClassAttributes = false, bool removeComments = false)
public static InlineResult MoveCssInline(Uri baseUri, Stream stream, bool removeStyleElements = false, string ignoreElements = null, string css = null, bool stripIdAndClassAttributes = false, bool removeComments = false, IMarkupFormatter customFormatter = null)
{
return new PreMailer(stream, baseUri).MoveCssInline(removeStyleElements, ignoreElements, css, stripIdAndClassAttributes, removeComments);
return new PreMailer(stream, baseUri).MoveCssInline(removeStyleElements, ignoreElements, css, stripIdAndClassAttributes, removeComments, customFormatter);
}

/// <summary>
Expand All @@ -137,7 +137,7 @@ public static InlineResult MoveCssInline(Uri baseUri, Stream stream, bool remove
/// <param name="stripIdAndClassAttributes">True to strip ID and class attributes</param>
/// <param name="removeComments">True to remove comments, false to leave them intact</param>
/// <returns>Returns the html input, with styles moved to inline attributes.</returns>
public InlineResult MoveCssInline(bool removeStyleElements = false, string ignoreElements = null, string css = null, bool stripIdAndClassAttributes = false, bool removeComments = false)
public InlineResult MoveCssInline(bool removeStyleElements = false, string ignoreElements = null, string css = null, bool stripIdAndClassAttributes = false, bool removeComments = false, IMarkupFormatter customFormatter = null)
{
// Store the variables used for inlining the CSS
_removeStyleElements = removeStyleElements;
Expand Down Expand Up @@ -179,7 +179,7 @@ public InlineResult MoveCssInline(bool removeStyleElements = false, string ignor
}
}

IMarkupFormatter markupFormatter = GetMarkupFormatterForDocType();
IMarkupFormatter markupFormatter = customFormatter ?? GetMarkupFormatterForDocType();

using (var sw = new StringWriter())
{
Expand Down

0 comments on commit 1f5eab1

Please sign in to comment.