From 9c13f9aaeddc7158a473edfb4776caeb70be6ab5 Mon Sep 17 00:00:00 2001 From: Felix Berlakovich Date: Mon, 3 Jun 2024 08:51:40 +0200 Subject: [PATCH] Load the available lexers from pygmentize output --- pp-source-format/Formatter.cs | 103 +++++++++++++++--- .../Properties/Settings.Designer.cs | 2 +- pp-source-format/Ribbon.Designer.cs | 14 --- pp-source-format/Ribbon.cs | 25 +++++ pp-source-format/app.config | 12 +- pp-source-format/packages.config | 12 ++ pp-source-format/pp-source-format.csproj | 32 +++++- 7 files changed, 165 insertions(+), 35 deletions(-) create mode 100644 pp-source-format/packages.config diff --git a/pp-source-format/Formatter.cs b/pp-source-format/Formatter.cs index dda220f..044c04b 100644 --- a/pp-source-format/Formatter.cs +++ b/pp-source-format/Formatter.cs @@ -4,7 +4,7 @@ using System.Diagnostics; using System.IO; using System.Linq; -using System.Text; +using System.Text.Json.Nodes; using System.Text.RegularExpressions; using System.Threading.Tasks; using System.Windows.Forms; @@ -48,7 +48,6 @@ static PpPasteDataType PowerpointPasteType(this Format f) return PpPasteDataType.ppPasteRTF; default: throw new Exception("Unknown paste type: " + f.ToString()); - } } @@ -65,7 +64,6 @@ static string DataFormat(this Format f) return DataFormats.Rtf; default: throw new Exception("Unknown data format: " + f.ToString()); - } } @@ -82,10 +80,77 @@ static string PygmentsFormat(this Format f) return "rtf"; default: throw new Exception("Unknown pygments format: " + f.ToString()); + } + } + + public class PygmentsConfiguration + { + public class Style + { + public string Name { get; } + public string Info { get; } + public Style(string name, string info) + { + Name = name; + Info = info; + } + } + + public IEnumerable Lexers { get; } + public List