Text coloring depending on the indentation

Started by Igor7, October 28, 2019, 05:19:25 AM

Previous topic - Next topic

Igor7

I wrote rules that should color the text depending on the indentation (blue, green, black, ...). A new language is called CIT (Coloured Indentation Text).

<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="syntax.xslt"?>
<XMLConfigSettings>
  <FILEINFO author="HippoEDIT.com" type="LangSpec"/>
  <SYNTAX id="cit" name="CIT" inherit="def_text" inherit_url="deftext_spec.xml">
    <STYLES>
      <Style id="1" clr="#007FFF">
        <Blocks>
          <Regexp open="^ \S" close="\n"/>
        </Blocks>
      </Style>
      <Style id="2" clr="#00FF00">
        <Blocks>
          <Regexp open="^  \S" close="\n"/>
        </Blocks>
      </Style>
      <Style id="3" clr="#000000">
        <Blocks>
          <Regexp open="^   \S" close="\n"/>
        </Blocks>
      </Style>
      ... // more colours
    </STYLES>
  </SYNTAX>
</XMLConfigSettings>

However, starting with two spaces, the text does not change color. Where is my mistake?

The problem is solved. Thank you.

<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="syntax.xslt"?>
<XMLConfigSettings>
  <FILEINFO author="HippoEDIT.com" type="LangSpec"/>
  <SYNTAX id="cit" name="CIT" inherit="def_text" inherit_url="deftext_spec.xml">
    <STYLES>
         ... // more colours
        <Style id="3" clr="#000000">
          <Blocks>
            <Regexp open="^   [^ ]" close="$"/>
          </Blocks>
        </Style>
      <Style id="2" clr="#00FF00">
        <Blocks>
          <Regexp open="^  [^ ]" close="$"/>
        </Blocks>
      </Style>
        <Style id="1" clr="#007FFF">
          <Blocks>
            <Regexp open="^ [^ ]" close="$"/>
          </Blocks>
        </Style>
    </STYLES>
  </SYNTAX>
</XMLConfigSettings>