-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cfe4fb0
commit cbe5113
Showing
10 changed files
with
60 additions
and
26 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 |
---|---|---|
|
@@ -19,7 +19,5 @@ public static string Strip(string original) | |
|
||
return sanitizedText.Trim(); | ||
} | ||
|
||
|
||
} | ||
} |
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,18 @@ | ||
using System.Text.RegularExpressions; | ||
|
||
namespace Connect.Razor.Blade | ||
{ | ||
internal static class TagReplacer | ||
{ | ||
internal static Regex Replacer(string names, bool open = true, bool close = true) | ||
{ | ||
if (names.IndexOf(',') > -1) | ||
names = "[" + names.Replace(',', '|') + "]"; | ||
const string closeOptional = "[/]?"; | ||
const string closeRequired = "/"; | ||
var closer = open ? (close ? closeOptional : "") : (close ? closeRequired : ""); | ||
return new Regex("<" + closer + names + "[^>]*>", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant); | ||
} | ||
|
||
} | ||
} |
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,27 @@ | ||
namespace Connect.Razor.Blade | ||
{ | ||
public partial class Tags | ||
{ | ||
/// <summary> | ||
/// internal test wrap-tag, not ready for use, so still marked internal | ||
/// </summary> | ||
/// <param name="tag"></param> | ||
/// <param name="content"></param> | ||
/// <param name="id"></param> | ||
/// <param name="cls"></param> | ||
/// <param name="attr"></param> | ||
/// <returns></returns> | ||
internal static string Wrap(string tag, string content, string id = null, string cls = null, string attr = null) | ||
{ | ||
if (attr == null) attr = ""; | ||
|
||
if (cls != null) | ||
attr = $"class=\"{cls}\" " + attr; | ||
if (id != null) | ||
attr = $"id=\"{id}\" " + attr; | ||
|
||
if (!string.IsNullOrWhiteSpace(attr)) attr = " " + attr; | ||
return $"<{tag}{attr}>{content}</{tag}>"; | ||
} | ||
} | ||
} |
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,5 +1,4 @@ | ||
using System.Text.RegularExpressions; | ||
using Connect.Razor.Internals; | ||
|
||
namespace Connect.Razor.Blade | ||
{ | ||
|
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
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