1# Pandoc completions written by David Sanson 2# Copyright (c) 2018 David Sanson 3# Licensed under the GNU General Public License version 2 4 5set -l informats commonmark creole docbook docx epub gfm haddock html jats json latex markdown markdown_github markdown_mmd markdown_phpextra markdown_strict mediawiki muse native odt opml org rst t2t textile tikiwiki twiki vimwiki 6set -l outformats asciidoc beamer commonmark context docbook docbook4 docbook5 docx dokuwiki dzslides epub epub2 epub3 fb2 gfm haddock html html4 html5 icml jats json latex man markdown markdown_github markdown_mmd markdown_phpextra markdown_strict mediawiki ms muse native odt opendocument opml org plain pptx revealjs rst rtf s5 slideous slidy tei texinfo textile zimwiki 7set -l highlight_styles pygments tango espresso zenburn kate monochrome breezedark haddock 8set -l datadir $HOME/.pandoc 9 10# Only suggest installed engines 11set -l pdfengines 12for engine in pdflatex lualatex xelatex wkhtmltopdf weasyprint prince context pdfroff 13 if type -q $engine 14 set pdfengines $pdfengines $engine 15 end 16end 17 18# options that take no arguments 19complete -c pandoc -s p -l preserve-tabs 20complete -c pandoc -l file-scope 21complete -c pandoc -s s -l standalone 22complete -c pandoc -l strip-comments 23complete -c pandoc -l toc -l table-of-contents 24complete -c pandoc -l no-highlight 25complete -c pandoc -l self-contained 26complete -c pandoc -l html-q-tags 27complete -c pandoc -l ascii 28complete -c pandoc -l reference-links 29complete -c pandoc -l atx-headers 30complete -c pandoc -s N -l number-sections 31complete -c pandoc -l listings 32complete -c pandoc -s i -l incremental 33complete -c pandoc -l section-divs 34complete -c pandoc -l natbib -l biblatex 35complete -c pandoc -l dump-args 36complete -c pandoc -l ignore-args 37complete -c pandoc -l verbose 38complete -c pandoc -l quiet 39complete -c pandoc -l fail-if-warnings 40complete -c pandoc -l bash-completion 41complete -c pandoc -l list-input-formats 42complete -c pandoc -l list-output-formats 43complete -c pandoc -l list-extensions 44complete -c pandoc -l list-highlight-languages 45complete -c pandoc -l list-highlight-styles 46complete -c pandoc -s v -l version 47complete -c pandoc -s h -l help 48 49# options that complete URLs 50complete -c pandoc -x -l mathml -l webtex -l mathjax -l katex 51complete -c pandoc -x -l katex-stylesheet -s m -l latexmathml 52complete -c pandoc -x -l asciimathml -l mimetex -l jsmath -l gladtex 53complete -c pandoc -x -s c -l css 54 55# options that use informats and outformats 56complete -c pandoc -x -s f -s r -l from -l read -a "$informats" 57complete -c pandoc -x -s t -s w -l to -l write -a "$outformats" 58complete -c pandoc -x -s D -l print-default-template -a "$outformats" 59 60# TODO: add support for enabling and disabling extensions using the +/- switches 61 62# options that take directories 63complete -c pandoc -x -l data-dir -a "(__fish_complete_directories (commandline -ct) "")" 64complete -c pandoc -x -l extract-media -a "(__fish_complete_directories (commandline -ct) "")" 65 66# options that take files 67complete -c pandoc -r -s o -l output 68complete -c pandoc -r -s F -l filter 69complete -c pandoc -r -l template 70complete -c pandoc -r -l syntax-definition 71complete -c pandoc -r -s H -l include-in-header 72complete -c pandoc -r -s B -l include-before-body 73complete -c pandoc -r -s A -l include-after-body 74complete -c pandoc -r -l abbreviations 75complete -c pandoc -r -l log 76complete -c pandoc -r -l epub-cover-image 77complete -c pandoc -r -l epub-metadata 78complete -c pandoc -r -l epub-embed-font 79complete -c pandoc -r -l citation-abbreviations 80 81# options that take files filtered by extension 82 83complete -c pandoc -r -f -l print-highlight-style -k -a "(__fish_complete_suffix 'theme' )" 84complete -c pandoc -r -f -l highlight_style -k -a "(__fish_complete_suffix 'theme' )" 85complete -c pandoc -r -f -l csl -k -a "(__fish_complete_suffix 'csl' )" 86complete -c pandoc -r -f -l reference-file -k -a "(__fish_complete_suffix 'odt') (__fish_complete_suffix 'docx')" 87complete -c pandoc -r -f -l bibliography -k -a "(__fish_complete_suffix 'bib')" 88complete -c pandoc -r -f -l bibliography -k -a "(__fish_complete_suffix 'bibtex')" 89complete -c pandoc -r -f -l bibliography -k -a "(__fish_complete_suffix 'copac')" 90complete -c pandoc -r -f -l bibliography -k -a "(__fish_complete_suffix 'json')" 91complete -c pandoc -r -f -l bibliography -k -a "(__fish_complete_suffix 'yaml')" 92complete -c pandoc -r -f -l bibliography -k -a "(__fish_complete_suffix 'enl')" 93complete -c pandoc -r -f -l bibliography -k -a "(__fish_complete_suffix 'xml')" 94complete -c pandoc -r -f -l bibliography -k -a "(__fish_complete_suffix 'wos')" 95complete -c pandoc -r -f -l bibliography -k -a "(__fish_complete_suffix 'medline')" 96complete -c pandoc -r -f -l bibliography -k -a "(__fish_complete_suffix 'mods')" 97complete -c pandoc -r -f -l bibliography -k -a "(__fish_complete_suffix 'ria')" 98complete -c pandoc -r -f -l lua-filter -k -a "(__fish_complete_suffix 'lua')" 99 100# options that take files in DATADIR 101complete -c pandoc -r -s F -l filter -a "(find $datadir/filters -type f 2>/dev/null | string replace -- '$datadir/filters/' '')" 102complete -c pandoc -r -l template -a "(find $datadir/templates -type f 2>/dev/null | string replace -- '$datadir/templates/' '')" 103complete -c pandoc -r -f -l lua-filter -a "(find $datadir -type f 2>/dev/null | string match -r '.lua\$' | string replace -- '$datadir/' '')" 104 105# options that require arguments which cannot be autocompleted 106complete -c pandoc -x -l indented-code-classes 107complete -c pandoc -x -s M -l metadata 108complete -c pandoc -x -s V -l variable 109complete -c pandoc -x -l dpi 110complete -c pandoc -x -l columns 111complete -c pandoc -r -l resource-path 112complete -c pandoc -x -l request-header 113complete -c pandoc -x -l number-offset 114complete -c pandoc -x -l id-prefix 115complete -c pandoc -x -s T -l title-prefix 116complete -c pandoc -x -l epub-subdirectory 117complete -c pandoc -x -l pdf-engine-opt 118 119# options that take their own arguments 120 121complete -c pandoc -x -l default-image-extension -a 'jpg png pdf svg gif' 122complete -c pandoc -x -l base-header-level -a "1 2 3 4 5" 123complete -c pandoc -x -l toc-depth -l slide-level -l epub-chapter-level -a "1 2 3 4 5 6" 124complete -c pandoc -x -l tab-stop -a "1 2 3 4 5 6 7 8" 125complete -c pandoc -x -l track-changes -a "accept reject all" 126complete -c pandoc -x -l print-default-data-file -a "reference.odt reference.docx" 127complete -c pandoc -x -l print-highlight-style -l highlight-style -a "$highlight_styles" 128complete -c pandoc -x -l eol -a "crlf lf native" 129complete -c pandoc -x -l wrap -a "auto none preserve" 130complete -c pandoc -x -l reference-location -a "block section document" 131complete -c pandoc -x -l top-level-division -a "default section chapter part" 132complete -c pandoc -x -l email-obfuscation -a "none javascript references" 133complete -c pandoc -x -l pdf-engine -a "$pdfengines" 134