# Re: Problem with modified styling for Hypertext lexer

From: phayz <russelldicken....at.gmail.com>
Date: Thu, 16 Dec 2010 14:08:38 -0800 (PST)

On Dec 16, 3:06 pm, mitchell <c....at.caladbolg.net> wrote:
> 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 } },
>
>
>    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

I admit I was shocked when I read that you were editing the lexers and
themes directly! Shocked, I say! :P

Thanks for testing that. I have tested only under Windows XP so far
but will test this also under Linux. I'm sure I've had this working in
the past, so it's strange that I'm getting this behaviour now. It's
not a big problem, of course, because it just means that for one
element I don't have my desired colour displayed. When I get this
right I'll submit a patch for my suggested changes to 'hypertext.lua'.

I'll report my results back here.
Received on Thu 16 Dec 2010 - 17:08:38 EST

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