annotate runtime/compiler/pandoc.vim @ 35257:008e5022f187

runtime(i3config/swayconfig): support floating_modifier none; revert broken highlighting Commit: https://github.com/vim/vim/commit/22ac941208fcb2c63ad172c6cf0b39b077b5b682 Author: James Eapen <james.eapen@vai.org> Date: Thu May 23 20:47:49 2024 +0200 runtime(i3config/swayconfig): support floating_modifier none; revert broken highlighting - fix floating_modifier $mod normal|inverse was being hightlighted as error reverting the floating_modifier change from dd83b63 - will currently allow invalid syntax after floating_modifier fixes: #14826 closes: #14827 Co-authored-by: JosefLitos <litosjos@fit.cvut.cz> Signed-off-by: James Eapen <james.eapen@vai.org> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Thu, 23 May 2024 21:00:03 +0200
parents 5db8640e391b
children b0022c9aff0d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
34807
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Vim compiler file
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2 " Compiler: Pandoc
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 " Maintainer: Konfekt
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 "
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 " Expects output file extension, say `:make html` or `:make pdf`.
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 " Passes additional arguments to pandoc, say `:make html --self-contained`.
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 if exists("current_compiler")
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 finish
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 endif
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 let s:keepcpo = &cpo
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 set cpo&vim
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 let current_compiler = 'pandoc'
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 " As of 2024-04-08 pandoc supports the following text input formats with
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 " an ftplugin on Github:
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 let s:supported_filetypes =
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 \ [ 'bibtex', 'markdown', 'creole', 'json', 'csv', 'tsv', 'docbook',
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 \ 'xml', 'fb2', 'html', 'jira', 'tex', 'mediawiki', 'nroff', 'org',
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 \ 'rtf', 'rst', 't2t', 'textile', 'twiki', 'typst', 'vimwiki' ]
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 " .. and out of those the following are included in Vim's runtime:
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 " 'xml', 'tex', 'html', 'rst', 'json', 'nroff', 'markdown'
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 silent! function s:PandocFiletype(filetype) abort
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 let ft = a:filetype
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 if ft ==# 'pandoc'
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 return 'markdown'
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 elseif ft ==# 'tex'
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 return 'latex'
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 elseif ft ==# 'xml'
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 " Pandoc does not support XML as a generic input format, but it does support
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 " EndNote XML and Jats XML out of which the latter seems more universal.
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 return 'jats'
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 elseif ft ==# 'text' || empty(ft)
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 return 'markdown'
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 elseif index(s:supported_filetypes, &ft) >= 0
34831
ca0bfdb5d652 runtime(compiler): fix inaccuracies in pandoc compiler (#14467)
Christian Brabandt <cb@256bit.org>
parents: 34807
diff changeset
39 return ft
34807
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 else
34831
ca0bfdb5d652 runtime(compiler): fix inaccuracies in pandoc compiler (#14467)
Christian Brabandt <cb@256bit.org>
parents: 34807
diff changeset
41 echomsg 'Unsupported filetype: ' . ft . ', falling back to Markdown as input format!'
34807
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 return 'markdown'
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 endif
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 endfunction
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 execute 'CompilerSet makeprg=pandoc\ --standalone' .
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 \ '\ --metadata\ title=%:t:r:S' .
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 \ '\ --metadata\ lang=' . matchstr(&spelllang, '^\a\a') .
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 \ '\ --from=' . s:PandocFiletype(&filetype) .
34959
5db8640e391b runtime(doc): document pandoc compiler and enable configuring arguments
Christian Brabandt <cb@256bit.org>
parents: 34831
diff changeset
49 \ '\ ' . escape(get(b:, 'pandoc_compiler_args', get(g:, 'pandoc_compiler_args', '')), ' ') .
34807
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50 \ '\ --output\ %:r:S.$*\ %:S'
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 CompilerSet errorformat="%f",\ line\ %l:\ %m
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
54 let &cpo = s:keepcpo
7f709fa537df patch 9.1.0276: No pandoc syntax support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
55 unlet s:keepcpo