BotSharp/src/Plugins/BotSharp.Plugin.WebDriver/Services/WebDriverService.AssembleMarkup.cs
2024-01-27 08:58:51 -06:00

34 lines
823 B
C#

using BotSharp.Plugin.WebDriver.LlmContexts;
namespace BotSharp.Plugin.WebDriver.Services;
public partial class WebDriverService
{
internal string AssembleMarkup(string tagName, MarkupProperties properties)
{
var html = $"<{tagName}";
if (!string.IsNullOrEmpty(properties.Id))
{
html += $" id=\"{properties.Id}\"";
}
if (!string.IsNullOrEmpty(properties.Name))
{
html += $" name=\"{properties.Name}\"";
}
if (!string.IsNullOrEmpty(properties.Type))
{
html += $" type=\"{properties.Type}\"";
}
if (!string.IsNullOrEmpty(properties.Text))
{
html += $">{properties.Text}</{tagName}>";
return html;
}
return html + $"></{tagName}>";
}
}