Added saving code blocks of every programming language (#1117)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2026-10-27 15:23:42 +01:00
1 parent 1a23479f33
commit 03abd78a5f
25 files changed
+1209 -65

No files matched your search

@@ -62,6 +62,16 @@ public sealed class DataBatchProcessing(Expression<Func<Data, DataBatchProcessin
/// </remarks>
public FileExportFormat ResultFileFormat { get; set; } = ManagedConfiguration.Register(configSelection, value => value.ResultFileFormat, FileExportFormat.MARKDOWN);
/// <summary>
/// Whether the result files can be written in a format: only in one which holds an entire answer.
/// </summary>
/// <remarks>
/// The format list of the assistant offers nothing else, but a configuration plugin may name
/// any format, a table or code for example, and the result files would then end up without an
/// extension.
/// </remarks>
public static bool IsValidResultFileFormat(FileExportFormat format) => FileExportFormatExtensions.ANSWER_FORMATS.Contains(format);
public string CsvFileName { get; set; } = ManagedConfiguration.Register(configSelection, value => value.CsvFileName, string.Empty);
public string ResultColumnHeader { get; set; } = ManagedConfiguration.Register(configSelection, value => value.ResultColumnHeader, string.Empty);
@@ -23,6 +23,7 @@ public static partial class ManagedConfiguration
/// <param name="propertyExpression">The expression to select the property within the configuration class.</param>
/// <param name="dryRun">When true, the method will not apply any changes, but only check if the configuration can be read.</param>
/// <param name="_">An unused parameter to help with type inference for enum types. You might ignore it when calling the method.</param>
/// <param name="validator">An optional validator for rejecting enum values the setting does not support, e.g., a format a feature cannot write.</param>
/// <typeparam name="TClass">The type of the configuration class.</typeparam>
/// <typeparam name="TValue">The type of the property within the configuration class.</typeparam>
/// <returns>True when the configuration was successfully processed, otherwise false.</returns>
@@ -32,7 +33,8 @@ public static partial class ManagedConfiguration
Guid configPluginId,
LuaTable settings,
bool dryRun,
TValue? _ = default)
TValue? _ = default,
Func<TValue, bool>? validator = null)
where TValue : Enum
{
//
@@ -53,7 +55,8 @@ public static partial class ManagedConfiguration
if(configuredEnumValue.TryRead<string>(out var configuredEnumText))
{
// Step 3 -- try to parse the string as the enum type:
if (EnumNames.TryParse(typeof(TValue), configuredEnumText, out var configuredEnum))
if (EnumNames.TryParse(typeof(TValue), configuredEnumText, out var configuredEnum)
&& (validator?.Invoke((TValue)configuredEnum) ?? true))
{
configuredValue = (TValue)configuredEnum;
successful = true;