From 60f8d800b0f7fb1344a3b1c0c20eb2c332dec3c1 Mon Sep 17 00:00:00 2001 From: Tommy Parnell Date: Wed, 7 Oct 2015 22:40:52 -0400 Subject: [PATCH] remove extra project --- src/DotNetMashup/DotNetMashup.xproj | 20 --- .../Extensions/StringHtmlExtension.cs | 169 ------------------ src/DotNetMashup/Model/BlogPost.cs | 19 -- src/DotNetMashup/Model/MetaData.cs | 12 -- src/DotNetMashup/project.json | 22 --- 5 files changed, 242 deletions(-) delete mode 100644 src/DotNetMashup/DotNetMashup.xproj delete mode 100644 src/DotNetMashup/Extensions/StringHtmlExtension.cs delete mode 100644 src/DotNetMashup/Model/BlogPost.cs delete mode 100644 src/DotNetMashup/Model/MetaData.cs delete mode 100644 src/DotNetMashup/project.json diff --git a/src/DotNetMashup/DotNetMashup.xproj b/src/DotNetMashup/DotNetMashup.xproj deleted file mode 100644 index 472f429..0000000 --- a/src/DotNetMashup/DotNetMashup.xproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - - e68542ee-79d4-47a1-bc66-bfb4b78856a1 - DotNetMashup - ..\..\artifacts\obj\$(MSBuildProjectName) - ..\..\artifacts\bin\$(MSBuildProjectName)\ - - - - 2.0 - - - diff --git a/src/DotNetMashup/Extensions/StringHtmlExtension.cs b/src/DotNetMashup/Extensions/StringHtmlExtension.cs deleted file mode 100644 index 4e4b5ac..0000000 --- a/src/DotNetMashup/Extensions/StringHtmlExtension.cs +++ /dev/null @@ -1,169 +0,0 @@ -//This code came from https://raw.githubusercontent.com/robvolk/Helpers.Net/master/Src/Helpers.Net/StringHtmlExtensions.cs - -namespace DotNetMashup.Extensions -{ - using System.Collections.Generic; - using System.Text; - using System.Text.RegularExpressions; - - public static class StringHtmlExtensions - { - /// - /// Truncates a string containing HTML to a number of text characters, keeping whole words. - /// The result contains HTML and any tags left open are closed. - /// - /// - /// - public static string TruncateHtml(this string html, int maxCharacters, string trailingText) - { - if(string.IsNullOrEmpty(html)) - return html; - - // find the spot to truncate - // count the text characters and ignore tags - var textCount = 0; - var charCount = 0; - var ignore = false; - foreach(char c in html) - { - charCount++; - if(c == '<') - ignore = true; - else if(!ignore) - textCount++; - - if(c == '>') - ignore = false; - - // stop once we hit the limit - if(textCount >= maxCharacters) - break; - } - - // Truncate the html and keep whole words only - var trunc = new StringBuilder(html.TruncateWords(charCount)); - - // keep track of open tags and close any tags left open - var tags = new Stack(); - var matches = Regex.Matches(trunc.ToString(), - @"<((?[^\s/>]+)|/(?[^\s>]+)).*?(?/)?\s*>", - RegexOptions.IgnoreCase | RegexOptions.Compiled | RegexOptions.Multiline); - - foreach(Match match in matches) - { - if(match.Success) - { - var tag = match.Groups["tag"].Value; - var closeTag = match.Groups["closeTag"].Value; - - // push to stack if open tag and ignore it if it is self-closing, i.e.
- if(!string.IsNullOrEmpty(tag) && string.IsNullOrEmpty(match.Groups["selfClose"].Value)) - tags.Push(tag); - - // pop from stack if close tag - else if(!string.IsNullOrEmpty(closeTag)) - { - // pop the tag to close it.. find the matching opening tag - // ignore any unclosed tags - while(tags.Pop() != closeTag && tags.Count > 0) - { } - } - } - } - - if(html.Length > charCount) - // add the trailing text - trunc.Append(trailingText); - - // pop the rest off the stack to close remainder of tags - while(tags.Count > 0) - { - trunc.Append("'); - } - - return trunc.ToString(); - } - - /// - /// Truncates a string containing HTML to a number of text characters, keeping whole words. - /// The result contains HTML and any tags left open are closed. - /// - /// - /// - public static string TruncateHtml(this string html, int maxCharacters) - { - return html.TruncateHtml(maxCharacters, null); - } - - /// - /// Strips all HTML tags from a string - /// - /// - /// - public static string StripHtml(this string html) - { - if(string.IsNullOrEmpty(html)) - return html; - - return Regex.Replace(html, @"<(.|\n)*?>", string.Empty); - } - - /// - /// Truncates text to a number of characters - /// - /// - /// - /// - /// - public static string Truncate(this string text, int maxCharacters) - { - return text.Truncate(maxCharacters, null); - } - - /// - /// Truncates text to a number of characters and adds trailing text, i.e. elipses, to the end - /// - /// - /// - /// - /// - public static string Truncate(this string text, int maxCharacters, string trailingText) - { - if(string.IsNullOrEmpty(text) || maxCharacters <= 0 || text.Length <= maxCharacters) - return text; - else - return text.Substring(0, maxCharacters) + trailingText; - } - - /// - /// Truncates text and discars any partial words left at the end - /// - /// - /// - /// - /// - public static string TruncateWords(this string text, int maxCharacters) - { - return text.TruncateWords(maxCharacters, null); - } - - /// - /// Truncates text and discars any partial words left at the end - /// - /// - /// - /// - /// - public static string TruncateWords(this string text, int maxCharacters, string trailingText) - { - if(string.IsNullOrEmpty(text) || maxCharacters <= 0 || text.Length <= maxCharacters) - return text; - - // trunctate the text, then remove the partial word at the end - return Regex.Replace(text.Truncate(maxCharacters), - @"\s+[^\s]+$", string.Empty, RegexOptions.IgnoreCase | RegexOptions.Compiled) + trailingText; - } - } -} \ No newline at end of file diff --git a/src/DotNetMashup/Model/BlogPost.cs b/src/DotNetMashup/Model/BlogPost.cs deleted file mode 100644 index bf74124..0000000 --- a/src/DotNetMashup/Model/BlogPost.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace DotNetMashup.Model -{ - public class BlogPost - { - public string Title { get; set; } - public string Content { get; set; } - public DateTime PublishedDate { get; set; } - public string Summary { get; set; } - public string Localink { get; set; } - public string OriginalLink { get; set; } - public string Author { get; set; } - public string AuthorEmail { get; set; } - } -} \ No newline at end of file diff --git a/src/DotNetMashup/Model/MetaData.cs b/src/DotNetMashup/Model/MetaData.cs deleted file mode 100644 index e4eac7b..0000000 --- a/src/DotNetMashup/Model/MetaData.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace DotNetMashup -{ - //stolen idea from: https://github.com/NancyFx/Nancy.Blog/blob/master/src/Nancy.Blog/Model/MetaData.cs - public class MetaData - { - public string FeedUrl { get; set; } - public string Author { get; set; } - public string AuthorEmail { get; set; } - public string GravatarUrl { get; set; } - public string Id { get; set; } - } -} \ No newline at end of file diff --git a/src/DotNetMashup/project.json b/src/DotNetMashup/project.json deleted file mode 100644 index 7e8089b..0000000 --- a/src/DotNetMashup/project.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "version": "1.0.0-*", - "description": "DotNetMashup Class Library", - "authors": [ "Tommy Parnell" ], - "tags": [ "" ], - "projectUrl": "", - "licenseUrl": "", - - "frameworks": { - "dnx451": { }, - "dnxcore50": { - "dependencies": { - "Microsoft.CSharp": "4.0.1-beta-23225", - "System.Collections": "4.0.11-beta-23225", - "System.Linq": "4.0.1-beta-23225", - "System.Runtime": "4.0.21-beta-23225", - "System.Threading": "4.0.11-beta-23225", - "System.Text.RegularExpressions": "4.0.11-beta-23225" - } - } - } -} \ No newline at end of file