Takže, chtěl jsem si vyzkoušet přidání jazyku do Geditu. Problém ale je, že i když se v Geditu objevi mezi jazyky, tak ho Gedit sám nerozpozná z přípony souboru (.test) a ani po jeho explicitním vybrání nefunguje zvýrazňování syntaxe.
Pro jazyk jsem vytvořil
.lang soubor (test.lang) a pro nový MIME-TYPE pak XML soubor s jeho definicí (test.xml).
.lang soubor jsem umístil do
/usr/share/gtksourceview-3.0/language-specs/test.lang a vyzkoušel jsem i složku
gtksourceview-2.0.
Soubor s definicí MIME-TYPE jsem umístil do
/usr/share/mime/packages a vyzkoušel jsem i složku
/usr/share/mime/applications.
Na závěr jsem spustil příkaz
sudo update-mime-database /usr/share/mimePředem díky za všechny rady, opravdu netuším, v čem dělám chybu.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
test.lang<?xml version="1.0" encoding="UTF-8"?>
<language id="test" _name="Test" version="1.0" _section="Source">
<metadata>
<property name="mimetypes">text/x-test</property>
<property name="globs">*.test</property>
<property name="line-comment-start">//</property>
<property name="block-comment-start">/*</property>
<property name="block-comment-end">*/</property>
</metadata>
<styles>
<style id="comment" _name="Comment" map-to="def:comment"/>
<style id="keyword" _name="Keyword" map-to="def:keyword"/>
</styles>
<definitions>
<context id="if0-comment" style-ref="comment">
<start>\%{preproc-start}if\b\s*0\b</start>
<end>\%{preproc-start}(endif|else|elif)\b</end>
<include>
<context id="if-in-if0">
<start>\%{preproc-start}if(n?def)?\b</start>
<end>\%{preproc-start}endif\b</end>
<include>
<context ref="if-in-if0"/>
<context ref="def:in-comment"/>
</include>
</context>
<context ref="def:in-comment"/>
</include>
</context>
<context id="keywords" style-ref="keyword">
<keyword>hello</keyword>
<keyword>hi</keyword>
</context>
<!--Main context-->
<context id="test">
<include>
<context ref="if0-comment"/>
<context ref="keywords"/>
</include>
</context>
</definitions>
</language>test.xml<?xml version="1.0" encoding="utf-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info" >
<mime-type type="text/x-test">
<sub-class-of type="text/plain"/>
<comment xml:lang="en">TEST language document</comment>
<comment xml:lang="cs">Dokument v jazyce TEST</comment>
<glob pattern="*.test"/>
</mime-type>
</mime-info>-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Řešení:Podle
https://developer.gnome.org/gtksourceview/stable/lang-reference.html je aktuální verze, která má být uvedena v tagu
?<language> 2.0. Takže jsem tento atribut přepsal a jede to:
<language id="test" _name="Test" version="2.0" _section="Source">