Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH 2/2] _pandoc: various simple fixes and updates
- X-seq: zsh-workers 48704
- From: "Jun. T" <takimoto-j@xxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH 2/2] _pandoc: various simple fixes and updates
- Date: Mon, 26 Apr 2021 00:05:24 +0900
- Archived-at: <https://zsh.org/workers/48704>
- List-id: <zsh-workers.zsh.org>
[5] Since option -s does not take argument,
pandoc -s <TAB>
should offer input file name, but currently nothing is offered.
This is due to an error in optspec
'-s[....]: : ' ---> should be '-s[...]'
There are many errors of this type.
[6] Add + to single letter option that take an argument:
-o[...] ---> -o+[...]
[7] Removed old options, add several new options.
---
Completion/Unix/Command/_pandoc | 120 ++++++++++++++++----------------
1 file changed, 59 insertions(+), 61 deletions(-)
diff --git a/Completion/Unix/Command/_pandoc b/Completion/Unix/Command/_pandoc
index 97f1190be..2ff481e32 100644
--- a/Completion/Unix/Command/_pandoc
+++ b/Completion/Unix/Command/_pandoc
@@ -30,8 +30,8 @@ _pandoc_all_formats(){
(( $+functions[_pandoc_pdf_engine] )) ||
_pandoc_pdf_engine(){
_alternative \
- 'engines:engine:{_values "engine" pdflatex lualatex xelatex wkhtmltopdf weasyprint prince context pdfroff}' \
- 'engine_files:engine:_files'
+ 'engines:engine:(pdflatex lualatex xelatex latexmk tectonic wkhtmltopdf weasyprint prince context pdfroff)' \
+ 'engine-executables:engine executable:_files -g "*(#q*)"'
}
# }}}
# {{{ options to pass to --pdf-engine command
@@ -43,10 +43,7 @@ _pandoc_pdf_engine_opts(){
_tex
;;
*)
- type _${pdf_engine} > /dev/null
- if [[ $? == 1 ]]; then
- _message "Options for ${pdf_engine}"
- fi
+ _message "Options for ${pdf_engine}"
;;
esac
}
@@ -104,6 +101,15 @@ _pandoc_lua_filter(){
'data-dir-filters:filter in data-dir:_files -W filters_dir -g "*.lua"'
}
# }}}
+# {{{ default file in $PWD or data-dir/defaults/
+(( $+functions[_pandoc_defaults_file] )) ||
+_pandoc_defaults_file() {
+ local defaults_dir=$(_pandoc_default_dir)/defaults
+ _alternative \
+ 'local-defaults:default file:_files -g "*.yaml"' \
+ 'data-dir-defaults:default in data-dir:_files -W defaults_dir -g "*.yaml"'
+}
+# }}}
# {{{ choose reference location
(( $+functions[_pandoc_reference_location] )) ||
_pandoc_reference_location(){
@@ -116,23 +122,12 @@ _pandoc_reference_location(){
_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(){
@@ -186,64 +181,71 @@ _pandoc_track_changes() {
_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' \
+ {-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]: :' \
+ {-d+,--defauls=}'[read default from YAMAL file]: :_pandoc_defaults_file' \
+ '--shift-heading-level-by=[shift heading levels by specified number]:positive or negative integer: ' \
+ '!--base-header-level=[(deprecated) specify the base level for headers]:number (default 1):(1 2 3 4 5)' \
+ '!--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]: :' \
+ '--default-image-extension=[specify a default extension to use when image paths/URLs have no extension]:extension: ' \
+ '--file-scope[parse each file individually before combining for multifile documents]' \
+ {\*-F+,\*--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]: :_pandoc_filter' \
+ {\*-L+,\*--lua-filter=}"[transform the document by using pandoc's built-in lua filtering system]: :_pandoc_lua_filter" \
+ {\*-M+,\*--metadata=}'[set the metadata field KEY to the value VALUE]:key\:value: ' \
+ '*--metadata_file=[read metadata from file]:YAML or JSON file:_files' \
+ {-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]: :' \
+ '--extract-media=[extract media in source document to specified directory]:directory:_files -/' \
+ '--abbreviations=[specifies a custom abbreviations file]:file:_files ' \
+ {-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) )" \
+ {\*-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' \
+ '--dpi=[specify the dpi (dots per inch) value for conversion from pixels to inch/centimeters and vice versa]:number: ' \
'--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,--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]: : ' \
+ '--strip-comments[strip out HTML comments in the Markdown or Textile source]' \
+ '--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' \
+ '(- :)--print-highlight-style=[prints a JSON version of a highlighting style]: :_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' \
+ {\*-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]: : ' \
+ '--no-check-certificate[disable the certificate verification]' \
+ '--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]: : ' \
+ '--markdown-headings[specify style for level1 and 2 headings in markdown output]:style (default atx):(setext atx)' \
+ '!--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]: : ' \
+ {-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)]:number[number,...] (default 0): ' \
+ '--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)]:slide level:(1 2 3 4 5 6)' \
+ '--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: ' \
+ {-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]: :_urls' \
'--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-subdirectory=[specify the subdirectory in the OCF container that is to hold the EPUB-specific contents]:directory:_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' \
+ '--epub-chapter-level=[specify the header level at which to split the EPUB into separate "chapter" files]:number:(1 2 3 4 5 6)' \
+ '--ipynb-output=[specify how to tread ipynb output cells]:method:(all none best)' \
'--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)"}' \
@@ -252,14 +254,10 @@ _arguments -s \
'--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 ' \
+ '--webtex=[convert TeX formulas to <img> tags that link to an external script that converts formulas to images]:: :_urls' \
+ '--mathjax=[use MathJax to display embedded TeX math in HTML output]:: :_urls' \
+ '--katex=[use KaTeX to display embedded TeX math in HTML output]:: :_urls' \
+ '--gladtex[Enclose TeX math in <eq> tags in HTML output]' \
'--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)]' \
--
2.21.1 (Apple Git-122.3)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author