merged from work
This commit is contained in:
32
src/Katteker.Changelog/ChangelogExtension.cs
Normal file
32
src/Katteker.Changelog/ChangelogExtension.cs
Normal file
@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Net;
|
||||
|
||||
namespace Katteker.Changelog
|
||||
{
|
||||
public static class ChangelogExtension
|
||||
{
|
||||
/// <summary>
|
||||
/// Format the Changelog as Html compliant file.
|
||||
/// </summary>
|
||||
public static string AsHtml(this ChangelogFile value)
|
||||
{
|
||||
string result;
|
||||
switch (value.ChangelogFileType)
|
||||
{
|
||||
case ChangelogFileType.TextFile:
|
||||
var plainText = WebUtility.HtmlEncode(value.Content);
|
||||
result = plainText?.Replace(Environment.NewLine, "<br />");
|
||||
break;
|
||||
case ChangelogFileType.MarkdownFile:
|
||||
result = new MarkdownSharp.Markdown().Transform(value.Content);
|
||||
break;
|
||||
default:
|
||||
result = value.Content;
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
16
src/Katteker.Changelog/Katteker.Changelog.csproj
Normal file
16
src/Katteker.Changelog/Katteker.Changelog.csproj
Normal file
@ -0,0 +1,16 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net452;netstandard2.0</TargetFrameworks>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Katteker\Katteker.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MarkdownSharp" Version="2.0.5" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
22
src/Katteker.Changelog/Properties/AssemblyInfo.cs
Normal file
22
src/Katteker.Changelog/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,22 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("Holger B<>rchers")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.1.5.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.1.5")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("Katteker")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("Katteker")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.1.5.0")]
|
||||
|
||||
// Generated by the MSBuild WriteCodeFragment class.
|
||||
|
Reference in New Issue
Block a user