* issue#621: html highlighter * docs for issue#621 * removing windows support for issue#621 Co-authored-by: Tinmarino <tinmarino@gmail.com>
This commit is contained in:
@@ -1879,6 +1879,32 @@ function! s:convert_file(path_html, wikifile) abort
|
||||
return ''
|
||||
endif
|
||||
call vimwiki#path#mkdir(path_html)
|
||||
|
||||
if g:vimwiki_global_vars['listing_hl'] > 0 && has("unix")
|
||||
let i = 0
|
||||
while i < len(html_lines)
|
||||
if html_lines[i] =~ '^<pre .*type=.\+>'
|
||||
let type = split(split(split(html_lines[i], 'type=')[1], '>')[0], '\s\+')[0]
|
||||
let attr = split(split(html_lines[i], '<pre ')[0], '>')[0]
|
||||
let start = i + 1
|
||||
let cur = start
|
||||
|
||||
while html_lines[cur] !~ '^<\/pre>'
|
||||
let cur += 1
|
||||
endwhile
|
||||
|
||||
let tmp = ('tmp'. split(system('mktemp -p . --suffix=.' . type, 'silent'), 'tmp')[-1])[:-2]
|
||||
call system('echo ' . shellescape(join(html_lines[start:cur - 1], '\n')) . ' > ' . tmp)
|
||||
call system(g:vimwiki_global_vars['listing_hl_command'] . ' ' . tmp . ' > ' . tmp . '.html')
|
||||
let html_out = system('cat ' . tmp . '.html')
|
||||
call system('rm ' . tmp . ' ' . tmp . '.html')
|
||||
let i = cur
|
||||
let html_lines = html_lines[0:start - 1] + split(html_out, '\n') + html_lines[cur:]
|
||||
endif
|
||||
let i += 1
|
||||
endwhile
|
||||
endif
|
||||
|
||||
call writefile(html_lines, path_html.htmlfile)
|
||||
return path_html . htmlfile
|
||||
endif
|
||||
|
||||
@@ -167,6 +167,8 @@ function! s:get_default_global() abort
|
||||
\ }},
|
||||
\ 'links_header': {'type': type(''), 'default': 'Generated Links', 'min_length': 1},
|
||||
\ 'links_header_level': {'type': type(0), 'default': 1, 'min': 1, 'max': 6},
|
||||
\ 'listing_hl': {'type': type(0), 'default': 0, 'min': 0, 'max': 1},
|
||||
\ 'listing_hl_command': {'type': type(''), 'default': 'pygmentize -f html'},
|
||||
\ 'listsyms': {'type': type(''), 'default': ' .oOX', 'min_length': 2},
|
||||
\ 'listsym_rejected': {'type': type(''), 'default': '-', 'length': 1},
|
||||
\ 'map_prefix': {'type': type(''), 'default': '<Leader>w'},
|
||||
|
||||
Reference in New Issue
Block a user