zsh-workers
 help / color / mirror / code / Atom feed
97f1190bea3c157b60f478724f926b40ce732913 blob 15449 bytes (raw)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
 
#compdef pandoc

# {{{ input or output formats with optional extensions
# required option: -T (input|output)
(( $+functions[_pandoc_format] )) ||
_pandoc_format() {
  local -a inout expl
  zparseopts -D -E - T:=inout
  local format=${PREFIX%%(+|-)*}
  if compset -P '*(+|-)'; then
    local pm=${IPREFIX[-1]}   # '+' or '-'
    local -a extensions=(${${$(pandoc --list-extensions=$format):#$pm*}#(+|-)})
    _wanted extensions expl 'extension' compadd -S '+' -r '-+ ' -a extensions
  else
    local -a formats=( $(pandoc --list-$inout[2]-formats) )
    _wanted formats expl 'format' compadd -S '+' -r '-+ ' -a formats
  fi
}
# }}}
# {{{ all supported formats
(( $+functions[_pandoc_all_formats] )) ||
_pandoc_all_formats(){
  local -a expl
  local -aU formats
  formats=( $(pandoc --list-input-formats) $(pandoc --list-output-formats) )
  _wanted formats expl 'format' compadd -a formats
}
# }}}
# {{{ pdf engine choice
(( $+functions[_pandoc_pdf_engine] )) ||
_pandoc_pdf_engine(){
  _alternative \
    'engines:engine:{_values "engine" pdflatex lualatex xelatex wkhtmltopdf weasyprint prince context pdfroff}' \
    'engine_files:engine:_files'
}
# }}}
# {{{ options to pass to --pdf-engine command
(( $+functions[_pandoc_pdf_engine_opts] )) ||
_pandoc_pdf_engine_opts(){
  local pdf_engine=${opt_args[--pdf-engine]}
  case ${pdf_engine} in
    "pdflatex"|"lualatex"|"xelatex"|"xetex"|"latex"|"pdftex"|"tex"|"")
      _tex
      ;;
    *)
      type _${pdf_engine} > /dev/null
      if [[ $? == 1 ]]; then
        _message "Options for ${pdf_engine}"
      fi
      ;;
  esac
}
# }}}
# {{{ data-dir specified by --data-dir option, or the default dir
_pandoc_default_dir() {
  if (( $+opt_args[--data-dir] )); then
    echo ${opt_args[--data-dir]:a}
  else
    # XXX Some versions of pandoc may output two user data directories:
    #          ~/.local/share/pandoc or ~/.pandoc
    #     Here we use only the first one.
    pandoc --version | sed -ne 's/.*[Uu]ser data directory: \([^ ]*\).*/\1/p'
  fi
}
# {{{ template file in $PWD or data-dir/templates/, or URL
(( $+functions[_pandoc_template] )) ||
_pandoc_template(){
  # find output format from '-t format' or '-o xxx.format'
  local format=${${(v)opt_args[(i)(-t|--to|-w|--write)]}%%(+|-)*}
  [[ -z $format ]] && format=${(v)opt_args[(i)(-o|--output)]:e}
  local pat="'*'"   # or '*.*' ?
  [[ -n $format ]] && pat="'*.$format'"
  local template_dir=$(_pandoc_default_dir)/templates
  _alternative \
    "local-templates:local template:_files -g $pat" \
    "data-dir-templates:template in data-dir:_files -W $template_dir -g $pat" \
    'urls: :_urls'
}
# }}}
# {{{ choose highlight-style
(( $+functions[_pandoc_highlight_style] )) ||
_pandoc_highlight_style(){
  _alternative \
    'styles:style:( $(pandoc --list-highlight-styles) )' \
    'style-files:style file:_files -g "*.theme"'
}
# }}}
# {{{ filter file in $PWD, data-dir/filters/ or $PATH
(( $+functions[_pandoc_filter] )) ||
_pandoc_filter(){
  local filters_dir=$(_pandoc_default_dir)/filters
  _alternative \
    'local-filters:local filter:_files' \
    'data-dir-filters:filter in data-dir:_files -W filters_dir' \
    'commands: : _command_names -e'
}
# }}}
# {{{ lua filter in $PWD or data-dir/filters/
(( $+functions[_pandoc_lua_filter] )) ||
_pandoc_lua_filter(){
  local filters_dir=$(_pandoc_default_dir)/filters
  _alternative \
    'local-filters:local filter:_files -g "*.lua"' \
    'data-dir-filters:filter in data-dir:_files -W filters_dir -g "*.lua"'
}
# }}}
# {{{ choose reference location
(( $+functions[_pandoc_reference_location] )) ||
_pandoc_reference_location(){
  local -a policies
  policies=(
    'block:place references at the end of the current (top-level) block'
    'section:place references at the end of the current (top-level) section'
    'document:place references at the end of the document'
  )
  _describe 'location' policies
}
# }}}
# --base-header-level must be 1-5: https://github.com/jgm/pandoc/blob/34d8ffbcfc33b86766ff7229be4d8a0d1fbffb50/src/Text/Pandoc/App.hs#L867
# {{{ choose top level division
(( $+functions[_pandoc_top_level_division] )) ||
_pandoc_top_level_division(){
  _values 'top level division' default section chapter part
}
# }}}
# {{{ choose header levels
(( $+functions[_pandoc_header_levels] )) ||
_pandoc_header_levels(){
  _values -s , "number" 1 2 3 4 5 6
}
(( $+functions[_pandoc_header_level] )) ||
_pandoc_header_level(){
  _values "number" 1 2 3 4 5 6
}
# }}}
# {{{ choose email obfusication
(( $+functions[_pandoc_email_obfusication] )) ||
_pandoc_email_obfusication(){
  local -a policies
  policies=(
    'none:(default) leaves mailto: links as they are'
    'javascript:obfuscates them using JavaScript'
    'references:obfuscates them by printing their letters as decimal or hexadecimal character references'
  )
  _describe 'obfusication' policies
}
# }}}
# {{{ choose wrapping policy
(( $+functions[_pandoc_wrap] )) ||
_pandoc_wrap() {
  local -a policies
  policies=(
    'auto:(default) wrap lines to the column width specified by --columns (default 72)'
    "none:don't wrap lines at all"
    'preserve:attempt to preserve the wrapping from the source document'
  )
  _describe 'policy' policies
}
# }}}
# {{{ choose eol policy
(( $+functions[_pandoc_eol] )) ||
_pandoc_eol() {
  local -a policies
  policies=(
    'native:line endings appropriate to the OS on which pandoc is being run'
    'crlf:windows'
    'lf:macOS/Linux/UNIX'
  )
  _describe 'policy' policies
}
# }}}
# {{{ choose changes tracking policy
(( $+functions[_pandoc_track_changes] )) ||
_pandoc_track_changes() {
  local -a policies
  policies=(
    'accept:(default) inserts all insertions, and ignores all deletions'
    'reject:inserts all deletions and ignores insertions'
    'all:puts in insertions, deletions, and comments, wrapped in spans with insertion, deletion, comment-start, and comment-end classes, respectively'
  )
  _describe 'policy' policies
}
# }}}

# The real thing
_arguments -s \
  {-f+,-r+,--from=,--read=}'[specify input format]: :_pandoc_format -T input' \
  {-t+,-w+,--to=,--write=}'[specify output format]: :_pandoc_format -T output' \
  {-o,--output=}'[write output to FILE instead of stdout]:file:_files' \
  '--data-dir=[specify the user data directory to search for pandoc data files]:data directory:_files -/' \
  '--base-header-level=[specify the base level for headers (defaults to 1)]:number:_pandoc_header_level' \
  '--strip-empty-paragraphs[deprecated. Use the +empty_paragraphs extension instead]: :' \
  '--indented-code-classes=[classes to use for indented code blocks]:class:{_message "Classes separated with ,"}' \
  '*--filter=[specify an executable to be used as a filter transforming the pandoc AST after the input is parsed and before the output is written]:file:_pandoc_filter' \
  '*--lua-filter=[transform the document in a similar fashion as JSON filters (see --filter), but use pandoc'"'"'s built-in lua filtering system]:file:_pandoc_lua_filter' \
  {-p,--preserve-tabs}'[preserve tabs instead of converting them to spaces]: :' \
  '--tab-stop=[specify the number of spaces per tab (default is 4)]:number:{_message -r "choose a number equals to or greater then 1"}' \
  '--track-changes=[specifies what to do with insertions, deletions, and comments produced by the MS Word "Track Changes" feature]: :_pandoc_track_changes' \
  '--file-scope[parse each file individually before combining for multifile documents]: :' \
  '--extract-media=[extract images and other media contained in or linked from the source document to the path DIR]:dir:{_dir_list}' \
  {-s,--standalone}'[produce output with an appropriate header and footer]: :' \
  '--template=[use FILE as a custom template for the generated document. Implies --standalone]: :_pandoc_template' \
  {\*-M,\*--metadata=}'[set the metadata field KEY to the value VALUE]:key\:value: ' \
  {\*-V,\*--variable=}'[set the variable KEY to the value VALUE]:key\:value: ' \
  '(- :)'{-D+,--print-default-template=}"[print the system default template for an output]:format:( $(pandoc --list-output-formats) )" \
  '(- :)--print-default-data-file=[print a system default data file]:file: ' \
  '(- :)--print-highlight-style=[prints a JSON version of a highlighting style]:style|file: ' \
  '--dpi=[specify the dpi (dots per inch) value for conversion from pixels to inch/centimeters and vice versa]:number: ' \
  '--eol=[manually specify line endings (crlf|lf|native)]: :_pandoc_eol' \
  '--wrap=[determine how text is wrapped in the output (the source code, not the rendered version)]: :_pandoc_wrap ' \
  '--columns=[specify length of lines in characters (default 72)]:number: ' \
  '--strip-comments[strip out HTML comments in the Markdown or Textile source]: : ' \
  {--toc,--table-of-contents}'[include an automatically generated table of contents]: : ' \
  '--toc-depth=[specify the number of section levels to include in the table of contents]:number:{_message -r "choose a number equals to or greater then 1"}' \
  '--no-highlight[disables syntax highlighting for code blocks and inlines]: : ' \
  '--highlight-style=[specifies the coloring style to be used in highlighted source code]:style|file:_pandoc_highlight_style' \
  '--syntax-definition=[load a KDE XML syntax definition file]:file:{_files -g "*.xml"}' \
  {\*-H,\*--include-in-header=}'[include contents of FILE, verbatim, at the end of the header, implies --standalone]:file:_files' \
  {\*-B,\*--include-before-body=}'[include contents of FILE, verbatim, at the beginning of the document body, implies --standalone]:file:_files' \
  {\*-A,\*--include-end-body=}'[include contents of FILE, verbatim, at the end of the document body, implies --standalone]:file:_files' \
  '--resource-path=[list of paths to search for images and other resources]:searchpath:_dir_list' \
  '--request-header=[set the request header NAME to the value VAL when making HTTP requests]:name\:val: ' \
  '--self-contained[produce a standalone HTML file with no external dependencies, using data: URIs to incorporate the contents of linked scripts, stylesheets, images, and videos. Implies --standalone]: : ' \
  '--html-q-tags[use <q> tags for quotes in HTML]: : ' \
  '--ascii[use only ASCII characters in output, supported only for HTML and DocBook output]: : ' \
  '--reference-links[use reference-style links, rather than inline links]: : ' \
  '--reference-location=[specify where footnotes (and references, if reference-links is set) are placed (block|section|document)]: :_pandoc_reference_location' \
  '--atx-headers[use ATX-style headers in Markdown and AsciiDoc output]: : ' \
  '--top-level-division=[treat top-level headers as the given division type in LaTeX, ConTeXt, DocBook, and TEI output]: :_pandoc_top_level_division' \
  {-N,--number-sections}'[number section headings in LaTeX, ConTeXt, HTML, or EPUB output]: : ' \
  '--number-offset=[offset for section headings in HTML output (ignored in other output formats)]: :_pandoc_header_levels' \
  '--listings[use the listings package for LaTeX code blocks]: : ' \
  {-i,--incremental}'[make list items in slide shows display incrementally (one by one)]: : ' \
  '--slide-level=[specifies that headers with the specified level create slides (for beamer, s5, slidy, slideous, dzslides)]: :_pandoc_header_levels' \
  '--section-divs[wrap sections in <section> tags (or <div> tags for html4)Use the section-divs package for LaTeX code blocks]: : ' \
  '--email-obfusication=[treat top-level headers as the given division type in LaTeX, ConTeXt, DocBook, and TEI output (none|javascript|references)]: :_pandoc_email_obfusication' \
  '--default-image-extension=[specify a default extension to use when image paths/URLs have no extension]:extension: ' \
  '--id-prefix=[specify a prefix to be added to all identifiers and internal links in HTML and DocBook output]:string: ' \
  {-T,--title-prefix=}'[specify STRING as a prefix at the beginning of the title that appears in the HTML header]:string: ' \
  {\*-c,\*--css=}'[link to a CSS style sheet]:url: ' \
  '--reference-doc=[use the specified file as a style reference in producing a docx or ODT file]:file: ' \
  '--epub-subdirectory=[specify the subdirectory in the OCF container that is to hold the EPUB-specific contents]:dir:{_files -/}' \
  '--epub-cover-image=[use the specified image as the EPUB cover]:file:_files' \
  '--epub-metadata=[look in the specified XML file for metadata for the EPUB]:file:{_files -g "*.xml"}' \
  '*--epub-embed-font=[embed the specified font in the EPUB]:file:_files ' \
  '--epub-chapter-level=[specify the header level at which to split the EPUB into separate "chapter" files]:number:_pandoc_header_level' \
  '--pdf-engine=[use the specified engine when producing PDF output]:program:_pandoc_pdf_engine' \
  '*--pdf-engine-opt=[use the given string as a command-line argument to the pdf-engine]:string:_pandoc_pdf_engine_opts' \
  '*--bibliography=[set the bibliography field in the document'"'"'s metadata to FILE]:file:{_files -g "*.(bib|bibtex|copac|json|yaml|enl|xml|wos|medline|mods|ris)"}' \
  '--csl=[set the csl field in the document'"'"'s metadata to FILE]:file:{_files -g "*.csl"}' \
  '--citation-abbreviations=[set the citation-abbreviations field in the document'"'"'s metadata to FILE]:file:_files' \
  '--natbib[use natbib for citations in LaTeX output]' \
  '--biblatex[use biblatex for citations in LaTeX output]' \
  '--mathml[convert TeX math to MathML (in epub3, docbook4, docbook5, jats, html4 and html5)]' \
  '--webtex=[convert TeX formulas to <img> tags that link to an external script that converts formulas to images]::url: ' \
  '--mathjax=[use MathJax to display embedded TeX math in HTML output]::url: ' \
  '--katex=[use KaTeX to display embedded TeX math in HTML output]::url: ' \
  {-m,--latexmathml=,--asciimathml=}'[deprecated. Use the LaTeXMathML script to display embedded TeX math in HTML output]::url: ' \
  '--mimetex=[deprecated. Render TeX math using the mimeTeX CGI script, which generates an image for each TeX formula]::url: ' \
  '--jsmath=[deprecated. Use jsMath (the predecessor of MathJax) to display embedded TeX math in HTML output]::url: ' \
  '--gladtex[deprecated. Enclose TeX math in <eq> tags in HTML output]: : ' \
  '--abbreviations=[specifies a custom abbreviations file]:file:_files ' \
  '--trace[enable tracing]' \
  '--dump-args[print information about command-line arguments to stdout, then exit]' \
  '--ignore-args[ignore command-line arguments (for use in wrapper scripts)]' \
  '--verbose[give verbose debugging output]' \
  '--quiet[suppress warning messages]' \
  '--fail-if-warnings[exit with error status if there are any warnings]' \
  '--log=[write log messages in machine-readable JSON format to FILE]:file:_file' \
  '(- :)--bash-completion[generate a bash completion script]' \
  '(- :)--list-input-formats[list supported input formats, one per line]' \
  '(- :)--list-output-formats[list supported output formats, one per line]' \
  '(- :)--list-extensions=[list supported extensions, one per line, preceded by a + or - indicating whether it is enabled by default in FORMAT]:format:_pandoc_all_formats' \
  '(- :)--list-highlight-languages[list supported languages for syntax highlighting, one per line]' \
  '(- :)--list-highlight-styles[list supported styles for syntax highlighting, one per line]' \
  '(- :)'{-v,--version}'[print version]' \
  '(- :)'{-h,--help}'[print help]' \
  '*:file:_files'
debug log:

solving 97f1190be ...
found 97f1190be in https://inbox.vuxu.org/zsh-workers/D46D88A2-487D-4704-8DAE-C7F1D002977E@kba.biglobe.ne.jp/
found 0c0672aaa in https://git.vuxu.org/mirror/zsh/
preparing index
index prepared:
100644 0c0672aaab85d7f9a78e6b5f988076c5ecea88bc	Completion/Unix/Command/_pandoc

applying [1/1] https://inbox.vuxu.org/zsh-workers/D46D88A2-487D-4704-8DAE-C7F1D002977E@kba.biglobe.ne.jp/
diff --git a/Completion/Unix/Command/_pandoc b/Completion/Unix/Command/_pandoc
index 0c0672aaa..97f1190be 100644

Checking patch Completion/Unix/Command/_pandoc...
Applied patch Completion/Unix/Command/_pandoc cleanly.

index at:
100644 97f1190bea3c157b60f478724f926b40ce732913	Completion/Unix/Command/_pandoc

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).