From 0f973a84d51e045bee1873b3c96ec405af56c68a Mon Sep 17 00:00:00 2001 From: JakobDev Date: Tue, 19 Dec 2023 12:18:58 +0100 Subject: [PATCH 1/2] Add desktop entry lexer --- README.md | 33 +++++++++++++------------- lexers/embedded/desktop_entry.xml | 17 +++++++++++++ lexers/testdata/desktop_entry.actual | 8 +++++++ lexers/testdata/desktop_entry.expected | 31 ++++++++++++++++++++++++ 4 files changed, 73 insertions(+), 16 deletions(-) create mode 100644 lexers/embedded/desktop_entry.xml create mode 100644 lexers/testdata/desktop_entry.actual create mode 100644 lexers/testdata/desktop_entry.expected diff --git a/README.md b/README.md index 6a7c77d24..48be226ed 100644 --- a/README.md +++ b/README.md @@ -14,21 +14,22 @@ translators for Pygments lexers and styles. -1. [Table of Contents](#table-of-contents) -2. [Supported languages](#supported-languages) -3. [Try it](#try-it) -4. [Using the library](#using-the-library) - 1. [Quick start](#quick-start) - 2. [Identifying the language](#identifying-the-language) - 3. [Formatting the output](#formatting-the-output) - 4. [The HTML formatter](#the-html-formatter) -5. [More detail](#more-detail) - 1. [Lexers](#lexers) - 2. [Formatters](#formatters) - 3. [Styles](#styles) -6. [Command-line interface](#command-line-interface) -7. [Testing lexers](#testing-lexers) -8. [What's missing compared to Pygments?](#whats-missing-compared-to-pygments) +- [Chroma — A general purpose syntax highlighter in pure Go](#chroma--a-general-purpose-syntax-highlighter-in-pure-go) + - [Table of Contents](#table-of-contents) + - [Supported languages](#supported-languages) + - [Try it](#try-it) + - [Using the library](#using-the-library) + - [Quick start](#quick-start) + - [Identifying the language](#identifying-the-language) + - [Formatting the output](#formatting-the-output) + - [The HTML formatter](#the-html-formatter) + - [More detail](#more-detail) + - [Lexers](#lexers) + - [Formatters](#formatters) + - [Styles](#styles) + - [Command-line interface](#command-line-interface) + - [Testing lexers](#testing-lexers) + - [What's missing compared to Pygments?](#whats-missing-compared-to-pygments) @@ -41,7 +42,7 @@ translators for Pygments lexers and styles. | A | ABAP, ABNF, ActionScript, ActionScript 3, Ada, Agda, AL, Alloy, Angular2, ANTLR, ApacheConf, APL, AppleScript, ArangoDB AQL, Arduino, ArmAsm, AutoHotkey, AutoIt, Awk | | B | Ballerina, Bash, Bash Session, Batchfile, BibTeX, Bicep, BlitzBasic, BNF, BQN, Brainfuck | | C | C, C#, C++, Caddyfile, Caddyfile Directives, Cap'n Proto, Cassandra CQL, Ceylon, CFEngine3, cfstatement, ChaiScript, Chapel, Cheetah, Clojure, CMake, COBOL, CoffeeScript, Common Lisp, Coq, Crystal, CSS, Cython | -| D | D, Dart, Dax, Diff, Django/Jinja, dns, Docker, DTD, Dylan | +| D | D, Dart, Dax, Desktop Entry, Diff, Django/Jinja, dns, Docker, DTD, Dylan | | E | EBNF, Elixir, Elm, EmacsLisp, Erlang | | F | Factor, Fennel, Fish, Forth, Fortran, FortranFixed, FSharp | | G | GAS, GDScript, Genshi, Genshi HTML, Genshi Text, Gherkin, GLSL, Gnuplot, Go, Go HTML Template, Go Text Template, GraphQL, Groff, Groovy | diff --git a/lexers/embedded/desktop_entry.xml b/lexers/embedded/desktop_entry.xml new file mode 100644 index 000000000..ad71ad471 --- /dev/null +++ b/lexers/embedded/desktop_entry.xml @@ -0,0 +1,17 @@ + + + Desktop file + desktop + desktop_entry + *.desktop + application/x-desktop + + + + + + + + + + \ No newline at end of file diff --git a/lexers/testdata/desktop_entry.actual b/lexers/testdata/desktop_entry.actual new file mode 100644 index 000000000..1c2a4682e --- /dev/null +++ b/lexers/testdata/desktop_entry.actual @@ -0,0 +1,8 @@ +# Created with jdDesktopEntryEdit 1.3 +[Desktop Entry] +Type=Application +Name=Chroma +Comment= A general purpose syntax highlighter in pure Go +TryExec=chroma +Exec=chroma +Terminal=true diff --git a/lexers/testdata/desktop_entry.expected b/lexers/testdata/desktop_entry.expected new file mode 100644 index 000000000..be9442ea5 --- /dev/null +++ b/lexers/testdata/desktop_entry.expected @@ -0,0 +1,31 @@ +[ + {"type":"CommentSingle","value":"# Created with jdDesktopEntryEdit 1.3"}, + {"type":"TextWhitespace","value":"\n"}, + {"type":"Keyword","value":"[Desktop Entry]"}, + {"type":"TextWhitespace","value":"\n"}, + {"type":"NameAttribute","value":"Type"}, + {"type":"Operator","value":"="}, + {"type":"LiteralString","value":"Application"}, + {"type":"TextWhitespace","value":"\n"}, + {"type":"NameAttribute","value":"Name"}, + {"type":"Operator","value":"="}, + {"type":"LiteralString","value":"Chroma"}, + {"type":"TextWhitespace","value":"\n"}, + {"type":"NameAttribute","value":"Comment"}, + {"type":"Operator","value":"="}, + {"type":"TextWhitespace","value":" "}, + {"type":"LiteralString","value":"A general purpose syntax highlighter in pure Go"}, + {"type":"TextWhitespace","value":"\n"}, + {"type":"NameAttribute","value":"TryExec"}, + {"type":"Operator","value":"="}, + {"type":"LiteralString","value":"chroma"}, + {"type":"TextWhitespace","value":"\n"}, + {"type":"NameAttribute","value":"Exec"}, + {"type":"Operator","value":"="}, + {"type":"LiteralString","value":"chroma"}, + {"type":"TextWhitespace","value":"\n"}, + {"type":"NameAttribute","value":"Terminal"}, + {"type":"Operator","value":"="}, + {"type":"LiteralString","value":"true"}, + {"type":"TextWhitespace","value":"\n"} +] From aeaaca22a6b94f7da757ccf7b379a0874747bc41 Mon Sep 17 00:00:00 2001 From: JakobDev Date: Tue, 19 Dec 2023 12:22:38 +0100 Subject: [PATCH 2/2] Fix Readme format --- README.md | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 48be226ed..c272c03ea 100644 --- a/README.md +++ b/README.md @@ -14,22 +14,21 @@ translators for Pygments lexers and styles. -- [Chroma — A general purpose syntax highlighter in pure Go](#chroma--a-general-purpose-syntax-highlighter-in-pure-go) - - [Table of Contents](#table-of-contents) - - [Supported languages](#supported-languages) - - [Try it](#try-it) - - [Using the library](#using-the-library) - - [Quick start](#quick-start) - - [Identifying the language](#identifying-the-language) - - [Formatting the output](#formatting-the-output) - - [The HTML formatter](#the-html-formatter) - - [More detail](#more-detail) - - [Lexers](#lexers) - - [Formatters](#formatters) - - [Styles](#styles) - - [Command-line interface](#command-line-interface) - - [Testing lexers](#testing-lexers) - - [What's missing compared to Pygments?](#whats-missing-compared-to-pygments) +1. [Table of Contents](#table-of-contents) +2. [Supported languages](#supported-languages) +3. [Try it](#try-it) +4. [Using the library](#using-the-library) + 1. [Quick start](#quick-start) + 2. [Identifying the language](#identifying-the-language) + 3. [Formatting the output](#formatting-the-output) + 4. [The HTML formatter](#the-html-formatter) +5. [More detail](#more-detail) + 1. [Lexers](#lexers) + 2. [Formatters](#formatters) + 3. [Styles](#styles) +6. [Command-line interface](#command-line-interface) +7. [Testing lexers](#testing-lexers) +8. [What's missing compared to Pygments?](#whats-missing-compared-to-pygments)