AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • Início
  • system&network
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • Início
  • system&network
    • Recentes
    • Highest score
    • tags
  • Ubuntu
    • Recentes
    • Highest score
    • tags
  • Unix
    • Recentes
    • tags
  • DBA
    • Recentes
    • tags
  • Computer
    • Recentes
    • tags
  • Coding
    • Recentes
    • tags
Início / unix / Perguntas / 781938
Accepted
Daniel
Daniel
Asked: 2024-08-15 02:08:06 +0800 CST2024-08-15 02:08:06 +0800 CST 2024-08-15 02:08:06 +0800 CST

gtksourceview: destaque de sintaxe para linguagem groff no gedit

  • 772

Sciancisco e eu desenvolvemos um marcador de sintaxe para a linguagem de marcação Groff para ser usado com Gedit, Pluma, Xed etc. Instalei /usr/share/gtksourceview-4/language-specs/groff.lange sempre funcionou bem, mas agora estou usando Debian Trixie e não funciona mais. Alguma pista?

<?xml version="1.0" encoding="UTF-8"?>
<!--
COPYRIGHT:
==========
Gedit groff syntax highlight. A definition of the groff syntax for
GtkSourceView.

Copyright (C) 2022 - Daniel Dias Rodrigues. All rights reserved.
Copyright (C) 2020 - Sciancisco. All rights reserved.

This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free
Software Foundation; either version 2.1 of the License, or (at your option) any
later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along
with this library; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.

AVAILABILITY:
=============
Originally available at:
    * https://gist.github.com/nerun/6f57b9a0dd6681d3ea9a5886e418e9b9

Sciancisco's version originally available at:
    * https://gitlab.com/-/snippets/1984415
    * https://gist.github.com/Sciancisco/d1f5f1ea50481633ee1a2d270416543b

CHANGES against Sciancisco's version:
=====================================
    * <language>
        * name: the "G" of "Groff" was capitalized.
    * <metadata>
        * mimetypes and globs: completely changed based upon "All known MIME
          types" and their filename patterns, available at
          https://www.digipres.org/formats/mime-types/
    * <definitions><context>
        * comment-new and comment-old: the "." (dot) was included as part of the
          comment. Added "\.".
-->
<language id="groff" name="Groff" version="2.0" _section="Markup">

    <metadata>
        <property name="mimetypes">application/x-troff;application/x-troff-man;text/troff</property>
        <property name="globs">*.1;*.2;*.3;*.4;*.5;*.6;*.7;*.8;*.groff;*.man;*.roff</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>
software-installation
  • 2 2 respostas
  • 29 Views

2 respostas

  • Voted
  1. meuh
    2024-08-15T21:08:36+08:002024-08-15T21:08:36+08:00

    A página de introdução diz isso gedite assim por diante, procure os *.langarquivos do GtkSourceView 5 em

    ~/.local/share/gtksourceview-5/language-specs/
    /usr/share/gtksourceview-5/language-specs/
    

    Sua versão Debian pode estar usando a versão 5 em vez da 4, então você pode tentar mover seu arquivo para ~/.local/share/gtksourceview-5/language-specs/groff.lang ou /usr/share/gtksourceview-5/language-specs/groff.lang

    • 1
  2. Best Answer
    Daniel
    2024-08-15T22:14:57+08:002024-08-15T22:14:57+08:00

    Eu encontrei a resposta.

    Estou usando Gedit 46.2(Debian Trixie) e, desde a versão 45, o gedit está usando libgedit-gtksourceview-300-0conforme explicado no Gitlab Repo do Gedit . Portanto, o lugar certo para colocar um destaque de sintaxe personalizado para o Gedit 45+ é:

    /usr/share/libgedit-gtksourceview-300/language-specs

    Além disso, só para você saber, meu destaque de sintaxe groff foi mesclado com GtkSourceView: https://gitlab.gnome.org/GNOME/gtksourceview/-/merge_requests/371

    • 1

relate perguntas

  • O Epel Repo está instalado, mas os pacotes desejados não foram encontrados

  • Atualmente, o Fedora está sem a versão mais recente do git

  • Instalando o lablgtk no Linux

  • VirtualBox falhou ao instalar no Fedora 26

  • Escrevendo C# no Debian

Sidebar

Stats

  • Perguntas 205573
  • respostas 270741
  • best respostas 135370
  • utilizador 68524
  • Highest score
  • respostas
  • Marko Smith

    Possível firmware ausente /lib/firmware/i915/* para o módulo i915

    • 3 respostas
  • Marko Smith

    Falha ao buscar o repositório de backports jessie

    • 4 respostas
  • Marko Smith

    Como exportar uma chave privada GPG e uma chave pública para um arquivo

    • 4 respostas
  • Marko Smith

    Como podemos executar um comando armazenado em uma variável?

    • 5 respostas
  • Marko Smith

    Como configurar o systemd-resolved e o systemd-networkd para usar o servidor DNS local para resolver domínios locais e o servidor DNS remoto para domínios remotos?

    • 3 respostas
  • Marko Smith

    apt-get update error no Kali Linux após a atualização do dist [duplicado]

    • 2 respostas
  • Marko Smith

    Como ver as últimas linhas x do log de serviço systemctl

    • 5 respostas
  • Marko Smith

    Nano - pule para o final do arquivo

    • 8 respostas
  • Marko Smith

    erro grub: você precisa carregar o kernel primeiro

    • 4 respostas
  • Marko Smith

    Como baixar o pacote não instalá-lo com o comando apt-get?

    • 7 respostas
  • Martin Hope
    user12345 Falha ao buscar o repositório de backports jessie 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl Por que a maioria dos exemplos do systemd contém WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky Como exportar uma chave privada GPG e uma chave pública para um arquivo 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll status systemctl mostra: "Estado: degradado" 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim Como podemos executar um comando armazenado em uma variável? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S Por que /dev/null é um arquivo? Por que sua função não é implementada como um programa simples? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 Como ver as últimas linhas x do log de serviço systemctl 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - pule para o final do arquivo 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla Por que verdadeiro e falso são tão grandes? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis Substitua a string em um arquivo de texto enorme (70 GB), uma linha 2017-12-30 06:58:33 +0800 CST

Hot tag

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

  • Início
  • Perguntas
    • Recentes
    • Highest score
  • tag
  • help

Footer

AskOverflow.Dev

About Us

  • About Us
  • Contact Us

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve