From 45e3bfb671684372414f2ba3ed45439cc0193664 Mon Sep 17 00:00:00 2001 From: Alec Thomas Date: Mon, 12 Dec 2022 07:41:42 +1100 Subject: [PATCH] Convert bashsessions lexer to XML --- _tools/pygments2chroma_xml.py | 2 +- bin/{.go-1.19.2.pkg => .go-1.19.4.pkg} | 0 bin/go | 2 +- bin/gofmt | 2 +- lexers/bashsession.go | 26 -------------------------- lexers/embedded/bashsession.xml | 25 +++++++++++++++++++++++++ 6 files changed, 28 insertions(+), 29 deletions(-) rename bin/{.go-1.19.2.pkg => .go-1.19.4.pkg} (100%) delete mode 100644 lexers/bashsession.go create mode 100644 lexers/embedded/bashsession.xml diff --git a/_tools/pygments2chroma_xml.py b/_tools/pygments2chroma_xml.py index a824fee64..2b8a14242 100644 --- a/_tools/pygments2chroma_xml.py +++ b/_tools/pygments2chroma_xml.py @@ -82,7 +82,7 @@ def resolve_emitter(emitter): name = args.__name__ if name.endswith('Lexer'): name = name[:-5] - emitter = '' % state + emitter = '' % state else: raise ValueError('only support "using" with lexer classes, not %r' % args) else: diff --git a/bin/.go-1.19.2.pkg b/bin/.go-1.19.4.pkg similarity index 100% rename from bin/.go-1.19.2.pkg rename to bin/.go-1.19.4.pkg diff --git a/bin/go b/bin/go index 50baf1754..274f3896f 120000 --- a/bin/go +++ b/bin/go @@ -1 +1 @@ -.go-1.19.2.pkg \ No newline at end of file +.go-1.19.4.pkg \ No newline at end of file diff --git a/bin/gofmt b/bin/gofmt index 50baf1754..274f3896f 120000 --- a/bin/gofmt +++ b/bin/gofmt @@ -1 +1 @@ -.go-1.19.2.pkg \ No newline at end of file +.go-1.19.4.pkg \ No newline at end of file diff --git a/lexers/bashsession.go b/lexers/bashsession.go deleted file mode 100644 index bea9393ab..000000000 --- a/lexers/bashsession.go +++ /dev/null @@ -1,26 +0,0 @@ -package lexers - -import ( - . "github.com/alecthomas/chroma/v2" // nolint -) - -// BashSession lexer. -var BashSession = Register(MustNewLexer( - &Config{ - Name: "BashSession", - Aliases: []string{"bash-session", "console", "shell-session"}, - Filenames: []string{".sh-session"}, - MimeTypes: []string{"text/x-sh"}, - EnsureNL: true, - }, - bashsessionRules, -)) - -func bashsessionRules() Rules { - return Rules{ - "root": { - {`^((?:\[[^]]+@[^]]+\]\s?)?[#$%>])(\s*)(.*\n?)`, ByGroups(GenericPrompt, Text, Using("Bash")), nil}, - {`^.+\n?`, GenericOutput, nil}, - }, - } -} diff --git a/lexers/embedded/bashsession.xml b/lexers/embedded/bashsession.xml new file mode 100644 index 000000000..b9b55e0d0 --- /dev/null +++ b/lexers/embedded/bashsession.xml @@ -0,0 +1,25 @@ + + + BashSession + bash-session + console + shell-session + *.sh-session + text/x-sh + true + + + + + + + + + + + + + + + + \ No newline at end of file