From 12cf076118570eebbff08c6b3090e0d4798447a1 Mon Sep 17 00:00:00 2001 From: cyfraeviolae Date: Wed, 3 Apr 2024 03:17:55 -0400 Subject: no venv --- .../site-packages/markdown_it/cli/__init__.py | 0 .../cli/__pycache__/__init__.cpython-311.pyc | Bin 199 -> 0 bytes .../cli/__pycache__/parse.cpython-311.pyc | Bin 5249 -> 0 bytes .../site-packages/markdown_it/cli/parse.py | 109 --------------------- 4 files changed, 109 deletions(-) delete mode 100644 venv/lib/python3.11/site-packages/markdown_it/cli/__init__.py delete mode 100644 venv/lib/python3.11/site-packages/markdown_it/cli/__pycache__/__init__.cpython-311.pyc delete mode 100644 venv/lib/python3.11/site-packages/markdown_it/cli/__pycache__/parse.cpython-311.pyc delete mode 100644 venv/lib/python3.11/site-packages/markdown_it/cli/parse.py (limited to 'venv/lib/python3.11/site-packages/markdown_it/cli') diff --git a/venv/lib/python3.11/site-packages/markdown_it/cli/__init__.py b/venv/lib/python3.11/site-packages/markdown_it/cli/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/venv/lib/python3.11/site-packages/markdown_it/cli/__pycache__/__init__.cpython-311.pyc b/venv/lib/python3.11/site-packages/markdown_it/cli/__pycache__/__init__.cpython-311.pyc deleted file mode 100644 index b6581dd..0000000 Binary files a/venv/lib/python3.11/site-packages/markdown_it/cli/__pycache__/__init__.cpython-311.pyc and /dev/null differ diff --git a/venv/lib/python3.11/site-packages/markdown_it/cli/__pycache__/parse.cpython-311.pyc b/venv/lib/python3.11/site-packages/markdown_it/cli/__pycache__/parse.cpython-311.pyc deleted file mode 100644 index 1f4bebc..0000000 Binary files a/venv/lib/python3.11/site-packages/markdown_it/cli/__pycache__/parse.cpython-311.pyc and /dev/null differ diff --git a/venv/lib/python3.11/site-packages/markdown_it/cli/parse.py b/venv/lib/python3.11/site-packages/markdown_it/cli/parse.py deleted file mode 100644 index 890d5de..0000000 --- a/venv/lib/python3.11/site-packages/markdown_it/cli/parse.py +++ /dev/null @@ -1,109 +0,0 @@ -#!/usr/bin/env python -""" -CLI interface to markdown-it-py - -Parse one or more markdown files, convert each to HTML, and print to stdout. -""" -from __future__ import annotations - -import argparse -from collections.abc import Iterable, Sequence -import sys - -from markdown_it import __version__ -from markdown_it.main import MarkdownIt - -version_str = "markdown-it-py [version {}]".format(__version__) - - -def main(args: Sequence[str] | None = None) -> int: - namespace = parse_args(args) - if namespace.filenames: - convert(namespace.filenames) - else: - interactive() - return 0 - - -def convert(filenames: Iterable[str]) -> None: - for filename in filenames: - convert_file(filename) - - -def convert_file(filename: str) -> None: - """ - Parse a Markdown file and dump the output to stdout. - """ - try: - with open(filename, "r", encoding="utf8", errors="ignore") as fin: - rendered = MarkdownIt().render(fin.read()) - print(rendered, end="") - except OSError: - sys.stderr.write(f'Cannot open file "{filename}".\n') - sys.exit(1) - - -def interactive() -> None: - """ - Parse user input, dump to stdout, rinse and repeat. - Python REPL style. - """ - print_heading() - contents = [] - more = False - while True: - try: - prompt, more = ("... ", True) if more else (">>> ", True) - contents.append(input(prompt) + "\n") - except EOFError: - print("\n" + MarkdownIt().render("\n".join(contents)), end="") - more = False - contents = [] - except KeyboardInterrupt: - print("\nExiting.") - break - - -def parse_args(args: Sequence[str] | None) -> argparse.Namespace: - """Parse input CLI arguments.""" - parser = argparse.ArgumentParser( - description="Parse one or more markdown files, " - "convert each to HTML, and print to stdout", - # NOTE: Remember to update README.md w/ the output of `markdown-it -h` - epilog=( - f""" -Interactive: - - $ markdown-it - markdown-it-py [version {__version__}] (interactive) - Type Ctrl-D to complete input, or Ctrl-C to exit. - >>> # Example - ... > markdown *input* - ... -

Example

-
-

markdown input

-
- -Batch: - - $ markdown-it README.md README.footer.md > index.html -""" - ), - formatter_class=argparse.RawDescriptionHelpFormatter, - ) - parser.add_argument("-v", "--version", action="version", version=version_str) - parser.add_argument( - "filenames", nargs="*", help="specify an optional list of files to convert" - ) - return parser.parse_args(args) - - -def print_heading() -> None: - print("{} (interactive)".format(version_str)) - print("Type Ctrl-D to complete input, or Ctrl-C to exit.") - - -if __name__ == "__main__": - exit_code = main(sys.argv[1:]) - sys.exit(exit_code) -- cgit v1.2.3