Skip to content

Commit 60e20e3

Browse files
committed
Update CustomTabPage.cs
1 parent b003170 commit 60e20e3

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

Virtual_EDW/CustomTabPage.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,9 @@ private void GenerateFromTemplate()
596596
try
597597
{
598598
// Compile the template, and merge it with the metadata.
599+
// Register Handlebars template with escaping disabled
600+
// Disable HTML escaping directly on the Handlebars class
601+
Handlebars.Configuration.NoEscape = true;
599602
var template = Handlebars.Compile(localRichTextBoxGenerationTemplate.Text);
600603

601604
if (!_fileSplit)
@@ -689,8 +692,15 @@ private void GenerateFromTemplate()
689692

690693
private void Generate(string targetDataObjectName, VdwDataObjectMappingList vdwDataObjectMappingList, HandlebarsTemplate<object, object> template, string outputFileName)
691694
{
692-
var jsonInput = System.Text.Json.JsonSerializer.Serialize(vdwDataObjectMappingList);
693-
JsonNode deserializedMapping = System.Text.Json.JsonSerializer.Deserialize<JsonNode>(jsonInput);
695+
var serializeOptions = new JsonSerializerOptions
696+
{
697+
WriteIndented = true,
698+
Encoder = System.Text.Encodings.Web.JavaScriptEncoder.UnsafeRelaxedJsonEscaping
699+
};
700+
701+
// Change it to a JsonNode for full flexibility (files don't need to conform to the schema this way)
702+
var jsonInput = System.Text.Json.JsonSerializer.Serialize(vdwDataObjectMappingList, serializeOptions);
703+
JsonNode? deserializedMapping = System.Text.Json.JsonSerializer.Deserialize<JsonNode>(jsonInput, serializeOptions);
694704

695705
var result = template(deserializedMapping);
696706

0 commit comments

Comments
 (0)