首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >更改添加样式的gtksourceview文件

更改添加样式的gtksourceview文件
EN

Stack Overflow用户
提问于 2016-09-29 09:37:13
回答 2查看 689关注 0票数 0

我想改变标记文件的列表标记在GEdit中显示在主题tomorrow_night-eighties.xml中的方式,这是我从https://wiki.gnome.org/Projects/GtkSourceView/StyleSchemes下载的。我知道GEdit从

代码语言:javascript
复制
/usr/share/gtksourceview-3.0/language-specs/

标记语言文件是markdown.lang。样式位于我的用户目录中:

代码语言:javascript
复制
~/.local/share/gtksourceview-2.0/styles

我所做的是:

  1. 我将:<style name="markdown:list-marker" foreground="#cc99cc" bold="true"/>添加到样式document.in用户的.local/share/....文件夹中的可用样式列表中。
  2. 我修改了语言规范: <style id="list-marker" _name="List Marker" map-to="markdown:list-marker"/><styles>...</styles>区域/标记中,以便使其可用于进一步向下引用。

我的主题被设置为tomorrow_night-eighties.xml (我在~/.local/share/gtksourceview-2.0/styles中的主题),并打开一个标记文件。更改之后,GEdit不再突出显示列表标记。

我不明白的是,错过了什么?我只更改了一个引用,引入了一个新的样式,根本没有改变正则表达式,那么为什么这样做会阻止它突出显示呢?

EN

回答 2

Stack Overflow用户

发布于 2016-09-29 13:00:27

GEdit似乎不会自动注意到这些文件中的更改,因此必须重新导入首选项中的样式,而且如果语言文件发生了更改,也必须重新启动GEdit。

票数 0
EN

Stack Overflow用户

发布于 2021-09-10 18:19:21

在创建<context>属性时,存在一个带有<language>id=标记标识符的错误,可能也适用于<style>标记。

请参阅also in stackexchange

下面的原型测试套件是在这个环境中运行的:

代码语言:javascript
复制
linuxuser@ubuntu:~$ gedit  -V
gedit - Version 3.28.1

linuxuser@ubuntu:~$ uname -a
Linux ubuntu 4.15.0-74-generic #84-Ubuntu SMP Thu Dec 19 08:06:00 UTC 2019 i686 i686 i686 GNU/Linux

linuxuser@ubuntu:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.2 LTS
Release:    18.04
Codename:   bionic

演示此故障的测试套件语言文件:

代码语言:javascript
复制
<?xml version="1.0" encoding="UTF-8"?>
<!--
 This file is part of GtkSourceView
 special mods for extended background highlighting and comments MJS aka etx 2021

id (mandatory)
Identifier for the description. 
This is used for external references and must be unique among language descriptions. 
It can contain a string of letters, digits, hyphens ("-") and underscores ("_"). NOT!!!

as follows for   id    attribute of both tags     language   &   context

empirical evidence gathered via simultaneously changing both id's to be identical

fails  reliably:    xRef
fail unreliably:    x-ref   X_-ef3
    but     aOk:    xref  xref3   x-ref3
-->
<language id="xRef"   name="C..C xref augment cpp"   version="2.0" _section="other">

  <definitions>     
    <context id="special-multiline-comment" style-ref="def:note" >   <!-- hi-liter -->
      <start>/(\*  ..  ..  ..  \*)+/</start>
      <end>\%{0@start}</end>
    </context>

    <!--Main context-->
    <context  class="no-spell-check"   id="xRef" >
      <include>

        <context ref="special-multiline-comment"/>    <!--  override MUST precede to supercede  -->

        <!-- actual language definition: editing hi lite stuff plus everything from C++ -->
        <context ref="cpp:cpp"/>

      </include>
    </context>
  </definitions>
</language>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39766729

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档