AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / unix / 问题 / 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:gedit 中 groff 语言的语法高亮

  • 772

Sciancisco 和我开发了Groff标记语言的语法高亮器,用于 Gedit、Pluma、Xed 等。我安装了它/usr/share/gtksourceview-4/language-specs/groff.lang,它一直运行良好,但现在我使用的是 Debian Trixie,它不再工作了。有什么线索吗?

<?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 个回答
  • 29 Views

2 个回答

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

    介绍页面说,gedit等等,*.lang在

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

    你的 Debian 版本可能使用的是版本 5,而不是 4,因此你可以尝试将文件移动到 ~/.local/share/gtksourceview-5/language-specs/groff.lang 或 /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

    我找到了答案。

    我正在使用(Debian Trixie),并且从版本 45 开始,gedit 按照Gedit 的 Gitlab Repo中的说明Gedit 46.2使用。因此,为 Gedit 45+ 放置自定义语法高亮的正确位置是:libgedit-gtksourceview-300-0

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

    另外,请注意,我的groff语法高亮已合并到 GtkSourceView: https://gitlab.gnome.org/GNOME/gtksourceview/-/merge_requests/371

    • 1

相关问题

  • Epel Repo 已安装,但未找到所需的软件包

  • Fedora 目前缺少最新版本的 git

  • 在 Linux 上安装 lablgtk

  • VirtualBox 无法在 Fedora 26 中安装

  • 在 Debian 中编写 C#

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    模块 i915 可能缺少固件 /lib/firmware/i915/*

    • 3 个回答
  • Marko Smith

    无法获取 jessie backports 存储库

    • 4 个回答
  • Marko Smith

    如何将 GPG 私钥和公钥导出到文件

    • 4 个回答
  • Marko Smith

    我们如何运行存储在变量中的命令?

    • 5 个回答
  • Marko Smith

    如何配置 systemd-resolved 和 systemd-networkd 以使用本地 DNS 服务器来解析本地域和远程 DNS 服务器来解析远程域?

    • 3 个回答
  • Marko Smith

    dist-upgrade 后 Kali Linux 中的 apt-get update 错误 [重复]

    • 2 个回答
  • Marko Smith

    如何从 systemctl 服务日志中查看最新的 x 行

    • 5 个回答
  • Marko Smith

    Nano - 跳转到文件末尾

    • 8 个回答
  • Marko Smith

    grub 错误:你需要先加载内核

    • 4 个回答
  • Marko Smith

    如何下载软件包而不是使用 apt-get 命令安装它?

    • 7 个回答
  • Martin Hope
    user12345 无法获取 jessie backports 存储库 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl 为什么大多数 systemd 示例都包含 WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky 如何将 GPG 私钥和公钥导出到文件 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll systemctl 状态显示:“状态:降级” 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim 我们如何运行存储在变量中的命令? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S 为什么 /dev/null 是一个文件?为什么它的功能不作为一个简单的程序来实现? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 如何从 systemctl 服务日志中查看最新的 x 行 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - 跳转到文件末尾 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla 为什么真假这么大? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis 在一个巨大的(70GB)、一行、文本文件中替换字符串 2017-12-30 06:58:33 +0800 CST

热门标签

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

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve