mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-08-18 06:55:48 +03:00
Syntax highlighting support for Gemini documents (SpartanJ/ecode#917).
This commit is contained in:
@@ -0,0 +1,91 @@
|
||||
#include <eepp/ui/doc/languages/gemini.hpp>
|
||||
#include <eepp/ui/doc/syntaxdefinitionmanager.hpp>
|
||||
|
||||
namespace EE { namespace UI { namespace Doc { namespace Language {
|
||||
|
||||
SyntaxDefinition& addGemini() {
|
||||
|
||||
return SyntaxDefinitionManager::instance()
|
||||
->add(
|
||||
|
||||
{ "Gemini",
|
||||
{ "%.gmi$" },
|
||||
{
|
||||
{ { "include", "#headings" }, "normal", "", SyntaxPatternMatchType::LuaPattern },
|
||||
{ { "include", "#links" }, "normal", "", SyntaxPatternMatchType::LuaPattern },
|
||||
{ { "include", "#quote" }, "normal", "", SyntaxPatternMatchType::LuaPattern },
|
||||
{ { "include", "#raw" }, "normal", "", SyntaxPatternMatchType::LuaPattern },
|
||||
{ { "include", "#unorderedLists" },
|
||||
"normal",
|
||||
"",
|
||||
SyntaxPatternMatchType::LuaPattern },
|
||||
|
||||
},
|
||||
{
|
||||
|
||||
},
|
||||
"",
|
||||
{}
|
||||
|
||||
} )
|
||||
.addRepositories( {
|
||||
|
||||
{ "unorderedLists",
|
||||
{
|
||||
{ { "^(\\*)[ \t]+.+\n" },
|
||||
{ "normal", "operator" },
|
||||
{},
|
||||
"",
|
||||
SyntaxPatternMatchType::RegEx },
|
||||
|
||||
} },
|
||||
{ "raw",
|
||||
{
|
||||
{ { "^```.*\n", "^```.*\n" },
|
||||
{ "normal" },
|
||||
{},
|
||||
"",
|
||||
SyntaxPatternMatchType::RegEx },
|
||||
|
||||
} },
|
||||
{ "quote",
|
||||
{
|
||||
{ { "^(>).*$" },
|
||||
{ "string", "operator" },
|
||||
{},
|
||||
"",
|
||||
SyntaxPatternMatchType::RegEx },
|
||||
|
||||
} },
|
||||
{ "links",
|
||||
{
|
||||
{ { "^=>[ \t]+([^ \t]+)(?:[ \t]+(.*))?" },
|
||||
{ "normal", "link", "string" },
|
||||
{},
|
||||
"",
|
||||
SyntaxPatternMatchType::RegEx },
|
||||
|
||||
} },
|
||||
{ "headings",
|
||||
{
|
||||
{ { "^(#)(?:[^#].*)?\n" },
|
||||
{ "keyword", "operator" },
|
||||
{},
|
||||
"",
|
||||
SyntaxPatternMatchType::RegEx },
|
||||
{ { "^(##)(?:[^#].*)?\n" },
|
||||
{ "keyword", "operator" },
|
||||
{},
|
||||
"",
|
||||
SyntaxPatternMatchType::RegEx },
|
||||
{ { "^(###)(?:[^#].*)?\n" },
|
||||
{ "keyword", "operator" },
|
||||
{},
|
||||
"",
|
||||
SyntaxPatternMatchType::RegEx },
|
||||
|
||||
} },
|
||||
} );
|
||||
}
|
||||
|
||||
}}}} // namespace EE::UI::Doc::Language
|
||||
@@ -0,0 +1,11 @@
|
||||
#ifndef EE_UI_DOC_Gemini
|
||||
#define EE_UI_DOC_Gemini
|
||||
#include <eepp/ui/doc/syntaxdefinition.hpp>
|
||||
|
||||
namespace EE { namespace UI { namespace Doc { namespace Language {
|
||||
|
||||
extern SyntaxDefinition& addGemini();
|
||||
|
||||
}}}} // namespace EE::UI::Doc::Language
|
||||
|
||||
#endif
|
||||
@@ -38,6 +38,7 @@
|
||||
#include <eepp/ui/doc/languages/freebasic.hpp>
|
||||
#include <eepp/ui/doc/languages/fstab.hpp>
|
||||
#include <eepp/ui/doc/languages/gdscript.hpp>
|
||||
#include <eepp/ui/doc/languages/gemini.hpp>
|
||||
#include <eepp/ui/doc/languages/gleam.hpp>
|
||||
#include <eepp/ui/doc/languages/glsl.hpp>
|
||||
#include <eepp/ui/doc/languages/gn.hpp>
|
||||
@@ -359,6 +360,9 @@ static void preDefinitionLangsChunk1( SyntaxDefinitionManager* sdm ) {
|
||||
{ "%.gd$" },
|
||||
} );
|
||||
|
||||
sdm->addPreDefinition(
|
||||
{ "Gemini", []() -> SyntaxDefinition& { return addGemini(); }, { "%.gmi$" } } );
|
||||
|
||||
sdm->addPreDefinition(
|
||||
{ "Gleam", []() -> SyntaxDefinition& { return addGleam(); }, { "%.gleam$" } } );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user