mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-09 13:49:40 +00:00
Map code fence languages to export formats in one place
This commit is contained in:
4 files changed
+66
-11
No files matched your search
@@ -94,15 +94,7 @@ public static class PlainFileExport
|
||||
/// </summary>
|
||||
private static (string Fallback, FileExportFormat Format, string Text)? ToContent(FencedCodeBlock block)
|
||||
{
|
||||
var format = block.Info?.Trim() switch
|
||||
{
|
||||
"csv" => FileExportFormat.CSV,
|
||||
"tsv" => FileExportFormat.TSV,
|
||||
|
||||
_ => FileExportFormat.NONE,
|
||||
};
|
||||
|
||||
if (format is FileExportFormat.NONE)
|
||||
if (!FileExportFormatExtensions.TryFromCodeFenceLanguage(block.Info, out var format) || format is not (FileExportFormat.CSV or FileExportFormat.TSV))
|
||||
return null;
|
||||
|
||||
var content = block.Lines.ToString();
|
||||
@@ -206,4 +198,4 @@ public static class PlainFileExport
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user