-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from heldersepu/master
Add string extension IsHtmlFile
- Loading branch information
Showing
9 changed files
with
313 additions
and
309 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using NUnit.Framework; | ||
using System.Collections.Generic; | ||
|
||
namespace HtmlMinifier.Tests | ||
{ | ||
[TestFixture] | ||
public class FileExtensionTests | ||
{ | ||
[Test] | ||
public void GithubIssue25__ShouldReturnCorrectly() | ||
{ | ||
Assert.That("test.html".IsHtmlFile(), Is.True); | ||
Assert.That("codes.js.aspx".IsHtmlFile(), Is.True); | ||
|
||
Assert.That("codes.aspx.js".IsHtmlFile(), Is.False); | ||
Assert.That("aspx.codes.js".IsHtmlFile(), Is.False); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,48 @@ | ||
namespace HtmlMinifier | ||
using System.Linq; | ||
|
||
namespace HtmlMinifier | ||
{ | ||
public class Features | ||
{ | ||
/// <summary> | ||
/// Check the arguments passed in to determine if we should enable or disable any features. | ||
/// </summary> | ||
/// <param name="args">The arguments passed in.</param> | ||
public Features(string[] args) | ||
{ | ||
if (args.Contains("ignorehtmlcomments")) | ||
{ | ||
IgnoreHtmlComments = true; | ||
} | ||
|
||
if (args.Contains("ignorejscomments")) | ||
{ | ||
IgnoreJsComments = true; | ||
} | ||
|
||
int maxLength = 0; | ||
// This is a check to see if the args contain an optional parameter for the max line length | ||
if (args != null && args.Length > 1) | ||
{ | ||
// Try and parse the value sent through | ||
int.TryParse(args[1], out maxLength); | ||
} | ||
MaxLength = maxLength; | ||
} | ||
|
||
/// <summary> | ||
/// Should we ignore the JavaScript comments and not minify? | ||
/// </summary> | ||
public bool IgnoreJsComments { get; set; } | ||
public bool IgnoreJsComments { get; private set; } | ||
|
||
/// <summary> | ||
/// Should we ignore the html comments and not minify? | ||
/// </summary> | ||
public bool IgnoreHtmlComments { get; set; } | ||
public bool IgnoreHtmlComments { get; private set; } | ||
|
||
/// <summary> | ||
/// Property for the max character count | ||
/// </summary> | ||
public int MaxLength { get; private set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.