From 06ecd72a6b10d9a21a58179ab7a9291dade46a50 Mon Sep 17 00:00:00 2001 From: "psyc://loupsycedyglgamf.onion/~lynX" Date: Wed, 4 Apr 1984 00:44:06 +0000 Subject: full pht syntax: html + prep --- share/vim/ftdetect/prep.vim | 7 +++--- share/vim/syntax/pht.vim | 10 ++++++++ share/vim/syntax/prep.vim | 57 ++++++++++++++++++++++++++++++--------------- 3 files changed, 52 insertions(+), 22 deletions(-) create mode 100644 share/vim/syntax/pht.vim diff --git a/share/vim/ftdetect/prep.vim b/share/vim/ftdetect/prep.vim index 4092404..b3f5b97 100644 --- a/share/vim/ftdetect/prep.vim +++ b/share/vim/ftdetect/prep.vim @@ -1,4 +1,5 @@ -au BufRead,BufNewFile *.mlm set filetype=prep +au BufRead,BufNewFile *.mlm set filetype=pht +au BufRead,BufNewFile *.pml set filetype=pht au BufRead,BufNewFile *.prep set filetype=prep -au BufRead,BufNewFile *.pht set filetype=prep -au BufRead,BufNewFile *.pml set filetype=prep +au BufRead,BufNewFile *.pht set filetype=pht +au BufRead,BufNewFile *.xht set filetype=pht diff --git a/share/vim/syntax/pht.vim b/share/vim/syntax/pht.vim new file mode 100644 index 0000000..4b9cd69 --- /dev/null +++ b/share/vim/syntax/pht.vim @@ -0,0 +1,10 @@ +" Vim syntax file +" Language: PREP-processed HTML documents, since 1993 +" Maintainer: carlo von lynX +" Latest Revision: 2016-08-25 + +" This file specifically combines PREP with HTML syntax highlighting +runtime! syntax/html.vim +unlet b:current_syntax +runtime! syntax/prep.vim + diff --git a/share/vim/syntax/prep.vim b/share/vim/syntax/prep.vim index 9044267..d801602 100644 --- a/share/vim/syntax/prep.vim +++ b/share/vim/syntax/prep.vim @@ -1,27 +1,46 @@ " Vim syntax file -" Language: PREP as used by PHT, PML, ibiza and Multilingual Markup (MLM) +" Language: PREP, the chilled multi-purpose preprocessor +" as used with HTML (PHT), Multilingual Markup (MLM) +" but also with apache config files and more. +" " Maintainer: carlo von lynX " Latest Revision: 2016-08-25 -" We may intentionally want to add upon HTML or other syntaxes! -"if exists("b:current_syntax") -" finish -"endif - -syn match mlmInline /((([a-z_]\+.*)))/ -syn match mlmComment /^# .*$/ -syn match mlmComment /^##.*$/ -syn match mlmFlag /^[A-Z]\+)/ -syn match mlmStatement /^#[a-z_]\+/ -syn match mlmFlagStatement /^[A-Z]\+)#[a-z_]\+/ - -hi def link mlmStatement PreProc -hi def link mlmFlagStatement Statement -hi def link mlmFlag Constant -hi def link mlmInline Identifier +if exists("b:current_syntax") + finish +endif + +" some variants of pht support wiki-like linking syntaxes additionally +" doesn't hurt to mark them up +syn match prepWikiLink /\[http.\+\]/ + +" the inline processing syntax of prep is pretty unique, it allows to +" embed anything anywhere and it never ended up colliding with other +" syntax +syn match prepInline /((([a-z_]\+.*)))/ + +" slightly tricky when # is both cpp-like preprocessor statement and +" comment character in all other cases +syn match prepStatement /^#[a-z_]\+/ +syn match prepComment /^# .*$/ +syn match prepComment /^##.*$/ + +" rudimentary syntax, but the only bearable way to handle multilingual +" content. have you looked at .PO or XLIFF? just terrible. +syn match prepFlag /^[A-Z]\+)/ + +" prep allows preprocessor statements depending on flags +syn match prepFlagStatement /^[A-Z]\+)#[a-z_]\+/ +syn match prepFlagStatement /^[A-Z]\+)#[a-z_]\+/ + +hi def link prepStatement PreProc +hi def link prepFlagStatement Statement +hi def link prepFlag Constant +hi def link prepInline Identifier " should be Comment, but it is not being " shown differently from regular text!? -hi def link mlmComment Type +hi def link prepComment Type +hi def link prepWikilink Constant -"let b:current_syntax = "prep" +let b:current_syntax = "prep" -- cgit v1.2.3