Re: [textadept] Problem with modified styling for Hypertext lexer

From: mitchell <c....at.caladbolg.net>
Date: Thu, 16 Dec 2010 00:06:20 -0500 (EST)

Hi Russell,

On Wed, 15 Dec 2010, phayz wrote:

> Since I first started using Textadept I have made slight changes to
> the styles applied to Hypertext files. Specifically, the atttribute
> and entity elements deliberately have the style "style_nothing"
> applied to them. I have been changing these so that style_entity
> appears in bold and purple, and style_attribute appears in bold and
> green.
>
> I am again making these changes and I find that I can't get the
> desired effect. I make a copy of "hypertext.lua" from the TA lexers
> folder and put it into .textadept\lexers. I then modify my copy of
> hypertext.lua so that my desired styles are applied, specifically:
>
> Extract from personal hypertext.lua
>
> _tokenstyles = {
> { 'tag', l.style_tag },
> { 'element', l.style_tag },
> { 'attribute', l.style_attribute..{ bold = true } },
> { 'entity', l.style_entity..{ bold = true } },
> { 'doctype', l.style_keyword },
>
> I then check and, if necessary, edit my theme's lexer.lua so the these
> styles have the appropriate colours applied to them, specifically:
>
> Extract from my theme's lexer.lua:
>
> style_entity = style { fore = colors.purple }
> style_attribute = style { fore = colors.green }
>
> When I restart Textadept after making these changes, I open a
> Hypertext file and the visual styles are not applied at all.
>
> In trying to work out what's gone wrong, I edit my personal copy of
> hypertext.lua and change the 'attribute' styling back to its original:
>
> { 'attribute', l.style_nothing..{ bold = true } },
>
> With this change made, everything works as expected. My example
> Hypertext file (Textadept's 1_Introduction.html) is correctly styled.
> Even 'attribute' elements are styled as per my theme, in that they
> appear in bold, and 'entity' elements (for example, &amp;) also appear
> correctly in bold and purple. If I change just one part of my
> hypertext.lua file, to have 'attribute' elements appear in green, the
> original problem occurs, in that the Hypertext file doesn't have any
> styling applied to it at all. I just can't see what's going wrong.
>
> For reference I am running Textadept version 3.5 on Windows XP SP3.

Unfortunately I cannot reproduce this. Here's what I did with my clean ta
3.5:

1. Edit lexers/hypertext.lua, changing

   { 'attribute', l.style_nothing..{ bold = true } },

to

   { 'attribute', l.style_attribute..{ bold = true } },

2. Edit themes/light/lexer.lua, adding

   style_attribute = style { fore = colors.green }

after style_identifier

3. Restart ta.
4. Switch to hypertext lexer.
5. <html color="foo"></html> is colored correctly.

I know I'm not supposed to edit the lexers and themes directly, but this
was just for illustrative purposes.

mitchell
Received on Thu 16 Dec 2010 - 00:06:20 EST

This archive was generated by hypermail 2.2.0 : Thu 08 Mar 2012 - 11:57:33 EST