[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Emanuele Aina's ddts.vim



Le dimanche 18 mai 2003, Lorenzo Cappelletti écrit :
> Hi Nicolas,
> 
> Emanuele Aina has improved the ddts.vim syntax highlight.  Could you 
> take a look at it?  I think it is worth including it in the next release 
> of your ddtc.
I fixed a spelling mistake (missing 'ddts' for EmailSymbol highlighting
at the end.

Here are the fix ddts.vim from Emanuele and a modified version for ddtc
use. Thanks a lot Emanuele for your work, it will be included in next
ddtc release (0.9 is already online, sorry).


BTW, has nobody done the same thing for emacs?

<flame> or maybe vim is really better that emacs ;) </flame>

Anyway, if you have something similar for emacs, I will be pleased to
add it also, let me know.


Nicolas
-- 
" Vim syntax file
" Language: DDTP server files
" Maintainer: Nicolas Bertolissio <nico.bertol@free.fr>
" Last Change: Tue, 20 May 2003 12:43:48 +0200
" 
" Modified ddts syntax from Emanuele Aina <emanuele.aina@tiscali.it> to ddtc
" Original work based on the script of Fabio Bonelli <fabiobonelli@libero.it> 
" and Nicolas Bertolissio <nico.bertol@wanadoo.fr>.


" This script check the ddts_nofolding variable to disable the folding 
" method based on the syntax regions.




" For version 5.x: clear all syntax items
" For version 6.x: quit when a syntax file was already loaded
if version < 600
   syntax clear
elseif exists("b:current_syntax")
   finish
endif


" Case-sensitive
syntax	case	match


" This matches the original description
syntax region ddtsOriginal	fold keepend transparent start=/^Description: /		 end=/\(^[^\t\ #]\)\|^$/me=e-1 contains=ddtsShortDesc,ddtsLongDesc

" This matches every localized description
syntax region ddtsTranslation	fold keepend transparent start=/^Description-[a-z][a-z]/ end=/\(^[^\t\ >]\)\|^$/me=e-1 contains=ddtsShortDesc,ddtsLongDesc

syntax match  ddtsShortDesc	/^Description\(-[a-z][a-z]\(_[A-Z][A-Z]\)\?\)\?: .*/	contained contains=ddtsDescKey,ddtsTooLong,ddtsTodo,ddtsShortError
syntax match  ddtsDescKey  	/^Description\(-[a-z][a-z]\(_[A-Z][A-Z]\)\?\)\?: /   	contained nextgroup=ddtsTooLong 

syntax region ddtsLongDesc 	fold keepend		 start=/^[\t\ #>]/		 end=/\(^[^\t\ #>]\)\|^$/me=e-1 contained contains=ddtsParag,ddtsDot


" Long descriptions are divided in paragraph
syntax region ddtsParag		fold start=/^[\t\ #][^\.]/ end=/ \.$/me=e-2 skip=/^[#>]/ contained contains=ddtsComment,ddtsDdtcComment,ddtsTooLong,ddtsError,ddtsTodo

syntax match  ddtsDot	/^\ \.$/

syntax region ddtsComment	fold start=/^#.*/  end=/^[^#]/me=e-1 contains=ddtsHeader,ddtsTranslatorComment,ddtsDiffRemoved,ddtsDiffAdded
syntax region ddtsDdtcComment	fold start=/^>>.*/ end=/^[^>]/me=e-1 contains=ddtsTranslatorComment,ddtsDiffRemoved,ddtsDiffAdded


" Diffs due to update or corrections
syntax match  ddtsDiffRemoved		/^# -.*/
syntax match  ddtsDiffAdded		/^# +.*/
syntax match  ddtsTranslatorComment	/^>>[a-z]#.*/
syntax match  ddtsTranslatorComment	/^>> .*/
syntax match  ddtsDiffRemoved		/^>>-.*/
syntax match  ddtsDiffRemoved		/^>>--.*/
syntax match  ddtsDiffAdded		/^>>+.*/
syntax match  ddtsDiffAdded		/^>>[a-z]+.*/


" Errors
syntax match  ddtsTooLong /.*/ms=s+80		contained

syntax match  ddtsError   /\t/			contained
syntax match  ddtsError   /^ \zs\.\ze.\+/	contained
syntax match  ddtsError   /\s\+$/		contained

syntax match  ddtsShortError /[. \t ]\+$/	contained
syntax match  ddtsShortError /\t/		contained


syntax match  ddtsTodo    /<\zstrans\ze>/


" Headers and commands
syntax match  ddtsHeader	/^# \(package\|translator\|ddts id\|bug number\|reviewer\): .*/		  contains=ddtsHeaderKey,ddtsHeaderArg

syntax match  ddtsHeaderKey	   /\(package\|translator\|ddts id\|bug number\|reviewer\)/	contained contains=ddtsHeaderArg
syntax match  ddtsHeaderArg	/: .*$/								contained contains=ddtsEmail

syntax match  ddtsEmail		/[_=a-z\./+A-Z0-9-]\+@[a-zA-Z0-9\./\-]\+/			contained contains=ddtsEmailSymbol
syntax match  ddtsEmail		/<.\{-}>/							contained contains=ddtsEmailSymbol
syntax match  ddtsEmailSymbol	/[<\@>]/



highlight def link ddtsDescKey		Keyword
highlight def link ddtsDot		Type
highlight def link ddtsComment		Comment
highlight def link ddtsDiffRemoved	Special
highlight def link ddtsDiffAdded	Identifier
highlight def link ddtsTooLong		Error 
highlight def link ddtsTodo		Todo
highlight def link ddtsError		Error
highlight def link ddtsShortError	Error
highlight def link ddtsHeader		Comment
highlight def link ddtsHeaderKey	Identifier
highlight def link ddtsHeaderArg	NonText  

highlight ddtsTranslatorComment ctermbg=DarkBlue ctermfg=Grey
highlight ddtsEmail 		ctermfg=DarkBlue
highlight ddtsEmailSymbol	ctermfg=DarkMagenta


if !exists("ddts_nofolding")
  set foldmethod=syntax
  1,$foldopen!
endif


let b:current_syntax = "ddts"
" Vim syntax file
" Language: DDTP server files
" Maintainer: Emanuele Aina <emanuele.aina@tiscali.it>
" Last Change: Tue, 24 Sep 2002 22:33:15 +0200
" 
" Original work based on the script of Fabio Bonelli <fabiobonelli@libero.it> 
" and Nicolas Bertolissio <nico.bertol@wanadoo.fr>.


" This script check the ddts_nofolding variable to disable the folding 
" method based on the syntax regions.




" For version 5.x: clear all syntax items
" For version 6.x: quit when a syntax file was already loaded
if version < 600
   syntax clear
elseif exists("b:current_syntax")
   finish
endif


" Case-sensitive
syntax	case	match


" This matches the original description
syntax region ddtsOriginal   fold keepend transparent start=/^Description: / end=/\(^[^\t\ #]\)\|^$/me=e-1 			contains=ddtsShortDesc,ddtsLongDesc

" This matches every localized description
syntax region ddtsTranslation fold keepend transparent start=/^Description-[a-z][a-z]/ end=/\(^[^\t\ #]\)\|^$/me=e-1 contains=ddtsShortDesc,ddtsLongDesc


syntax match  ddtsShortDesc	/^Description\(-[a-z][a-z]\(_[A-Z][A-Z]\)\?\)\?: .*/	contained contains=ddtsDescKey,ddtsDescTooLong,ddtsTodo,ddtsSpellError

syntax match  ddtsDescKey  	/^Description\(-[a-z][a-z]\(_[A-Z][A-Z]\)\?\)\?:/   	contained nextgroup=ddtsDescTooLong 

syntax region ddtsLongDesc 	fold keepend start=/^[\t\ #]/ end=/\(^[^\t\ #]\)\|^$/me=e-1		contained contains=ddtsParag,ddtsDot


" Long descriptions are divided in paragraph
syntax region ddtsParag fold start=/^[\t\ #][^\.]/ end=/ \.$/me=e-2 skip=/^#/ contained contains=ddtsComment,ddtsTooLong,ddtsError,ddtsTodo,ddtsSpellError

syntax match  ddtsDot	/^\ \.$/


syntax region ddtsComment fold start=/^#.*/ end=/^[^#]/me=e-1 contains=ddtsHeader,ddtsTooLong,ddtsTranslatorComment,ddtsDiffRemoved,ddtsDiffAdded,ddtsSect

" Translators' comments 
syntax match  ddtsTranslatorComment display 	/^##.*/ contained contains=ddtsTooLong 

" Diffs due to update or corrections
syntax match  ddtsDiffRemoved /^# -.*/
syntax match  ddtsDiffAdded   /^# +.*/



syntax match  ddtsTooLong /^\s\+\zs.*/ms=s+80          			contained
syntax match  ddtsTooLong /^#.*/ms=s+80          			contained

syntax match  ddtsDescTooLong /.*/ms=s+80          			contained



syntax match  ddtsTodo    /<\zstrans\ze>/

syntax match  ddtsError   /\t/		contained
syntax match  ddtsError   /^ \.\ze.\+/	contained


" Sections
syntax match  ddtsSect    /^# \zs\(original\|new\|old\|diff old-new\)\ze description.*/        contained
syntax match  ddtsSect    /^# \zs\(new\|old\|diff old-new\)\ze translation:.*/   contained
syntax match  ddtsSect    /^# \zsold translated\ze description:.*/       contained


" Headers and commands

syntax match  ddtsHeader    /^# \(Packages\|Translator\|ddts id\|Bug-Nr.\|reviewer\): .*/	contains=ddtsHeaderKey,ddtsHeaderArg
syntax match  ddtsHeader    /^\(From\|BTSCLOSE\): .*/      contains=ddtsHeaderKey,ddtsHeaderArg


syntax match  ddtsHeaderKey /\(From\|BTSCLOSE\|Packages\|Translator\|ddts id\|Bug-Nr.\|reviewer\):/	contained  contains=ddtsHeaderArg
syntax match  ddtsHeaderArg /: .*$/	contained contains=ddtsEmail

syntax match  ddtsEmail   /[_=a-z\./+A-Z0-9-]\+@[a-zA-Z0-9\./\-]\+/       contained contains=ddtsEmailSymbol
syntax match  ddtsEmail   /<.\{-}>/	contained contains=ddtsEmailSymbol
syntax match  ddtsEmailSymbol	/[<\@>]/



highlight def link ddtsDescKey		Keyword
highlight def link ddtsDot			Type

highlight def link ddtsComment		Comment

highlight def link ddtsDiffRemoved	Special
highlight def link ddtsDiffAdded	Identifier

highlight def link ddtsTooLong		Error 
highlight def link ddtsDescTooLong	Error

highlight def link ddtsTodo			Todo
highlight def link ddtsError		Error

highlight def link ddtsHeader		Comment
highlight def link ddtsHeaderKey	Identifier
highlight def link ddtsHeaderArg	NonText  


highlight ddtsTranslatorComment ctermbg=DarkBlue ctermfg=Grey
highlight ddtsSect  	ctermfg=Magenta
highlight ddtsEmail 	ctermfg=DarkBlue
highlight ddtsEmailSymbol	ctermfg=DarkMagenta


if !exists("ddts_nofolding")
  set foldmethod=syntax
  1,$foldopen!
endif


let b:current_syntax = "ddts"

Reply to: