mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-04-27 22:39:47 +00:00
Add support for comment content in LuaTable.Create method
This commit is contained in:
parent
d4dd368e64
commit
9fee51551c
@ -4,7 +4,7 @@ namespace SharedTools;
|
|||||||
|
|
||||||
public static class LuaTable
|
public static class LuaTable
|
||||||
{
|
{
|
||||||
public static string Create(ref StringBuilder sb, string tableVariableName, IReadOnlyDictionary<string, string> keyValuePairs, CancellationToken cancellationToken = default)
|
public static string Create(ref StringBuilder sb, string tableVariableName, IReadOnlyDictionary<string, string> keyValuePairs, IReadOnlyDictionary<string, string>? commentContent = null, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Add the UI_TEXT_CONTENT table:
|
// Add the UI_TEXT_CONTENT table:
|
||||||
@ -17,6 +17,7 @@ public static class LuaTable
|
|||||||
|
|
||||||
var key = kvp.Key;
|
var key = kvp.Key;
|
||||||
var value = kvp.Value.Replace("\n", " ").Trim();
|
var value = kvp.Value.Replace("\n", " ").Trim();
|
||||||
|
var commentValue = commentContent is null ? value : commentContent.GetValueOrDefault(key, value);
|
||||||
|
|
||||||
// Remove the "UI_TEXT_CONTENT." prefix from the key:
|
// Remove the "UI_TEXT_CONTENT." prefix from the key:
|
||||||
const string UI_TEXT_CONTENT = "UI_TEXT_CONTENT.";
|
const string UI_TEXT_CONTENT = "UI_TEXT_CONTENT.";
|
||||||
@ -27,7 +28,7 @@ public static class LuaTable
|
|||||||
|
|
||||||
// Add a comment with the original text content:
|
// Add a comment with the original text content:
|
||||||
sb.AppendLine();
|
sb.AppendLine();
|
||||||
sb.AppendLine($"-- {value}");
|
sb.AppendLine($"-- {commentContent}");
|
||||||
|
|
||||||
// Add the assignment to the UI_TEXT_CONTENT table:
|
// Add the assignment to the UI_TEXT_CONTENT table:
|
||||||
sb.AppendLine($"""
|
sb.AppendLine($"""
|
||||||
|
Loading…
Reference in New Issue
Block a user