Skip to content

Commit

Permalink
Updated Nuget Package Scriban 3.3.2 and
Browse files Browse the repository at this point in the history
Implemented fixes of Abp framework from commit abpframework/abp@d495686
  • Loading branch information
axunonb committed Jan 2, 2021
1 parent e3e114c commit 023ea2f
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 29 deletions.
25 changes: 14 additions & 11 deletions Src/Axuno.TextTemplating/Axuno.TextTemplating.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
* You can define layout templates to be used as the layout while rendering other templates.
* 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 3.3.1 </Description>
<Copyright>© 2013 - 2020 Volosoft. Open source license with LGPLv3.0</Copyright>
<Version>0.8.1</Version>
The library is a modified version of Volo.Abp.TextTemplating 4.1</Description>
<Copyright>© 2013 - 2021 Volosoft. Open source license with LGPLv3.0</Copyright>
<Version>0.8.3</Version>
<Authors>axuno gGmbH</Authors>
<PackageLicenseExpression>LGPL-3.0-only</PackageLicenseExpression>
<PackageTags>text templating netstandard c#</PackageTags>
Expand All @@ -25,8 +25,11 @@ The library is a modified version of Volo.Abp.TextTemplating 3.3.1 </Description
<RepositoryType>Git</RepositoryType>
<PackageIcon>TextTemplating.png</PackageIcon>
<PackageProjectUrl>https://github.com/axuno/Axuno.TextTemplating</PackageProjectUrl>
<PackageReleaseNotes>Migration to Scriban v3.0.0</PackageReleaseNotes>
<PackageReleaseNotes>* Updated Nuget Package Scriban 3.3.2
* Implemented fixes of Abp framework from commit https://github.com/abpframework/abp/commit/d495686fd2f6256abdeb0b6eacfd9f73d6f961f0</PackageReleaseNotes>
<OutputType>Library</OutputType>
<AssemblyVersion>0.8.3.0</AssemblyVersion>
<FileVersion>0.8.3.0</FileVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand All @@ -46,17 +49,17 @@ The library is a modified version of Volo.Abp.TextTemplating 3.3.1 </Description

<ItemGroup>
<PackageReference Include="Axuno.VirtualFileSystem" Version="0.7.2" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Composite" Version="3.1.9" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="3.1.9" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Physical" Version="3.1.9" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="3.1.9" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0">
<PackageReference Include="Microsoft.Extensions.FileProviders.Composite" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="5.0.1" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Physical" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="5.0.1" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.0-beta-20204-02">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Nito.AsyncEx" Version="5.1.0" />
<PackageReference Include="Scriban" Version="3.0.0" />
<PackageReference Include="System.Collections.Immutable" Version="1.7.1" />
<PackageReference Include="Scriban" Version="3.3.2" />
<PackageReference Include="System.Collections.Immutable" Version="5.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
18 changes: 9 additions & 9 deletions Src/Axuno.TextTemplating/TemplateLocalizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,19 @@ private string GetString(ScriptArray? arguments)
return args.Any() ? _localizer[name.ToString(), args] : _localizer[name.ToString()];
}

public ScriptParameterInfo GetParameterInfo(int index)
{
switch (index)
{
case 0: return new ScriptParameterInfo(typeof(string), string.Empty);
default: return new ScriptParameterInfo(typeof(object), string.Empty);
}
}

public int RequiredParameterCount => 0;

public int ParameterCount => 0;

public ScriptVarParamKind VarParamKind => ScriptVarParamKind.Direct;

public Type ReturnType => typeof(string);

public ScriptParameterInfo GetParameterInfo(int index)
{
return index == 0
? new ScriptParameterInfo(typeof(string), "template_name")
: new ScriptParameterInfo(typeof(object), "value");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Threading.Tasks;
using Axuno.TextTemplating;
using Axuno.TextTemplating.VirtualFiles;
using Axuno.VirtualFileSystem;
using Microsoft.Extensions.FileProviders;
using Nito.AsyncEx;

Expand Down Expand Up @@ -59,9 +60,16 @@ protected virtual async Task<ILocalizedTemplateContentReader> CreateInternalAsyn
}

var fileInfo = VirtualFileProvider.GetFileInfo(virtualPath);

if (!fileInfo.Exists)
{
throw new Exception("Could not find a file/folder at the location: " + virtualPath);
var directoryContents = VirtualFileProvider.GetDirectoryContents(virtualPath);
if (!directoryContents.Exists)
{
throw new Exception("Could not find a file/folder at the location: " + virtualPath);
}

fileInfo = new VirtualDirectoryFileInfo(virtualPath, virtualPath, DateTimeOffset.UtcNow);
}

if (fileInfo.IsDirectory)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Axuno.TextTemplating.VirtualFiles;
using Microsoft.Extensions.FileProviders;

namespace Axuno.TextTemplating.VirtualFiles
Expand All @@ -15,13 +14,13 @@ public async Task ReadContentsAsync(
IFileProvider virtualFileProvider,
string virtualPath)
{
var directoryInfo = virtualFileProvider.GetFileInfo(virtualPath);
if (!directoryInfo.IsDirectory)
var directoryContents = virtualFileProvider.GetDirectoryContents(virtualPath);
if (!directoryContents.Exists)
{
throw new Exception("Given virtual path is not a folder: " + virtualPath);
throw new Exception("Could not find a folder at the location: " + virtualPath);
}

foreach (var file in virtualFileProvider.GetDirectoryContents(virtualPath))
foreach (var file in directoryContents)
{
if (file.IsDirectory)
{
Expand Down
6 changes: 3 additions & 3 deletions Src/TextTemplatingDemo/TextTemplatingDemo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="3.1.9" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.1.9" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="3.1.9" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.1" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="5.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit 023ea2f

Please sign in to comment.