[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kwrite-devel
Subject:    Re: Syntax highlighting for nroff/man
From:       Matthew Woehlke <mwoehlke () tibco ! com>
Date:       2006-10-16 14:36:58
Message-ID: eh05eb$ci6$1 () sea ! gmane ! org
[Download RAW message or body]

Andriy Lesyuk wrote:
> Matthew Woehlke wrote:
>> Hooboy... How honest do you want me to be? :-)
>>
>> Also, unless this is a roff highlighter and NOT a mandoc highlighter 
>> (which it isn't), I would suggest renaming it as a mandoc highlighter. A 
>> generic roff highlighter is a different critter.
> 
> I just want someone to look at it and to say if it can be used for 
> writing simple man pages. I was wandering why there is no man syntax 
> highlighter for kate while such highlighter exists for mc, for example. 
> That's why I decided to write such highlighter taking mc's highlighter 
> as a basis.

Yup, at some point I also wondered why there is no ROFF highlighter or 
any kind. It does seem like a curious omission.

> I used nroff only for writing simple man pages so I don't know it well. 
> I believe that my implementation applies only for mandoc. I agree that 
> it can be renamed.

Yes, I would agree that it is very mandoc-specific. I would go so far as 
to say that explicitly parsing particular heading names is 
"questionable" (maybe mc does this, but my impression of KATE 
highlighters has been "keep 'em generic").

I was actually playing with something that would let me write a 
*generic* roff highlighter and then add a mandoc highlighter on top of 
that; the result would be a MUCH cleaner highlighter with quite a bit 
more functionality (for starters, it folds .de and .di tags). Part of my 
reason for doing this is that I use roff markup in three places; man 
pages, of course, but also as a generic doc generator. In one case I am 
using only purpose-written tmac's, in the other I don't use *any* macro 
packages.

Other comments:
- Highlighting '.SH', etc, won't work, because '. SH' is equally valid 
syntax.
- You don't correctly handle '\fB\fItext\fR'. I don't think this happens 
often, but as-is you have no allowance for it. Also your handling of 
'.B', '.I', etc, is similarly off, as these are supposed to alternate 
between bold and regular style. My general opinion is that it is not 
worth trying to make KATE WYSIWYG in this manner (at least, not unless 
you want to rely on '#pop#foo' syntax) since it is very difficult to 
implement correctly.

But it looked good OK as a first revision, especially if you're copying 
someone else's highlighting. :-)

-- 
Matthew
My preferred shell is Christian. It's Bourne Again.

_______________________________________________
KWrite-Devel mailing list
KWrite-Devel@kde.org
https://mail.kde.org/mailman/listinfo/kwrite-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic