Skip to content

Commit

Permalink
Update dependencies, move net50 to net60
Browse files Browse the repository at this point in the history
  • Loading branch information
axunonb committed Jun 6, 2022
1 parent 57528b4 commit c3d6c96
Show file tree
Hide file tree
Showing 18 changed files with 604 additions and 619 deletions.
10 changes: 5 additions & 5 deletions Src/Axuno.TextTemplating.Tests/Axuno.TextTemplating.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\Axuno.TextTemplating\Axuno.TextTemplating.snk</AssemblyOriginatorKeyFile>
<Authors>axuno gGmbH</Authors>
Expand All @@ -17,10 +17,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
<PackageReference Include="NUnit" Version="3.13.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
</ItemGroup>

<ItemGroup>
Expand Down
3 changes: 1 addition & 2 deletions Src/Axuno.TextTemplating.Tests/DirectoryLocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.IO;
using System.Reflection;

#nullable enable
namespace Axuno.TextTemplating.Tests;

public class DirectoryLocator
Expand Down Expand Up @@ -43,4 +42,4 @@ public static string GetTargetProjectPath(Type classFromTargetAssembly)

throw new Exception($"Project root could not be located using the application root {applicationBasePath}.");
}
}
}
22 changes: 11 additions & 11 deletions Src/Axuno.TextTemplating/Axuno.TextTemplating.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.1;net5.0</TargetFrameworks>
<TargetFrameworks>netstandard2.1;net60</TargetFrameworks>
<Nullable>enable</Nullable>
<Description>Text templating is used to dynamically render contents based on a template and a model.

Expand All @@ -11,7 +11,7 @@
* You can pass arbitrary objects to the template context (beside the model) for advanced scenarios.

The library is a modified version of Volo.Abp.TextTemplating 4.1</Description>
<Copyright>© 2013 - 2021 Volosoft. Open source license with LGPLv3.0</Copyright>
<Copyright>© 2013 - 2022 Volosoft. Open source license with LGPLv3.0</Copyright>
<Version>1.1.0</Version>
<Authors>axuno gGmbH</Authors>
<PackageLicenseExpression>LGPL-3.0-only</PackageLicenseExpression>
Expand All @@ -27,7 +27,7 @@ The library is a modified version of Volo.Abp.TextTemplating 4.1</Description>
<RepositoryType>Git</RepositoryType>
<PackageIcon>TextTemplating.png</PackageIcon>
<PackageProjectUrl>https://github.com/axuno/Axuno.TextTemplating</PackageProjectUrl>
<PackageReleaseNotes>Replaced package Scriban with Scriban.Signed 3.3.3</PackageReleaseNotes>
<PackageReleaseNotes>Replaced package Scriban with Scriban.Signed 5.4.6</PackageReleaseNotes>
<OutputType>Library</OutputType>
<AssemblyVersion>1.1.0.0</AssemblyVersion>
<FileVersion>1.1.0.0</FileVersion>
Expand All @@ -49,17 +49,17 @@ The library is a modified version of Volo.Abp.TextTemplating 4.1</Description>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Axuno.VirtualFileSystem" Version="1.0.0" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Composite" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="5.0.2" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Physical" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="5.0.2" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.0-beta-20204-02">
<PackageReference Include="Axuno.VirtualFileSystem" Version="1.0.1" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Composite" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="6.0.5" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Physical" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="6.0.5" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Scriban.Signed" Version="3.3.3" />
<PackageReference Include="System.Collections.Immutable" Version="5.0.0" />
<PackageReference Include="Scriban.Signed" Version="5.4.6" />
<PackageReference Include="System.Collections.Immutable" Version="6.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
33 changes: 16 additions & 17 deletions Src/Axuno.TextTemplating/ITemplateContentProvider.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
using System.Threading.Tasks;

namespace Axuno.TextTemplating
namespace Axuno.TextTemplating;

public interface ITemplateContentProvider
{
public interface ITemplateContentProvider
{
Task<string?> GetContentAsync(
string templateName,
string? cultureName = null,
bool tryDefaults = true,
bool useCurrentCultureIfCultureNameIsNull = true
);
Task<string?> GetContentAsync(
string templateName,
string? cultureName = null,
bool tryDefaults = true,
bool useCurrentCultureIfCultureNameIsNull = true
);

Task<string?> GetContentAsync(
TemplateDefinition templateDefinition,
string? cultureName = null,
bool tryDefaults = true,
bool useCurrentCultureIfCultureNameIsNull = true
);
}
}
Task<string?> GetContentAsync(
TemplateDefinition templateDefinition,
string? cultureName = null,
bool tryDefaults = true,
bool useCurrentCultureIfCultureNameIsNull = true
);
}
15 changes: 7 additions & 8 deletions Src/Axuno.TextTemplating/ITemplateDefinitionContext.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
using System.Collections.Generic;

namespace Axuno.TextTemplating
namespace Axuno.TextTemplating;

public interface ITemplateDefinitionContext
{
public interface ITemplateDefinitionContext
{
IReadOnlyList<TemplateDefinition> GetAll(string name);
IReadOnlyList<TemplateDefinition> GetAll(string name);

TemplateDefinition? Get(string name);
TemplateDefinition? Get(string name);

void Add(params TemplateDefinition[] definitions);
}
}
void Add(params TemplateDefinition[] definitions);
}
13 changes: 6 additions & 7 deletions Src/Axuno.TextTemplating/ITemplateDefinitionManager.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
using System.Collections.Generic;

namespace Axuno.TextTemplating
namespace Axuno.TextTemplating;

public interface ITemplateDefinitionManager
{
public interface ITemplateDefinitionManager
{

TemplateDefinition? Get(string name);
TemplateDefinition? Get(string name);

IReadOnlyList<TemplateDefinition> GetAll();
}
}
IReadOnlyList<TemplateDefinition> GetAll();
}
15 changes: 7 additions & 8 deletions Src/Axuno.TextTemplating/ITemplateDefinitionProvider.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
namespace Axuno.TextTemplating
namespace Axuno.TextTemplating;

public interface ITemplateDefinitionProvider
{
public interface ITemplateDefinitionProvider
{
void PreDefine(ITemplateDefinitionContext context);
void PreDefine(ITemplateDefinitionContext context);

void Define(ITemplateDefinitionContext context);
void Define(ITemplateDefinitionContext context);

void PostDefine(ITemplateDefinitionContext context);
}
}
void PostDefine(ITemplateDefinitionContext context);
}
31 changes: 15 additions & 16 deletions Src/Axuno.TextTemplating/ITemplateRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,20 @@
using System.Globalization;
using System.Threading.Tasks;

namespace Axuno.TextTemplating
namespace Axuno.TextTemplating;

public interface ITemplateRenderer
{
public interface ITemplateRenderer
{
/// <summary>
/// Renders a text template.
/// </summary>
/// <param name="templateName">The template name</param>
/// <param name="model">An optional model object that is used in the template.</param>
/// <param name="cultureName">Culture name. Uses the <see cref="CultureInfo.CurrentUICulture"/> if not specified</param>
/// <param name="globalContext">A dictionary which can be used to import global objects to the template</param>
/// <returns>Returns the rendered text template.</returns>
Task<string> RenderAsync(string templateName,
object? model = null,
string? cultureName = null,
Dictionary<string, object>? globalContext = null);
}
/// <summary>
/// Renders a text template.
/// </summary>
/// <param name="templateName">The template name</param>
/// <param name="model">An optional model object that is used in the template.</param>
/// <param name="cultureName">Culture name. Uses the <see cref="CultureInfo.CurrentUICulture"/> if not specified</param>
/// <param name="globalContext">A dictionary which can be used to import global objects to the template</param>
/// <returns>Returns the rendered text template.</returns>
Task<string> RenderAsync(string templateName,
object? model = null,
string? cultureName = null,
Dictionary<string, object>? globalContext = null);
}
63 changes: 31 additions & 32 deletions Src/Axuno.TextTemplating/ITypeList.cs
Original file line number Diff line number Diff line change
@@ -1,43 +1,42 @@
using System;
using System.Collections.Generic;

namespace Axuno.TextTemplating
namespace Axuno.TextTemplating;

/// <summary>
/// A shortcut for <see cref="ITypeList{TBaseType}"/> to use object as base type.
/// </summary>
public interface ITypeList : ITypeList<object>
{ }

/// <summary>
/// Extends <see cref="IList{Type}"/> to add restriction a specific base type.
/// </summary>
/// <typeparam name="TBaseType">Base Type of <see cref="Type"/>s in this list</typeparam>
public interface ITypeList<in TBaseType> : IList<Type>
{
/// <summary>
/// A shortcut for <see cref="ITypeList{TBaseType}"/> to use object as base type.
/// Adds a type to list.
/// </summary>
public interface ITypeList : ITypeList<object>
{ }
/// <typeparam name="T">Type</typeparam>
void Add<T>() where T : TBaseType;

/// <summary>
/// Extends <see cref="IList{Type}"/> to add restriction a specific base type.
/// Adds a type to list if it's not already in the list.
/// </summary>
/// <typeparam name="TBaseType">Base Type of <see cref="Type"/>s in this list</typeparam>
public interface ITypeList<in TBaseType> : IList<Type>
{
/// <summary>
/// Adds a type to list.
/// </summary>
/// <typeparam name="T">Type</typeparam>
void Add<T>() where T : TBaseType;
/// <typeparam name="T">Type</typeparam>
bool TryAdd<T>() where T : TBaseType;

/// <summary>
/// Adds a type to list if it's not already in the list.
/// </summary>
/// <typeparam name="T">Type</typeparam>
bool TryAdd<T>() where T : TBaseType;

/// <summary>
/// Checks if a type exists in the list.
/// </summary>
/// <typeparam name="T">Type</typeparam>
/// <returns></returns>
bool Contains<T>() where T : TBaseType;
/// <summary>
/// Checks if a type exists in the list.
/// </summary>
/// <typeparam name="T">Type</typeparam>
/// <returns></returns>
bool Contains<T>() where T : TBaseType;

/// <summary>
/// Removes a type from list
/// </summary>
/// <typeparam name="T"></typeparam>
void Remove<T>() where T : TBaseType;
}
}
/// <summary>
/// Removes a type from list
/// </summary>
/// <typeparam name="T"></typeparam>
void Remove<T>() where T : TBaseType;
}
31 changes: 15 additions & 16 deletions Src/Axuno.TextTemplating/TemplateContentContributorContext.cs
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
using System;


namespace Axuno.TextTemplating
namespace Axuno.TextTemplating;

public class TemplateContentContributorContext
{
public class TemplateContentContributorContext
{

public TemplateDefinition TemplateDefinition { get; }
public TemplateDefinition TemplateDefinition { get; }

public IServiceProvider ServiceProvider { get; }
public IServiceProvider ServiceProvider { get; }

public string? Culture { get; }
public string? Culture { get; }

public TemplateContentContributorContext(
TemplateDefinition templateDefinition,
IServiceProvider serviceProvider,
string? culture)
{
TemplateDefinition = Check.NotNull(templateDefinition, nameof(templateDefinition));
ServiceProvider = Check.NotNull(serviceProvider, nameof(serviceProvider));
Culture = culture;
}
public TemplateContentContributorContext(
TemplateDefinition templateDefinition,
IServiceProvider serviceProvider,
string? culture)
{
TemplateDefinition = Check.NotNull(templateDefinition, nameof(templateDefinition));
ServiceProvider = Check.NotNull(serviceProvider, nameof(serviceProvider));
Culture = culture;
}
}
}
Loading

0 comments on commit c3d6c96

Please sign in to comment.