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

Re: [DDTP-it] ddtc 0.8.1



Lorenzo Cappelletti aggiornò:

As usual...

[...]

Un po' di tempo fa avevo fatto qulche piccola modifica qua e là ai due file di sintassi per vim e questo ne era il risultato.

Se a qualcuno interessa lo allego così ci può dare un'occhiata... :)

Si tratta di un semplice file di sintassi, ma è in grado anche di gestire correttamente il folding delle sezioni e dei commenti (i comandi zo e zc di vim).

Utile quando le descrizioni sono lunghe o ci sono commenti i mezzo.

Fatemi sapere. :)

--
Buongiorno.
Complimenti per l'ottima scelta.

" 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 scipt 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 EmailSymbol	ctermfg=DarkMagenta


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


let b:current_syntax = "ddts"

Reply to: