tools: Add color to pandoc output by using elinks.
This commit is contained in:
parent
6dfd095033
commit
76df9366cb
2 changed files with 13 additions and 6 deletions
|
|
@ -392,6 +392,18 @@ def html_syntax(path):
|
||||||
return status, stderr
|
return status, stderr
|
||||||
|
|
||||||
|
|
||||||
|
@deps(deps={"pandoc", "elinks"}, url="pandoc",
|
||||||
|
executables={"pandoc", "elinks"})
|
||||||
|
def pandoc(path):
|
||||||
|
with tempfile.TemporaryDirectory() as temp_dir:
|
||||||
|
temp_path = os.path.join(temp_dir, "temp.html")
|
||||||
|
_do_command(["pandoc", "-t", "html", "-o", temp_path, path])
|
||||||
|
return _run_command(
|
||||||
|
["elinks", "-no-numbering", "-no-references",
|
||||||
|
"-dump-color-mode", "1", "-dump", temp_path],
|
||||||
|
has_color=True, success_status=Status.normal)
|
||||||
|
|
||||||
|
|
||||||
MAX_IMAGE_SIZE = 200
|
MAX_IMAGE_SIZE = 200
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ tools_for_extensions = [
|
||||||
[["bash", "sh", "dash", "ksh"], ["shellcheck"]],
|
[["bash", "sh", "dash", "ksh"], ["shellcheck"]],
|
||||||
[["wasm"], ["wasm_validate", "wasm_objdump"]],
|
[["wasm"], ["wasm_validate", "wasm_objdump"]],
|
||||||
[["pdf"], ["pdf2txt"]],
|
[["pdf"], ["pdf2txt"]],
|
||||||
[["html", "htm"], ["html_syntax", "html2text", "pandoc", "elinks"]],
|
[["html", "htm"], ["html_syntax", "html2text", "elinks"]],
|
||||||
[["yaml", "yml"], ["yamllint"]],
|
[["yaml", "yml"], ["yamllint"]],
|
||||||
[["md", "epub", "docx", "odt", "rst"], ["pandoc"]],
|
[["md", "epub", "docx", "odt", "rst"], ["pandoc"]],
|
||||||
[["zip", "jar", "apk", "egg", "whl"], ["zipinfo"]],
|
[["zip", "jar", "apk", "egg", "whl"], ["zipinfo"]],
|
||||||
|
|
@ -206,11 +206,6 @@ tools_for_extensions = [
|
||||||
command = "html2text"
|
command = "html2text"
|
||||||
success_status = "normal"
|
success_status = "normal"
|
||||||
|
|
||||||
[pandoc]
|
|
||||||
dependencies = ["pandoc"]
|
|
||||||
command = "pandoc -t plain"
|
|
||||||
success_status = "normal"
|
|
||||||
|
|
||||||
[elinks]
|
[elinks]
|
||||||
dependencies = ["elinks"]
|
dependencies = ["elinks"]
|
||||||
command = "elinks -dump-color-mode 1 -dump"
|
command = "elinks -dump-color-mode 1 -dump"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue