wdcossey / RazorEngineCore.Extensions

Extensions for RazorEngineCore (ASP.NET Core 3.1.1 Razor Template Engine)
11 stars 5 forks source link

Trailing delimiter is discarded #8

Open kobruleht opened 3 years ago

kobruleht commented 3 years ago

On html rendering, it discards trailing delimiter ( " or ' )

Code to reproduce:

using System;
using System.Threading.Tasks;
using RazorEngineCore;

namespace SampleApp
{
    public class Program
    {
        static async Task Main(string[] args)
        {
            RazorEngine razorEngine = new RazorEngine();
            var template =
                await razorEngine.CompileAsync<RazorEngineCorePageModel>(
                    @"<img href='@(""test"")'>");
            var res = await template.RunAsync();
            // Observed: trailing ' is lost
            Console.WriteLine(res);
            Console.ReadKey();
        }
    }
}

Project:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net5.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="RazorEngineCore" Version="2021.3.1" />
    <PackageReference Include="RazorEngineCore.Extensions" Version="0.3.0" />
  </ItemGroup>

</Project>
wdcossey commented 3 years ago

@kobruleht,

I'll have a look into this for you.

wdcossey commented 3 years ago

@kobruleht

I have identified the issue and will get out an update as soon as possible.

wdcossey commented 3 years ago

@kobruleht there's currently a pre-release version available on NuGet if you want to test it (whilst I am busy with other changes)?

kobruleht commented 3 years ago

I tried and it works. Thank you. Is there any hope to get @Html.PartialAsync like in Antalis Razorengine

wdcossey commented 3 years ago

I can't promise anything but I'll have a look into it for you!

Might look at adding some limited support for @Html.Partial w/o some of the known overloads.