Last active
August 15, 2024 16:55
-
-
Save Sciancisco/d1f5f1ea50481633ee1a2d270416543b to your computer and use it in GitHub Desktop.
Gedit groff syntax highlight
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!-- | |
Copyright (C) 2020 - Sciancisco | |
All rights reserved. | |
Redistribution and use in source and binary forms, with or without | |
modification, are permitted provided that the following conditions are met: | |
* Redistributions of source code must retain the above copyright | |
notice, this list of conditions and the following disclaimer. | |
* Redistributions in binary form must reproduce the above copyright | |
notice, this list of conditions and the following disclaimer in the | |
documentation and/or other materials provided with the distribution. | |
* Neither the name of the <organization> nor the | |
names of its contributors may be used to endorse or promote products | |
derived from this software without specific prior written permission. | |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | |
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY | |
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
--> | |
<language id="groff" name="groff" version="2.0" _section="Markup"> | |
<metadata> | |
<property name="mimetypes">test/plain</property> | |
<property name="globs">*.tmac;*.mom;*.ms;*.me;*.mm;*.1;*.2;*.3;*.4;*.5;*.6;*.7;*.8</property> | |
</metadata> | |
<styles> | |
<style id="comment" name="Comment" map-to="def:comment"/> | |
<style id="escaped-character" name="Escaped Character" map-to="def:special-char"/> | |
<style id="macro" name="Macro" map-to="def:function"/> | |
<style id="request" name="Request" map-to="def:builtin"/> | |
<style id="preprocessor" name="Preprocessor Macro" map-to="def:preprocessor"/> | |
</styles> | |
<definitions> | |
<context id="groff"> | |
<include> | |
<context id="comment-new" style-ref="comment" class="comment"> | |
<start>\\#</start> | |
<end>$</end> | |
</context> | |
<context id="comment-old" style-ref="comment" class="comment"> | |
<start>\\"</start> | |
<end>$</end> | |
</context> | |
<!-- Here starts the escape sequences mimicking the groff spec. --> | |
<!-- If one wants to implement the entire spec, have fun: https://web.cecs.pdx.edu/~trent/gnu/groff/groff.html#SEC52 --> | |
<context id="escape-bracket" style-ref="escaped-character" class="no-spell-check"> | |
<start>\\[[]</start> | |
<end>[]]</end> | |
</context> | |
<context id="escape-bracket-parameter" style-ref="escaped-character" class="no-spell-check"> | |
<start>\\.[[]</start> | |
<end>[]]</end> | |
</context> | |
<context id="escape-parenthesis" style-ref="escaped-character" class="no-spell-check"> | |
<match>\\[(]..</match> | |
</context> | |
<context id="escape-parenthesis-parameter" style-ref="escaped-character" class="no-spell-check"> | |
<match>\\.[(]..</match> | |
</context> | |
<context id="escape-simple-parameter" style-ref="escaped-character" class="no-spell-check"> | |
<match>\\..</match> | |
</context> | |
<context id="escape-simple" style-ref="escaped-character" class="no-spell-check"> | |
<match>\\.</match> | |
</context> | |
<!-- Highlight preprocessors --> | |
<!-- Maybe add preprocessor syntax coloring. --> | |
<!-- Many preprocessors are missing. --> | |
<context id="eqn" style-ref="preprocessor" class="no-spell-check"> | |
<!-- Could be nice to add in line highlight with "delim" eqn command --> | |
<start>^\.EQ(\s|$)</start> | |
<end>^\.EN</end> | |
</context> | |
<context id="pic" style-ref="preprocessor" class="no-spell-check"> | |
<start>^\.PS(\s|$)</start> | |
<end>^\.PE</end> | |
</context> | |
<context id="tbl" style-ref="preprocessor" class="no-spell-check"> | |
<start>^\.TS(\s|$)</start> | |
<end>^\.TE</end> | |
</context> | |
<context id="chem" style-ref="preprocessor" class="no-spell-check"> | |
<start>^\.cstart(\s|$)</start> | |
<end>^\.cend</end> | |
</context> | |
<context id="refer-opt" style-ref="preprocessor" class="no-spell-check"> | |
<start>^\.R1(\s|$)</start> | |
<end>^\.R2</end> | |
</context> | |
<context id="refer-cite" style-ref="preprocessor"> | |
<start>^\.[[]</start> | |
<end>^\.[]]</end> | |
</context> | |
<!-- General macro and request matching --> | |
<context id="macro" style-ref="macro" class="no-spell-check"> | |
<match>^\.[A-Z0-9_]+</match> | |
</context> | |
<context id="request" style-ref="request" class="no-spell-ckeck"> | |
<match>^\.[a-z]+</match> | |
</context> | |
</include> | |
</context> | |
</definitions> | |
</language> |
SUCCESSFULLY MERGED: https://gitlab.gnome.org/GNOME/gtksourceview/-/merge_requests/371
For Gedit 45+, it must be installed in /usr/share/libgedit-gtksourceview-300/language-specs
.
Cool!
Sorry again for not responding before...
Thank you!
<!-- If one wants to implement the entire spec, have fun: https://web.cecs.pdx.edu/~trent/gnu/groff/groff.html#SEC52 -->
That document is 30 years out of date. Up-to-date documentation can be found at groff's GNU home page.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It's all right, I already gave up anyway. But thanks for responding. Greetings.