Comments (8)
using System;
using RazorEngineCore;
namespace ConsoleApp44
{
class Program
{
static void Main(string[] args)
{
RazorEngine engine = new RazorEngine();
IRazorEngineCompiledTemplate razorEngineCompiledTemplate = engine.Compile(@"
@if (true) {
var test=1;
}
");
Console.WriteLine(razorEngineCompiledTemplate.Run());
Console.ReadKey();
}
}
}
looks ok to me
from razorenginecore.
Try without if:
@{
var test=1;
}
from razorenginecore.
same output
namespace ConsoleApp44
{
class Program
{
static void Main(string[] args)
{
RazorEngine engine = new RazorEngine();
IRazorEngineCompiledTemplate razorEngineCompiledTemplate = engine.Compile(@"
@{
var test=1;
}
");
Console.WriteLine("start");
Console.WriteLine(razorEngineCompiledTemplate.Run());
Console.WriteLine("end");
Console.ReadKey();
}
}
}
from razorenginecore.
Please try
<img src='@("test")'>
output is without trailing ' :
<img src='test>
from razorenginecore.
could you please submit it a way of console app code, like I do. It will make reproducing a lot easier
from razorenginecore.
Code:
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>
from razorenginecore.
Without RazorEngineCore.Extensions package it works OK .
RazorEngineCore.Extensions provides encoding and Html helper which are used for Html rendering. RazorEngineCore.Extensions seems dead. Why not to add using html encoding by default and Html helper from it to RazorEngineCore.
from razorenginecore.
@adoconnection this is resolved on my end, you can close this issue.
from razorenginecore.
Related Issues (20)
- How to use ViewBag HOT 4
- DTO changes breaking the template rendering HOT 2
- Running Strongly typed model produces error HOT 1
- Include and Layout Wiki is outdated with current RazorEngine.Compile() method HOT 2
- System.TypeLoadException. HOT 5
- RazorEngineCompilationException for Strongly typed model. HOT 1
- Does it support to use in docker? HOT 1
- Dotnet 7/C#11 Support HOT 2
- How to use partial templates like a files? HOT 1
- Support for init-only setters HOT 1
- Compile templates at build-time HOT 2
- options to generate debugging information? HOT 4
- dotnet7 single file HOT 4
- run linq lambdas inside template seems to have problems HOT 2
- No thing
- A break mode occurs in Maui .net android app. It works fine in Win UI
- when empty value prop on html tag,razor doc parse error HOT 5
- Debug issue
- Get rid of System.Web dependency HOT 2
- RazorEngineCore NuGet package does not contain license information HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from razorenginecore.