diff options
| author | Josh Rahm <joshuarahm@gmail.com> | 2023-11-29 22:39:54 +0000 |
|---|---|---|
| committer | Josh Rahm <joshuarahm@gmail.com> | 2023-11-29 22:39:54 +0000 |
| commit | 21cb7d04c387e4198ca8098a884c78b56ffcf4c2 (patch) | |
| tree | 84fe5690df1551f0bb2bdfe1a13aacd29ebc1de7 /runtime/syntax | |
| parent | d9c904f85a23a496df4eb6be42aa43f007b22d50 (diff) | |
| parent | 4a8bf24ac690004aedf5540fa440e788459e5e34 (diff) | |
| download | rneovim-colorcolchar.tar.gz rneovim-colorcolchar.tar.bz2 rneovim-colorcolchar.zip | |
Merge remote-tracking branch 'upstream/master' into colorcolcharcolorcolchar
Diffstat (limited to 'runtime/syntax')
130 files changed, 6482 insertions, 1939 deletions
diff --git a/runtime/syntax/2html.vim b/runtime/syntax/2html.vim index ce6797deaa..5fbdad90f3 100644 --- a/runtime/syntax/2html.vim +++ b/runtime/syntax/2html.vim @@ -1,6 +1,6 @@ " Vim syntax support file " Maintainer: Ben Fritz <fritzophrenic@gmail.com> -" Last Change: 2022 Dec 26 +" Last Change: 2023 Sep 05 " " Additional contributors: " @@ -32,9 +32,9 @@ let s:end=line('$') " Font if exists("g:html_font") if type(g:html_font) == type([]) - let s:htmlfont = "'". join(g:html_font,"','") . "', monospace" + let s:htmlfont = "'".. join(g:html_font,"','") .. "', monospace" else - let s:htmlfont = "'". g:html_font . "', monospace" + let s:htmlfont = "'".. g:html_font .. "', monospace" endif else let s:htmlfont = "monospace" @@ -221,8 +221,8 @@ else endif " Find out the background and foreground color for use later -let s:fgc = s:HtmlColor(synIDattr(hlID("Normal"), "fg#", s:whatterm)) -let s:bgc = s:HtmlColor(synIDattr(hlID("Normal"), "bg#", s:whatterm)) +let s:fgc = s:HtmlColor(synIDattr(hlID("Normal")->synIDtrans(), "fg#", s:whatterm)) +let s:bgc = s:HtmlColor(synIDattr(hlID("Normal")->synIDtrans(), "bg#", s:whatterm)) if s:fgc == "" let s:fgc = ( &background == "dark" ? "#ffffff" : "#000000" ) endif @@ -234,41 +234,43 @@ if !s:settings.use_css " Return opening HTML tag for given highlight id function! s:HtmlOpening(id, extra_attrs) let a = "" - if synIDattr(a:id, "inverse") + let translated_ID = synIDtrans(a:id) + if synIDattr(translated_ID, "inverse") " For inverse, we always must set both colors (and exchange them) - let x = s:HtmlColor(synIDattr(a:id, "fg#", s:whatterm)) - let a = a . '<span '.a:extra_attrs.'style="background-color: ' . ( x != "" ? x : s:fgc ) . '">' - let x = s:HtmlColor(synIDattr(a:id, "bg#", s:whatterm)) - let a = a . '<font color="' . ( x != "" ? x : s:bgc ) . '">' + let x = s:HtmlColor(synIDattr(translated_ID, "fg#", s:whatterm)) + let a = a .. '<span '..a:extra_attrs..'style="background-color: ' .. ( x != "" ? x : s:fgc ) .. '">' + let x = s:HtmlColor(synIDattr(translated_ID, "bg#", s:whatterm)) + let a = a .. '<font color="' .. ( x != "" ? x : s:bgc ) .. '">' else - let x = s:HtmlColor(synIDattr(a:id, "bg#", s:whatterm)) + let x = s:HtmlColor(synIDattr(translated_ID, "bg#", s:whatterm)) if x != "" - let a = a . '<span '.a:extra_attrs.'style="background-color: ' . x . '">' + let a = a .. '<span '..a:extra_attrs..'style="background-color: ' .. x .. '">' elseif !empty(a:extra_attrs) - let a = a . '<span '.a:extra_attrs.'>' + let a = a .. '<span '..a:extra_attrs..'>' endif - let x = s:HtmlColor(synIDattr(a:id, "fg#", s:whatterm)) - if x != "" | let a = a . '<font color="' . x . '">' | endif + let x = s:HtmlColor(synIDattr(translated_ID, "fg#", s:whatterm)) + if x != "" | let a = a .. '<font color="' .. x .. '">' | endif endif - if synIDattr(a:id, "bold") | let a = a . "<b>" | endif - if synIDattr(a:id, "italic") | let a = a . "<i>" | endif - if synIDattr(a:id, "underline") | let a = a . "<u>" | endif + if synIDattr(translated_ID, "bold") | let a = a .. "<b>" | endif + if synIDattr(translated_ID, "italic") | let a = a .. "<i>" | endif + if synIDattr(translated_ID, "underline") | let a = a .. "<u>" | endif return a endfun " Return closing HTML tag for given highlight id function! s:HtmlClosing(id, has_extra_attrs) let a = "" - if synIDattr(a:id, "underline") | let a = a . "</u>" | endif - if synIDattr(a:id, "italic") | let a = a . "</i>" | endif - if synIDattr(a:id, "bold") | let a = a . "</b>" | endif - if synIDattr(a:id, "inverse") - let a = a . '</font></span>' + let translated_ID = synIDtrans(a:id) + if synIDattr(translated_ID, "underline") | let a = a .. "</u>" | endif + if synIDattr(translated_ID, "italic") | let a = a .. "</i>" | endif + if synIDattr(translated_ID, "bold") | let a = a .. "</b>" | endif + if synIDattr(translated_ID, "inverse") + let a = a .. '</font></span>' else - let x = s:HtmlColor(synIDattr(a:id, "fg#", s:whatterm)) - if x != "" | let a = a . '</font>' | endif - let x = s:HtmlColor(synIDattr(a:id, "bg#", s:whatterm)) - if x != "" || a:has_extra_attrs | let a = a . '</span>' | endif + let x = s:HtmlColor(synIDattr(translated_ID, "fg#", s:whatterm)) + if x != "" | let a = a .. '</font>' | endif + let x = s:HtmlColor(synIDattr(translated_ID, "bg#", s:whatterm)) + if x != "" || a:has_extra_attrs | let a = a .. '</span>' | endif endif return a endfun @@ -286,84 +288,102 @@ if s:settings.use_css " save CSS to a list of rules to add to the output at the end of processing " first, get the style names we need - let wrapperfunc_lines = [ - \ 'function! s:BuildStyleWrapper(style_id, diff_style_id, extra_attrs, text, make_unselectable, unformatted)', - \ '', - \ ' let l:style_name = synIDattr(a:style_id, "name", s:whatterm)' - \ ] + let s:wrapperfunc_lines = [] + call add(s:wrapperfunc_lines, []) + let s:wrapperfunc_lines[-1] =<< trim ENDLET + function! s:BuildStyleWrapper(style_id, diff_style_id, extra_attrs, text, make_unselecta |