pax_global_header00006660000000000000000000000064146356041200014513gustar00rootroot0000000000000052 comment=a3a93a65e9b98f6c27b3fae1ea47974f3bb0860a ansi2html-1.9.2/000077500000000000000000000000001463560412000134255ustar00rootroot00000000000000ansi2html-1.9.2/.config/000077500000000000000000000000001463560412000147505ustar00rootroot00000000000000ansi2html-1.9.2/.config/requirements.txt000066400000000000000000000000001463560412000202220ustar00rootroot00000000000000ansi2html-1.9.2/.coveragerc000066400000000000000000000000761463560412000155510ustar00rootroot00000000000000[run] omit = tests/* [html] directory = coverage_html_report ansi2html-1.9.2/.flake8000066400000000000000000000001621463560412000145770ustar00rootroot00000000000000[flake8] format = pylint # E203: https://github.com/python/black/issues/315 ignore = E741,W503,W504,H,E501,E203,D ansi2html-1.9.2/.github/000077500000000000000000000000001463560412000147655ustar00rootroot00000000000000ansi2html-1.9.2/.github/CODEOWNERS000066400000000000000000000000221463560412000163520ustar00rootroot00000000000000* @ssbarnea ansi2html-1.9.2/.github/FUNDING.yml000066400000000000000000000000211463560412000165730ustar00rootroot00000000000000github: ssbarnea ansi2html-1.9.2/.github/dependabot.yml000066400000000000000000000006101463560412000176120ustar00rootroot00000000000000--- version: 2 updates: - package-ecosystem: pip directory: /.config/ schedule: day: sunday interval: weekly labels: - dependabot-deps-updates - skip-changelog versioning-strategy: lockfile-only - package-ecosystem: "github-actions" directory: "/" schedule: interval: daily labels: - "dependencies" - "skip-changelog" ansi2html-1.9.2/.github/release-drafter.yml000066400000000000000000000001111463560412000205460ustar00rootroot00000000000000--- # see https://github.com/ansible/devtools _extends: ansible/devtools ansi2html-1.9.2/.github/workflows/000077500000000000000000000000001463560412000170225ustar00rootroot00000000000000ansi2html-1.9.2/.github/workflows/ack.yml000066400000000000000000000003641463560412000203060ustar00rootroot00000000000000--- # See https://github.com/ansible/devtools/blob/main/.github/workflows/ack.yml name: ack on: pull_request_target: types: [opened, labeled, unlabeled, synchronize] jobs: ack: uses: ansible/devtools/.github/workflows/ack.yml@main ansi2html-1.9.2/.github/workflows/push.yml000066400000000000000000000003701463560412000205240ustar00rootroot00000000000000--- # See https://github.com/ansible/devtools/blob/main/.github/workflows/push.yml name: push on: push: branches: - main - "releases/**" - "stable/**" jobs: ack: uses: ansible/devtools/.github/workflows/push.yml@main ansi2html-1.9.2/.github/workflows/release.yml000066400000000000000000000017621463560412000211730ustar00rootroot00000000000000--- name: release on: release: types: [published] workflow_dispatch: jobs: pypi: name: Publish to PyPI registry environment: release runs-on: ubuntu-22.04 permissions: id-token: write env: FORCE_COLOR: 1 PY_COLORS: 1 TOXENV: pkg steps: - name: Switch to using Python 3.10 by default uses: actions/setup-python@v5 with: python-version: "3.10" - name: Install tox run: python3 -m pip install --user "tox>=4.0.0" - name: Check out src from Git uses: actions/checkout@v4 with: fetch-depth: 0 # needed by setuptools-scm submodules: true - name: Build dists run: python -m tox - name: Publish to pypi.org if: >- # "create" workflows run separately from "push" & "pull_request" github.event_name == 'release' uses: pypa/gh-action-pypi-publish@release/v1 with: password: ${{ secrets.pypi_password }} ansi2html-1.9.2/.github/workflows/tox.yml000066400000000000000000000110661463560412000203630ustar00rootroot00000000000000--- name: tox on: create: # is used for publishing to PyPI and TestPyPI tags: # any tag regardless of its name, no branches - "**" push: # only publishes pushes to the main branch to TestPyPI branches: # any integration branch but not tag - "main" pull_request: branches: - "main" release: types: - published # It seems that you can publish directly without creating schedule: - cron: 1 0 * * * # Run daily at 0:01 UTC # Run every Friday at 18:02 UTC # https://crontab.guru/#2_18_*_*_5 # - cron: 2 18 * * 5 concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} cancel-in-progress: true env: FORCE_COLOR: 1 # tox, pytest, ansible-lint PY_COLORS: 1 jobs: pre: name: pre runs-on: ubuntu-22.04 outputs: matrix: ${{ steps.generate_matrix.outputs.matrix }} steps: - name: Determine matrix id: generate_matrix uses: coactions/dynamic-matrix@v1 with: min_python: "3.7" max_python: "3.12" other_names: | lint pkg,docs platforms: linux,macos build: name: ${{ matrix.name }} runs-on: ${{ matrix.os || 'ubuntu-22.04' }} needs: pre defaults: run: shell: ${{ matrix.shell || 'bash'}} strategy: fail-fast: false matrix: ${{ fromJson(needs.pre.outputs.matrix) }} steps: - uses: actions/checkout@v4 with: fetch-depth: 0 # needed by setuptools-scm - name: Set pre-commit cache uses: actions/cache@v4 if: ${{ matrix.passed_name == 'lint' }} with: path: | ~/.cache/pre-commit key: pre-commit-${{ matrix.name || matrix.passed_name }}-${{ hashFiles('.pre-commit-config.yaml') }} - name: Set up Python ${{ matrix.python_version || '3.9' }} uses: actions/setup-python@v5 with: cache: pip python-version: ${{ matrix.python_version || '3.9' }} - name: Install tox run: | python3 -m pip install --upgrade pip python3 -m pip install --upgrade "tox>=4.0.0" - name: Log installed dists run: python3 -m pip freeze --all - name: Initialize tox envs ${{ matrix.passed_name }} run: python3 -m tox --notest --skip-missing-interpreters false -vv -e ${{ matrix.passed_name }} timeout-minutes: 5 # average is under 1, but macos can be over 3 # sequential run improves browsing experience (almost no speed impact) - name: tox -e ${{ matrix.passed_name }} run: python3 -m tox -e ${{ matrix.passed_name }} - name: Combine coverage data if: ${{ startsWith(matrix.passed_name, 'py') }} # produce a single .coverage file at repo root run: tox -e py - name: Upload coverage data if: ${{ startsWith(matrix.passed_name, 'py') }} uses: codecov/codecov-action@v4 with: name: ${{ matrix.passed_name }} fail_ci_if_error: false # see https://github.com/codecov/codecov-action/issues/598 token: ${{ secrets.CODECOV_TOKEN }} verbose: true # optional (default = false) - name: Archive logs uses: actions/upload-artifact@v4 with: name: logs.zip path: .tox/**/log/ # https://github.com/actions/upload-artifact/issues/123 continue-on-error: true - name: Report failure if git reports dirty status run: | if [[ -n $(git status -s) ]]; then # shellcheck disable=SC2016 echo -n '::error file=git-status::' printf '### Failed as git reported modified and/or untracked files\n```\n%s\n```\n' "$(git status -s)" | tee -a "$GITHUB_STEP_SUMMARY" exit 99 fi # https://github.com/actions/toolkit/issues/193 check: # This job does nothing and is only used for the branch protection if: always() permissions: pull-requests: write # allow codenotify to comment on pull-request needs: - build runs-on: ubuntu-latest steps: - name: Decide whether the needed jobs succeeded or failed uses: re-actors/alls-green@release/v1 with: jobs: ${{ toJSON(needs) }} - name: Check out src from Git uses: actions/checkout@v4 - name: Notify repository owners about lint change affecting them uses: sourcegraph/codenotify@v0.6.4 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # https://github.com/sourcegraph/codenotify/issues/19 continue-on-error: true ansi2html-1.9.2/.gitignore000066400000000000000000000002431463560412000154140ustar00rootroot00000000000000*.pyc *.swp *~ build dist *.egg* README.pdf .tox coverage_html_report .coverage docs/source/_build man/ansi2html.1.xml src/ansi2html/_version.py site _readthedocs ansi2html-1.9.2/.pre-commit-config.yaml000066400000000000000000000047531463560412000177170ustar00rootroot00000000000000--- ci: autoupdate_commit_msg: "chore: pre-commit autoupdate" autoupdate_schedule: monthly autofix_commit_msg: | chore: auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci skip: # https://github.com/pre-commit-ci/issues/issues/55 - codecov repos: - repo: https://github.com/pre-commit/mirrors-prettier # keep it before yamllint rev: v4.0.0-alpha.8 hooks: - id: prettier # Temporary excludes so we can gradually normalize the formatting exclude: > (?x)^( tests/.*.html )$ always_run: true additional_dependencies: - prettier - prettier-plugin-toml - prettier-plugin-sort-json - repo: local hooks: - id: codecov name: Check codecov.yml # https://superuser.com/a/1587813/3004 entry: > bash -c '[ $( curl --silent -o /dev/stderr -w "%{http_code}" -X POST --data-binary @codecov.yml https://codecov.io/validate ) -eq 200 ]' language: system files: "codecov.yml" pass_filenames: false - repo: https://github.com/PyCQA/isort rev: 5.13.2 hooks: - id: isort - repo: https://github.com/psf/black.git rev: 24.4.2 hooks: - id: black language_version: python3 - repo: https://github.com/pre-commit/pre-commit-hooks.git rev: v4.6.0 hooks: - id: end-of-file-fixer - id: trailing-whitespace - id: mixed-line-ending - id: fix-byte-order-marker - id: check-executables-have-shebangs - id: check-merge-conflict - id: debug-statements language_version: python3 - repo: https://github.com/PyCQA/flake8 rev: 7.0.0 hooks: - id: flake8 additional_dependencies: - pydocstyle>=6.1.1 - flake8-docstrings>=1.6.0 - flake8-absolute-import>=1.0 - flake8-black>=0.2.3 - flake8-pytest-style>=1.5.0 language_version: python3 - repo: https://github.com/pycqa/pylint rev: v3.2.2 hooks: - id: pylint - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.10.0 hooks: - id: mypy # empty args needed in order to match mypy cli behavior args: ["--strict"] additional_dependencies: - pytest - types-setuptools - types-pkg_resources - types-mock exclude: > (?x)^( docs/.*| setup.py )$ ansi2html-1.9.2/.readthedocs.yml000066400000000000000000000005071463560412000165150ustar00rootroot00000000000000--- version: 2 mkdocs: fail_on_warning: true configuration: mkdocs.yml build: os: ubuntu-22.04 tools: python: "3.11" commands: - pip install --user tox - python3 -m tox -e docs python: install: - method: pip path: tox - method: pip path: . extra_requirements: - docs ansi2html-1.9.2/LICENSE000066400000000000000000000167441463560412000144460ustar00rootroot00000000000000 GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. ansi2html-1.9.2/MANIFEST.in000066400000000000000000000002511463560412000151610ustar00rootroot00000000000000include README.rst include LICENSE include man/asciidoc.conf include man/ansi2html.1 include man/ansi2html.1.txt recursive-include tests * recursive-exclude tests *.pyc ansi2html-1.9.2/README.md000066400000000000000000000025341463560412000147100ustar00rootroot00000000000000[![Build Status - main branch](https://github.com/pycontribs/ansi2html/workflows/tox/badge.svg?branch=main)](https://github.com/pycontribs/ansi2html/actions?query=workflow%3Atox+branch%3Amain) # ansi2html Convert text with ANSI color codes to HTML or to LaTeX. Inspired by and developed off of the work of [pixelbeat](https://www.pixelbeat.org/docs/terminal_colours/) and [blackjack](https://web.archive.org/web/20100911103911/http://www.koders.com/python/fid5D57DD37184B558819D0EE22FCFD67F53078B2A3.aspx). [Read the docs](https://ansi2html.readthedocs.io/) for more informations. ## Example - Python API ```python from ansi2html import Ansi2HTMLConverter conv = Ansi2HTMLConverter() ansi = "".join(sys.stdin.readlines()) html = conv.convert(ansi) ``` ## Example - Shell Usage ```shell $ ls --color=always | ansi2html > directories.html $ sudo tail /var/log/messages | ccze -A | ansi2html > logs.html $ task rc._forcecolor:yes limit:0 burndown | ansi2html > burndown.html ``` See the list of full options with: ```shell $ ansi2html --help ``` ## Get this project: ```shell $ pip3 install ansi2html ``` Source: pypi: ## License `ansi2html` is licensed LGPLv3+. # Credits - Author: [Ralph Bean](mailto:rbean@redhat.com) - Contributor: [Robin Schneider](mailto:ypid23@aol.de) ansi2html-1.9.2/codecov.yml000066400000000000000000000002541463560412000155730ustar00rootroot00000000000000codecov: notify: wait_for_ci: true require_ci_to_pass: true comment: false coverage: status: patch: false project: default: threshold: 0.5% ansi2html-1.9.2/docs/000077500000000000000000000000001463560412000143555ustar00rootroot00000000000000ansi2html-1.9.2/docs/api.md000066400000000000000000000000621463560412000154460ustar00rootroot00000000000000# API Reference ::: ansi2html.Ansi2HTMLConverter ansi2html-1.9.2/docs/changelog.md000066400000000000000000000612361463560412000166360ustar00rootroot00000000000000--- title: Changelog --- # 1.7.0 ## Minor Changes - Replace recommendation of using system packages with pip3 ([#129](https://github.com/pycontribs/ansi2html/pull/129)) @ssbarnea - Add truecolor support ([#155](https://github.com/pycontribs/ansi2html/pull/155)) @miltolstoy - Generate documentation with Sphinx and use Read the Docs ([#141](https://github.com/pycontribs/ansi2html/pull/141)) @tristanlatr - Adds support for OSC hyperlink sequences. ([#131](https://github.com/pycontribs/ansi2html/pull/131)) @hakonhagland ## Bugfixes - Add test coverage ([#148](https://github.com/pycontribs/ansi2html/pull/148)) @ziegenberg - Replace pkg_resources with importlib.metadata ([#144](https://github.com/pycontribs/ansi2html/pull/144)) @ziegenberg - fix including of CHANGELOG.rst ([#151](https://github.com/pycontribs/ansi2html/pull/151)) @ziegenberg - Update linting dependencies ([#147](https://github.com/pycontribs/ansi2html/pull/147)) @ziegenberg - Upgrade the build process ([#145](https://github.com/pycontribs/ansi2html/pull/145)) @ziegenberg - Add type hinting ([#143](https://github.com/pycontribs/ansi2html/pull/143)) @ziegenberg - Update CI badges in readme ([#142](https://github.com/pycontribs/ansi2html/pull/142)) @ssbarnea - Bump setuptools-scm version ([#138](https://github.com/pycontribs/ansi2html/pull/138)) @ssbarnea Kudos goes to: @hakonhagland, @miltolstoy, @pre-commit-ci, @pre-commit-ci\[bot\], @ssbarnea, @tristanlatr and @ziegenberg # 1.6.0 ## Changes - Switching from nosetest to unittest ([#103](https://github.com/pycontribs/ansi2html/pull/103)) @paolostivanin - Add dracula colorscheme ([#106](https://github.com/pycontribs/ansi2html/pull/106)) @ahmubashshir - Refactor packaging by replacing old setup.py based packaging with modern pep517 based one ([#112](https://github.com/pycontribs/ansi2html/pull/112)) @ssbarnea - Replace travis with github actions ([#121](https://github.com/pycontribs/ansi2html/pull/121)) @ssbarnea ## Bugfixes - Correct author metadata ([#122](https://github.com/pycontribs/ansi2html/pull/122)) @ssbarnea ## Deprecations - Officially retire support for Python \<=3.5 ([#112](https://github.com/pycontribs/ansi2html/pull/112)) @ssbarnea # 1.5.2 ## Commits {#commits_1_5_2} - Update pypi python versions. [5688d50ae](https://github.com/pycontribs/ansi2html/commit/5688d50ae) # 1.5.1 Include manpage in release. # 1.5.0 ## Pull Requests {#pr_1_5_0} - add support for vt100 box drawing mode and high-intensity ansi codes ([#90](https://github.com/pycontribs/ansi2html/pull/90)) @p-sherratt ## Commits {#commits_1_5_0} - add support for vt100 box drawing mode and high-intensity ansi codes [bf327d216](https://github.com/pycontribs/ansi2html/commit/bf327d216) - make \'intense\' colors more \'intense\' [d9bf45f81](https://github.com/pycontribs/ansi2html/commit/d9bf45f81) - restore css ordering for unit tests [3bf89663a](https://github.com/pycontribs/ansi2html/commit/3bf89663a) - trivial fix/update [289d01595](https://github.com/pycontribs/ansi2html/commit/289d01595) - update test_produce_headers unit test [0ea0a71f7](https://github.com/pycontribs/ansi2html/commit/0ea0a71f7) - another fix/update for box drawing & high-intensity patch [ed942a5d2](https://github.com/pycontribs/ansi2html/commit/ed942a5d2) # 1.4.2 ## Commits {#commits_1_4_2} - py36 [efb491f09](https://github.com/pycontribs/ansi2html/commit/efb491f09) - Restore CSS styles for background colors. [947f813a3](https://github.com/pycontribs/ansi2html/commit/947f813a3) # 1.4.1 ## Pull Requests {#pr_1_4_1} - Fix undefined behavior with linkify when same url is repeated in same line ([#85](https://github.com/pycontribs/ansi2html/pull/85)) @qsujanadiga-practo ## Commits {#commits_1_4_1} - Update converter.py [9adc3ddef](https://github.com/pycontribs/ansi2html/commit/9adc3ddef) - Fix linkify with latex [11cb73657](https://github.com/pycontribs/ansi2html/commit/11cb73657) - Update url regex [190835f4f](https://github.com/pycontribs/ansi2html/commit/190835f4f) # 1.4.0 ## Pull Requests {#pr_1_4_0} - Prune CSS classes from output that are not used ([#84](https://github.com/pycontribs/ansi2html/pull/84)) @cfstras ## Commits {#commits_1_4_0} - Prune CSS classes from output that are not used [61f4b5368](https://github.com/pycontribs/ansi2html/commit/61f4b5368) - fix tests: remove unused CSS [753220215](https://github.com/pycontribs/ansi2html/commit/753220215) # 1.3.0 **Relicensed to LGPLv3+**. ## Pull Requests {#pr_1_3_0} - Relicensed to LGPLv3+ ([#80](https://github.com/pycontribs/ansi2html/pull/80)) @ralphbean ## Commits {#commits_1_3_0} - Relicensed to LGPLv3+ [f74316174](https://github.com/pycontribs/ansi2html/commit/f74316174) # 1.2.0 ## Pull Requests {#pr_1_2_0} - enable python 3 input decoding ([#64](https://github.com/pycontribs/ansi2html/pull/64)) @kaspar030 - Fix handling cursor move up with unique and empty lines ([#67](https://github.com/pycontribs/ansi2html/pull/67)) @gberaudo - Give more useful TaskWarrior example ([#68](https://github.com/pycontribs/ansi2html/pull/68)) @AloisMahdal - Update style.py ([#69](https://github.com/pycontribs/ansi2html/pull/69)) @karjaneth - Revert \"six is called six, not python-six\" ([#73](https://github.com/pycontribs/ansi2html/pull/73)) @JensTimmerman ## Commits {#commits_1_2_0} - enable python 3 input decoding [d6e4bc0aa](https://github.com/pycontribs/ansi2html/commit/d6e4bc0aa) - Fix handling cursor move up with unique and empty lines [1e6a3b81f](https://github.com/pycontribs/ansi2html/commit/1e6a3b81f) - Give more useful TaskWarrior example [46e480143](https://github.com/pycontribs/ansi2html/commit/46e480143) - Update style.py [0c975b60b](https://github.com/pycontribs/ansi2html/commit/0c975b60b) - Revert \"six is called six, not python-six\" [168805a00](https://github.com/pycontribs/ansi2html/commit/168805a00) - Tox for tests. [90c8c2303](https://github.com/pycontribs/ansi2html/commit/90c8c2303) - Merge branch \'develop\' of github.com:ralphbean/ansi2html into develop [1366309e1](https://github.com/pycontribs/ansi2html/commit/1366309e1) # 1.1.1 ## Pull Requests {#pr_1_1_1} - six is called six, not python-six ([#61](https://github.com/pycontribs/ansi2html/pull/61)) @JensTimmerman ## Commits {#commits_1_1_1} - Drop 2.6 [81bb739b1](https://github.com/pycontribs/ansi2html/commit/81bb739b1) - six is called six, not python-six [cec1dd933](https://github.com/pycontribs/ansi2html/commit/cec1dd933) - Exclude .pyc files from the release tarball. [0dfd66b0b](https://github.com/pycontribs/ansi2html/commit/0dfd66b0b) - Remove CHANGELOG header. [7b8643066](https://github.com/pycontribs/ansi2html/commit/7b8643066) # 1.1.0 - 1.0.4 [96b6f19ae](https://github.com/pycontribs/ansi2html/commit/96b6f19ae99a239051cd52c8edd7980d791736e9) - 1.0.4 [b7e6e048c](https://github.com/pycontribs/ansi2html/commit/b7e6e048cc78324849c2af93d4948f6bc696ff09) - 1.0.5 [f9cab7af7](https://github.com/pycontribs/ansi2html/commit/f9cab7af7483969d73e3696e988945cc797e5149) - 1.0.9 [1594cddb7](https://github.com/pycontribs/ansi2html/commit/1594cddb714890ee7878150da679c89373f8846b) # 1.0.8 - added setup.cfg file [547bd1cb5](https://github.com/pycontribs/ansi2html/commit/547bd1cb5e5e65ab674d3cd489af872213f60051) - Merge branch \'develop\' of github.com:ralphbean/ansi2html into develop [352d14be6](https://github.com/pycontribs/ansi2html/commit/352d14be694c0bfb10119c00639f319697587c26) - changed setup.cfg to work on python 2.6.6 [7a12a92ed](https://github.com/pycontribs/ansi2html/commit/7a12a92edf1747e64b28cb41c7e0f11787d7774e) - actually, python 2.6.6 on RH, centos etc has OrderedDict [512377d63](https://github.com/pycontribs/ansi2html/commit/512377d63f7ecfb583530121330d9a0552a24e78) - Merge pull request #55 from JensTimmerman/develop [03c3e680c](https://github.com/pycontribs/ansi2html/commit/03c3e680c90ca77c24ee465213a88f3726caf5bf) - Prevent IndexError while handling CursorMoveUp [7a91200df](https://github.com/pycontribs/ansi2html/commit/7a91200df0d6f088b0ba947420d8829bf04caecd) - Merge pull request #56 from lqez/fix/over-cursormoveup [a23772b57](https://github.com/pycontribs/ansi2html/commit/a23772b57d584676792cbcdb74266c361a831f61) - style: Include all 16 solarized colors in the scheme [081c9a741](https://github.com/pycontribs/ansi2html/commit/081c9a741d1b0f09d8ab9c66dc9647bb882142c2) - style: Encode pallete in 256 color encoding [acaa92ff2](https://github.com/pycontribs/ansi2html/commit/acaa92ff2370d7ebda85ee68a47bfdb7d309a811) - Merge pull request #57 from tbabej/develop [e1bd92d3e](https://github.com/pycontribs/ansi2html/commit/e1bd92d3e735d5143a81836ca6eb5e6d597bd987) - Update travis config. [74c4f1dc8](https://github.com/pycontribs/ansi2html/commit/74c4f1dc8b6c3ca41dd9dee284922c88f5934d10) - Fix existing test suite. [eb7798cb7](https://github.com/pycontribs/ansi2html/commit/eb7798cb7704465f242e97149d7483074f4d6226) - Fill out color palettes that were under-specified. [5e55018eb](https://github.com/pycontribs/ansi2html/commit/5e55018eb331e2d934215821e874e30eab20e6ef) - Merge branch \'feature/fixes\' into develop [100be7c2d](https://github.com/pycontribs/ansi2html/commit/100be7c2d83d40d10b161d3def9b8e2b56e49b32) - Fix line height stuff. [db1ee5b47](https://github.com/pycontribs/ansi2html/commit/db1ee5b47c0495ebb6bffb39c17891fe25dcd8d7) - Fix tests for the new palette values. [e8c6b9362](https://github.com/pycontribs/ansi2html/commit/e8c6b9362287033c6d9296d61f8940aaae8703a4) # 1.0.7 - Implemented LaTeX support. Only colors are supported but it does already what I need. [caa8c6fe5](https://github.com/pycontribs/ansi2html/commit/caa8c6fe5010c3d912aac47ce1e6e3aeaddfaa17) - Updated README.rst. [4979c1409](https://github.com/pycontribs/ansi2html/commit/4979c14091e43ee1090dc2399e04f57e8d60db95) - Added first test for LaTeX output. [4b80d41e0](https://github.com/pycontribs/ansi2html/commit/4b80d41e0bd1f7bc4dd73df82cc67acb6917d4e9) - Added title and linkify for LaTeX. [3a869bce1](https://github.com/pycontribs/ansi2html/commit/3a869bce19a6ad0c219d1c5f524e9c7b9784f978) - Trying to fix . [a0a06b41c](https://github.com/pycontribs/ansi2html/commit/a0a06b41cc7fe10e5241954fc03438c41a16a338) - Fixed unicode escape problem. Fixes . [095eca5a5](https://github.com/pycontribs/ansi2html/commit/095eca5a5731ce45a1a4cbf77e3cdfdf2e6716cb) - Sure % has a special meaning ... [2324a3dcf](https://github.com/pycontribs/ansi2html/commit/2324a3dcfe5b9896d0e93aec4b9de4202894eb73) - Merge pull request #48 from ypid/ansi2latex [91e174cfd](https://github.com/pycontribs/ansi2html/commit/91e174cfd207c2fa273153ba11275459c3a5a1a2) - set pre\'s id to \"content\" [6f14bc202](https://github.com/pycontribs/ansi2html/commit/6f14bc202afa20379cdc3b5c15819119ea8b524f) - the css [418bef2f0](https://github.com/pycontribs/ansi2html/commit/418bef2f03dd36e7ad0dac663db0e917879d3dee) - Merge pull request #50 from szepeviktor/patch-2 [97977e53b](https://github.com/pycontribs/ansi2html/commit/97977e53b4c85738be603c7f236958f95aacf1f9) - Merge pull request #52 from szepeviktor/patch-3 [620fc1032](https://github.com/pycontribs/ansi2html/commit/620fc1032af177406b17facfa20093b85772a2c5) - Use the data_files that we build above. [654bc30b4](https://github.com/pycontribs/ansi2html/commit/654bc30b40d89acdec91a194ff8651a6db86f812) # 1.0.6 - 1.0.5 [f9cab7af7](https://github.com/pycontribs/ansi2html/commit/f9cab7af7483969d73e3696e988945cc797e5149) - use optparse choices to deal with invalid scheme selection. [214d73609](https://github.com/pycontribs/ansi2html/commit/214d73609ff0e0dd645778dbbc0392cd340f8df5) - added solarized and os X terminal color schemes [2176bc4d0](https://github.com/pycontribs/ansi2html/commit/2176bc4d050f52b69dd9227e29508a9dfd2e1b0a) - Merge pull request #41 from schettino72/more-schemes [609326371](https://github.com/pycontribs/ansi2html/commit/609326371e74c8f19c4185f76a64e24f54d6cfbf) - Revert \"Conditionally install man page into system or virtualenv. For #39.\" [c1ee2bac9](https://github.com/pycontribs/ansi2html/commit/c1ee2bac9bf66944cce387a4f1a534a408966d6a) - Install man page to \${PREFIX}, not /usr (issue #39) [86abc9e3d](https://github.com/pycontribs/ansi2html/commit/86abc9e3dd8769af848a93ac2afc3728688554b3) - Merge pull request #42 from hartwork/issue-39 [e81c55b38](https://github.com/pycontribs/ansi2html/commit/e81c55b38b3368ceb05842823f980320607ed6db) - add empty title element to head section in html output [c16fe680b](https://github.com/pycontribs/ansi2html/commit/c16fe680b18fa5c880ae8ed71fab3b062c2a371a) - Merge pull request #43 from CBke/develop [c13f4a985](https://github.com/pycontribs/ansi2html/commit/c13f4a9852785fc4c68d416747923b2f6653faca) - 1.0.4 [40526f43a](https://github.com/pycontribs/ansi2html/commit/40526f43a009c85fddc0ab34de51e9eb94883e1c) - 1.0.5 [e6a150e9d](https://github.com/pycontribs/ansi2html/commit/e6a150e9dd00f607ad32377878e36e2783cba784) - Fix tests for added title. [aab8348ce](https://github.com/pycontribs/ansi2html/commit/aab8348ced14e747178772b49e0a796effeec974) - add option \--title for filling in the title [007e77c50](https://github.com/pycontribs/ansi2html/commit/007e77c507cd9bc8465caa46fc47abbd66d5c313) - Merge pull request #44 from CBke/develop [4fd918e54](https://github.com/pycontribs/ansi2html/commit/4fd918e54e62d2658f3fdedc5347070de96ddcff) - Drop manpage installation stuff. [a2f157614](https://github.com/pycontribs/ansi2html/commit/a2f157614243e70d0134818ef1c37b1b780339d5) # 1.0.5 - added support to select a color-scheme. added schemes \'xterm\' and \'xterm-bright\' [367289a86](https://github.com/pycontribs/ansi2html/commit/367289a86bb81f0c22801b6db7b63cc8acdec300) - Merge pull request #40 from schettino72/color-schemes [1111aec78](https://github.com/pycontribs/ansi2html/commit/1111aec7863584c1153438e89833f53be29fa249) - 1.0.4 [96b6f19ae](https://github.com/pycontribs/ansi2html/commit/96b6f19ae99a239051cd52c8edd7980d791736e9) - 1.0.4 [b7e6e048c](https://github.com/pycontribs/ansi2html/commit/b7e6e048cc78324849c2af93d4948f6bc696ff09) # 1.0.4 # 1.0.3 - Makefile: Fix regression where version bumps would not force a rebuild of the man page [750fe09fe](https://github.com/pycontribs/ansi2html/commit/750fe09feccf600ee19d5842649a9b9cd6965510) - Makefile: Mark target upload as phony [ac3877f57](https://github.com/pycontribs/ansi2html/commit/ac3877f5728281ed2df792767ad18e6283001615) - Merge pull request #38 from hartwork/dependency-regression [10b6051a4](https://github.com/pycontribs/ansi2html/commit/10b6051a4bd207064a77b5f28be7e6954c028d8b) - Conditionally install man page into system or virtualenv. For #39. [720ac2f93](https://github.com/pycontribs/ansi2html/commit/720ac2f93e6dfb1c77520dc5f7aeab4f031dfd75) # 1.0.2 - Add an upload command to the Makefile. [12e68427c](https://github.com/pycontribs/ansi2html/commit/12e68427c8dc4255bb4da8ccd8024c2b742be8e8) - Tweak travis setup. [07a95ef6e](https://github.com/pycontribs/ansi2html/commit/07a95ef6e5d0c6afc5ee53fa5ce6f9c5bc3a2bab) - Remove a forgotten import. [756139724](https://github.com/pycontribs/ansi2html/commit/75613972499b6ee18326bdd2989e5411ad475ce9) # 1.0.1 - Change the way we store version info. [4e4eaef33](https://github.com/pycontribs/ansi2html/commit/4e4eaef33d27aea931b57c3eee61ec16cc47cf87) # 1.0.0 - Add trove for py3.3. [683f672fa](https://github.com/pycontribs/ansi2html/commit/683f672fa6071cc7390b6c64858127fe0b1e2e77) - Stop adding unwanted spaces (issue 26) [b5163a80f](https://github.com/pycontribs/ansi2html/commit/b5163a80feea7f6ba8879357524ccbe143e68281) - Add test for issue 25 [6df79eb8b](https://github.com/pycontribs/ansi2html/commit/6df79eb8b95b2c36e7395bedcd13e0facb323434) - Fix destructive reset marker handling (issue 25) [4db97b126](https://github.com/pycontribs/ansi2html/commit/4db97b126c600d30a922ab5899faa8879f699739) - Fix ANSI code decoding (issue 25) [f277f8f3c](https://github.com/pycontribs/ansi2html/commit/f277f8f3c4eaa1256c5df66238583b5a69882456) - Fix writing to sys.stdout.buffer [7a3267d53](https://github.com/pycontribs/ansi2html/commit/7a3267d53a2ea61a0af6021faedf154ba89b2f87) - Add convenience Makefile [8d3f3e055](https://github.com/pycontribs/ansi2html/commit/8d3f3e055e679bf723d6a846fbff2c95a7224b9a) - Merge pull request #30 from hartwork/makefile [156bc89da](https://github.com/pycontribs/ansi2html/commit/156bc89da97c7de19b2beb8e2de7bde2f2535a20) - Merge pull request #29 from hartwork/issue_29 [8495723ae](https://github.com/pycontribs/ansi2html/commit/8495723ae8e057248537a53f9e7e800547d6640e) - Merge pull request #27 from hartwork/issue_26 [74d237c18](https://github.com/pycontribs/ansi2html/commit/74d237c18165625bedde85e25f1eb988f0da8ca1) - Merge pull request #28 from hartwork/issue_25 [8c77f6d93](https://github.com/pycontribs/ansi2html/commit/8c77f6d93754c03fc256754de73b8b2bf1d6c08c) - Fix italic to be font-style (rather than font-weight) [47b533b6d](https://github.com/pycontribs/ansi2html/commit/47b533b6de62ebe97d32322eaa3a5dcec735a077) - Add inv\* CSS classes [408808197](https://github.com/pycontribs/ansi2html/commit/408808197e9b33aa55210b5f03940267b3e01c83) - Handle state in code, not in HTML; support more ANSI codes [fce66a6a9](https://github.com/pycontribs/ansi2html/commit/fce66a6a905fb6aa006cfa1f6ad4716ebb46e63b) - Adapt tests to new approach to state [49046c620](https://github.com/pycontribs/ansi2html/commit/49046c620079d3a325753081ba99b1deb0c8287a) - Add CSS classes for lighter font style (2), blinking (5/6), hidden text (8) [e488daca3](https://github.com/pycontribs/ansi2html/commit/e488daca38176c9cdba7318a958fc79bfb16f9cb) - Save producing no-op span tags [340620f88](https://github.com/pycontribs/ansi2html/commit/340620f88b66a686c16f155465f172321fe39cff) - Test ANSI codes that just turned supported [f4774bcf0](https://github.com/pycontribs/ansi2html/commit/f4774bcf0005175bc00f282f73365fa59b6f47fb) - Make code testing pairs of files re-usable [f95ca305d](https://github.com/pycontribs/ansi2html/commit/f95ca305dba5951c25178fc12fb0e206120aa1b4) - Add testcase for output from \"eix -I svn -F\" [e3f593671](https://github.com/pycontribs/ansi2html/commit/e3f59367174fb9ed4df2d19ed012bae45f0ce2ce) - Merge pull request #31 from hartwork/font-style-italic [a25950fe6](https://github.com/pycontribs/ansi2html/commit/a25950fe6f0bdd12c92cbbd2109655bfd1cc5a36) - Tweak for py3 support. [9766508e1](https://github.com/pycontribs/ansi2html/commit/9766508e16007fdcd764ba52c79af798d8d816fd) - Add py3.3 to travis config. [ceef1eb8e](https://github.com/pycontribs/ansi2html/commit/ceef1eb8e83a58fe895f67185f4242b8e49f7b7c) - Merge branch \'stateful\' into develop [29868b6ec](https://github.com/pycontribs/ansi2html/commit/29868b6ec1e742a23e3b60db17f187ce75bb3d57) - 0.10.0 [b5c65d3a4](https://github.com/pycontribs/ansi2html/commit/b5c65d3a4fa666aa397409900677c9c115625be7) - Add missing license headers [44e5e52fa](https://github.com/pycontribs/ansi2html/commit/44e5e52faf6ea1eef57b8a3b1173f6794683dd4d) - Fix README example to not produce unwanted spaces (issue 26) [cc6a0dbfa](https://github.com/pycontribs/ansi2html/commit/cc6a0dbfa2a86a827f8f737b0b610cbcb9afe282) - Add \--version parameter, control version in version.py [0b2006095](https://github.com/pycontribs/ansi2html/commit/0b2006095e4b56896773fdaa4fb6b5526ecbde58) - Improve \--help output [26d297807](https://github.com/pycontribs/ansi2html/commit/26d2978072f2f13836219d4999ff6b7d12ed031a) - Add and integrate man page [2ec363007](https://github.com/pycontribs/ansi2html/commit/2ec363007f49b91275d146414313783ba4d5ab61) - No longer process line-by-line (fixes \--partial and \--inline, issue 36) [e3e86f9f8](https://github.com/pycontribs/ansi2html/commit/e3e86f9f874a4243ee66a88022e752c7ceaf338e) - Test cross-line state (related to issue 36) [c3eb8b9c5](https://github.com/pycontribs/ansi2html/commit/c3eb8b9c51828da2e94aff9f5f77a363bc841850) - Fix approach to trailing newlines [95e75e4d3](https://github.com/pycontribs/ansi2html/commit/95e75e4d3e844aa33fb89045953c5d4869b3dbd2) - Merge pull request #37 from hartwork/fix-line-handling [0fb5443ca](https://github.com/pycontribs/ansi2html/commit/0fb5443ca094bed79a4e30964716b2c3f875cb96) - Merge pull request #33 from hartwork/headers [12bfa3251](https://github.com/pycontribs/ansi2html/commit/12bfa325141f7c7f7d7a9f65147d30a3082fc53b) - Merge pull request #34 from hartwork/fix-readme-example [b1ed96e00](https://github.com/pycontribs/ansi2html/commit/b1ed96e00d324f0a4557917c02f425266dd224c1) - Merge pull request #35 from hartwork/manpage [ad608eb2b](https://github.com/pycontribs/ansi2html/commit/ad608eb2b26751e983ac9e31ae412698f45d4664) # 0.9.4 - Fix encoding issue. [64881f549](https://github.com/pycontribs/ansi2html/commit/64881f549126f5c576df7b75e70e49633fe59337) - Silence silly py2.7 test errors. [b5db644ff](https://github.com/pycontribs/ansi2html/commit/b5db644ffa29497bd16dc0f0adae7f0847603f2c) # 0.9.3 - Fix encoding issue. [64881f549](https://github.com/pycontribs/ansi2html/commit/64881f549126f5c576df7b75e70e49633fe59337) - Silence silly py2.7 test errors. [b5db644ff](https://github.com/pycontribs/ansi2html/commit/b5db644ffa29497bd16dc0f0adae7f0847603f2c) - Fix little encoding issue. [8cfbe166c](https://github.com/pycontribs/ansi2html/commit/8cfbe166c5645e459ad0ff3c061634a2146c26b9) - Add trove for py3.3. [683f672fa](https://github.com/pycontribs/ansi2html/commit/683f672fa6071cc7390b6c64858127fe0b1e2e77) - Stop adding unwanted spaces (issue 26) [b5163a80f](https://github.com/pycontribs/ansi2html/commit/b5163a80feea7f6ba8879357524ccbe143e68281) - Add test for issue 25 [6df79eb8b](https://github.com/pycontribs/ansi2html/commit/6df79eb8b95b2c36e7395bedcd13e0facb323434) - Fix destructive reset marker handling (issue 25) [4db97b126](https://github.com/pycontribs/ansi2html/commit/4db97b126c600d30a922ab5899faa8879f699739) - Fix ANSI code decoding (issue 25) [f277f8f3c](https://github.com/pycontribs/ansi2html/commit/f277f8f3c4eaa1256c5df66238583b5a69882456) - Fix writing to sys.stdout.buffer [7a3267d53](https://github.com/pycontribs/ansi2html/commit/7a3267d53a2ea61a0af6021faedf154ba89b2f87) - Add convenience Makefile [8d3f3e055](https://github.com/pycontribs/ansi2html/commit/8d3f3e055e679bf723d6a846fbff2c95a7224b9a) - Merge pull request #30 from hartwork/makefile [156bc89da](https://github.com/pycontribs/ansi2html/commit/156bc89da97c7de19b2beb8e2de7bde2f2535a20) - Merge pull request #29 from hartwork/issue_29 [8495723ae](https://github.com/pycontribs/ansi2html/commit/8495723ae8e057248537a53f9e7e800547d6640e) - Merge pull request #27 from hartwork/issue_26 [74d237c18](https://github.com/pycontribs/ansi2html/commit/74d237c18165625bedde85e25f1eb988f0da8ca1) - Merge pull request #28 from hartwork/issue_25 [8c77f6d93](https://github.com/pycontribs/ansi2html/commit/8c77f6d93754c03fc256754de73b8b2bf1d6c08c) - Fix italic to be font-style (rather than font-weight) [47b533b6d](https://github.com/pycontribs/ansi2html/commit/47b533b6de62ebe97d32322eaa3a5dcec735a077) - Add inv\* CSS classes [408808197](https://github.com/pycontribs/ansi2html/commit/408808197e9b33aa55210b5f03940267b3e01c83) - Handle state in code, not in HTML; support more ANSI codes [fce66a6a9](https://github.com/pycontribs/ansi2html/commit/fce66a6a905fb6aa006cfa1f6ad4716ebb46e63b) - Adapt tests to new approach to state [49046c620](https://github.com/pycontribs/ansi2html/commit/49046c620079d3a325753081ba99b1deb0c8287a) - Add CSS classes for lighter font style (2), blinking (5/6), hidden text (8) [e488daca3](https://github.com/pycontribs/ansi2html/commit/e488daca38176c9cdba7318a958fc79bfb16f9cb) - Save producing no-op span tags [340620f88](https://github.com/pycontribs/ansi2html/commit/340620f88b66a686c16f155465f172321fe39cff) - Test ANSI codes that just turned supported [f4774bcf0](https://github.com/pycontribs/ansi2html/commit/f4774bcf0005175bc00f282f73365fa59b6f47fb) - Make code testing pairs of files re-usable [f95ca305d](https://github.com/pycontribs/ansi2html/commit/f95ca305dba5951c25178fc12fb0e206120aa1b4) - Add testcase for output from \"eix -I svn -F\" [e3f593671](https://github.com/pycontribs/ansi2html/commit/e3f59367174fb9ed4df2d19ed012bae45f0ce2ce) - Merge pull request #31 from hartwork/font-style-italic [a25950fe6](https://github.com/pycontribs/ansi2html/commit/a25950fe6f0bdd12c92cbbd2109655bfd1cc5a36) - Tweak for py3 support. [9766508e1](https://github.com/pycontribs/ansi2html/commit/9766508e16007fdcd764ba52c79af798d8d816fd) - Add py3.3 to travis config. [ceef1eb8e](https://github.com/pycontribs/ansi2html/commit/ceef1eb8e83a58fe895f67185f4242b8e49f7b7c) - Merge branch \'stateful\' into develop [29868b6ec](https://github.com/pycontribs/ansi2html/commit/29868b6ec1e742a23e3b60db17f187ce75bb3d57) ansi2html-1.9.2/docs/index.md000077700000000000000000000000001463560412000174732../README.mdustar00rootroot00000000000000ansi2html-1.9.2/man/000077500000000000000000000000001463560412000142005ustar00rootroot00000000000000ansi2html-1.9.2/man/.gitignore000066400000000000000000000000151463560412000161640ustar00rootroot00000000000000/ansi2html.1 ansi2html-1.9.2/man/ansi2html.1.txt000066400000000000000000000030441463560412000170020ustar00rootroot00000000000000ANSI2HTML(1) ============ :doctype: manpage :man source: {manual_package} :man version: {manual_version} :man manual: {manual_title} NAME ---- ansi2html - Convert text with ANSI color codes to HTML SYNOPSIS -------- *ansi2html* ['OPTIONS'] [*--inline*] [*--partial*] DESCRIPTION ----------- Tool to convert text with ANSI color codes to HTML. OPTIONS ------- *-p*, *--partial*:: Process lines as them come in. No headers are produced. *-i*, *--inline*:: Inline style without headers or template. *-H*, *--headers*:: Just produce the "
%(content)s
""" class _State: def __init__(self) -> None: self.inside_span = False self.reset() def reset(self) -> None: self.intensity: int = ANSI_INTENSITY_NORMAL self.style: int = ANSI_STYLE_NORMAL self.blink: int = ANSI_BLINK_OFF self.underline: int = ANSI_UNDERLINE_OFF self.crossedout: int = ANSI_CROSSED_OUT_OFF self.visibility: int = ANSI_VISIBILITY_ON self.foreground: Tuple[int, Optional[str]] = (ANSI_FOREGROUND_DEFAULT, None) self.background: Tuple[int, Optional[str]] = (ANSI_BACKGROUND_DEFAULT, None) self.negative: int = ANSI_NEGATIVE_OFF def adjust(self, ansi_code: int, parameter: Optional[str] = None) -> None: if ansi_code in ( ANSI_INTENSITY_INCREASED, ANSI_INTENSITY_REDUCED, ANSI_INTENSITY_NORMAL, ): self.intensity = ansi_code elif ansi_code in (ANSI_STYLE_ITALIC, ANSI_STYLE_NORMAL): self.style = ansi_code elif ansi_code in (ANSI_BLINK_SLOW, ANSI_BLINK_FAST, ANSI_BLINK_OFF): self.blink = ansi_code elif ansi_code in (ANSI_UNDERLINE_ON, ANSI_UNDERLINE_OFF): self.underline = ansi_code elif ansi_code in (ANSI_CROSSED_OUT_ON, ANSI_CROSSED_OUT_OFF): self.crossedout = ansi_code elif ansi_code in (ANSI_VISIBILITY_ON, ANSI_VISIBILITY_OFF): self.visibility = ansi_code elif ANSI_FOREGROUND_CUSTOM_MIN <= ansi_code <= ANSI_FOREGROUND_CUSTOM_MAX: self.foreground = (ansi_code, None) elif ( ANSI_FOREGROUND_HIGH_INTENSITY_MIN <= ansi_code <= ANSI_FOREGROUND_HIGH_INTENSITY_MAX ): self.foreground = (ansi_code, None) elif ansi_code == ANSI_FOREGROUND: self.foreground = (ansi_code, parameter) elif ansi_code == ANSI_FOREGROUND_DEFAULT: self.foreground = (ansi_code, None) elif ANSI_BACKGROUND_CUSTOM_MIN <= ansi_code <= ANSI_BACKGROUND_CUSTOM_MAX: self.background = (ansi_code, None) elif ( ANSI_BACKGROUND_HIGH_INTENSITY_MIN <= ansi_code <= ANSI_BACKGROUND_HIGH_INTENSITY_MAX ): self.background = (ansi_code, None) elif ansi_code == ANSI_BACKGROUND: self.background = (ansi_code, parameter) elif ansi_code == ANSI_BACKGROUND_DEFAULT: self.background = (ansi_code, None) elif ansi_code in (ANSI_NEGATIVE_ON, ANSI_NEGATIVE_OFF): self.negative = ansi_code def adjust_truecolor(self, ansi_code: int, r: int, g: int, b: int) -> None: parameter = "{:03d}{:03d}{:03d}".format( r, g, b ) # r=1, g=64, b=255 -> 001064255 is_foreground = ansi_code == ANSI_FOREGROUND add_truecolor_style_rule(is_foreground, ansi_code, r, g, b, parameter) if is_foreground: self.foreground = (ansi_code, parameter) else: self.background = (ansi_code, parameter) def to_css_classes(self) -> List[str]: css_classes: List[str] = [] def append_unless_default(output: List[str], value: int, default: int) -> None: if value != default: css_class = "ansi%d" % value output.append(css_class) def append_color_unless_default( output: List[str], color: Tuple[int, Optional[str]], default: int, negative: bool, neg_css_class: str, ) -> None: value, parameter = color if value != default: prefix = "inv" if negative else "ansi" css_class_index = ( str(value) if (parameter is None) else "%d-%s" % (value, parameter) ) output.append(prefix + css_class_index) elif negative: output.append(neg_css_class) append_unless_default(css_classes, self.intensity, ANSI_INTENSITY_NORMAL) append_unless_default(css_classes, self.style, ANSI_STYLE_NORMAL) append_unless_default(css_classes, self.blink, ANSI_BLINK_OFF) append_unless_default(css_classes, self.underline, ANSI_UNDERLINE_OFF) append_unless_default(css_classes, self.crossedout, ANSI_CROSSED_OUT_OFF) append_unless_default(css_classes, self.visibility, ANSI_VISIBILITY_ON) flip_fore_and_background = self.negative == ANSI_NEGATIVE_ON append_color_unless_default( css_classes, self.foreground, ANSI_FOREGROUND_DEFAULT, flip_fore_and_background, "inv_background", ) append_color_unless_default( css_classes, self.background, ANSI_BACKGROUND_DEFAULT, flip_fore_and_background, "inv_foreground", ) return css_classes class OSC_Link: def __init__(self, url: str, text: str) -> None: self.url = url self.text = text def map_vt100_box_code(char: str) -> str: char_hex = hex(ord(char)) return VT100_BOX_CODES[char_hex] if char_hex in VT100_BOX_CODES else char def _needs_extra_newline(text: str) -> bool: if not text or text.endswith("\n"): return False return True class CursorMoveUp: pass class Attributes(TypedDict): dark_bg: bool line_wrap: bool font_size: str body: str styles: Set[str] class Ansi2HTMLConverter: """Convert Ansi color codes to CSS+HTML Example: >>> conv = Ansi2HTMLConverter() >>> ansi = " ".join(sys.stdin.readlines()) >>> html = conv.convert(ansi) """ def __init__( self, latex: bool = False, inline: bool = False, dark_bg: bool = True, line_wrap: bool = True, font_size: str = "normal", linkify: bool = False, escaped: bool = True, markup_lines: bool = False, output_encoding: str = "utf-8", scheme: str = "ansi2html", title: str = "", ) -> None: self.latex = latex self.inline = inline self.dark_bg = dark_bg self.line_wrap = line_wrap self.font_size = font_size self.linkify = linkify self.escaped = escaped self.markup_lines = markup_lines self.output_encoding = output_encoding self.scheme = scheme self.title = title self._attrs: Attributes self.hyperref = False if inline: self.styles = dict( [ (item.klass.strip("."), item) for item in get_styles(self.dark_bg, self.line_wrap, self.scheme) ] ) self.vt100_box_codes_prog = re.compile("\033\\(([B0])") self.ansi_codes_prog = re.compile("\033\\[([\\d;:]*)([a-zA-z])") self.url_matcher = re.compile( r"(((((https?|ftps?|gopher|telnet|nntp)://)|" r"(mailto:|news:))(%[0-9A-Fa-f]{2}|[-()_.!~*" r"\';/?#:@&=+$,A-Za-z0-9])+)([).!\';/?:,][\s])?)" ) self.osc_link_re = re.compile("\033\\]8;;(.*?)\007(.*?)\033\\]8;;\007") def do_linkify(self, line: str) -> str: if not isinstance(line, str): return line # If line is an object, e.g. OSC_Link, it # will be expanded to a string later if self.latex: return self.url_matcher.sub(r"\\url{\1}", line) return self.url_matcher.sub(r'\1', line) def handle_osc_links(self, part: OSC_Link) -> str: if self.latex: self.hyperref = True return """\\href{%s}{%s}""" % (part.url, part.text) return """%s""" % (part.url, part.text) def apply_regex(self, ansi: str) -> Tuple[str, Set[str]]: styles_used: Set[str] = set() all_parts = self._apply_regex(ansi, styles_used) no_cursor_parts = self._collapse_cursor(all_parts) no_cursor_parts = list(no_cursor_parts) def _check_links(parts: List[Union[str, OSC_Link]]) -> Iterator[str]: for part in parts: if isinstance(part, str): if self.linkify: yield self.do_linkify(part) else: yield part elif isinstance(part, OSC_Link): yield self.handle_osc_links(part) else: yield part parts = list(_check_links(no_cursor_parts)) combined = "".join(parts) if self.markup_lines and not self.latex: combined = "\n".join( [ """%s""" % (i, line) for i, line in enumerate(combined.split("\n")) ] ) return combined, styles_used def _apply_regex( self, ansi: str, styles_used: Set[str] ) -> Iterator[Union[str, OSC_Link, CursorMoveUp]]: if self.escaped: if ( self.latex ): # Known Perl function which does this: https://tex.stackexchange.com/questions/34580/escape-character-in-latex/119383#119383 specials = OrderedDict([]) else: specials = OrderedDict( [ ("&", "&"), ("<", "<"), (">", ">"), ] ) for pattern, special in specials.items(): ansi = ansi.replace(pattern, special) def _vt100_box_drawing() -> Iterator[str]: last_end = 0 # the index of the last end of a code we've seen box_drawing_mode = False for match in self.vt100_box_codes_prog.finditer(ansi): trailer = ansi[last_end : match.start()] if box_drawing_mode: for char in trailer: yield map_vt100_box_code(char) else: yield trailer last_end = match.end() box_drawing_mode = match.groups()[0] == "0" yield ansi[last_end:] ansi = "".join(_vt100_box_drawing()) def _osc_link(ansi: str) -> Iterator[Union[str, OSC_Link]]: last_end = 0 for match in self.osc_link_re.finditer(ansi): trailer = ansi[last_end : match.start()] yield trailer url = match.groups()[0] text = match.groups()[1] yield OSC_Link(url, text) last_end = match.end() yield ansi[last_end:] state = _State() for part in _osc_link(ansi): if isinstance(part, OSC_Link): yield part else: yield from self._handle_ansi_code(part, styles_used, state) if state.inside_span: if self.latex: yield "}" else: yield "" def _handle_ansi_code( self, ansi: str, styles_used: Set[str], state: _State ) -> Iterator[Union[str, CursorMoveUp]]: last_end = 0 # the index of the last end of a code we've seen for match in self.ansi_codes_prog.finditer(ansi): yield ansi[last_end : match.start()] last_end = match.end() params: Union[str, List[int]] params, command = match.groups() if command not in "mMA": continue # Special cursor-moving code. The only supported one. if command == "A": yield CursorMoveUp() continue while True: param_len = len(params) params = params.replace("::", ":") params = params.replace(";;", ";") if len(params) == param_len: break try: params = [int(x) for x in re.split("[;:]", params)] except ValueError: params = [ANSI_FULL_RESET] # Find latest reset marker last_null_index = None skip_after_index = -1 for i, v in enumerate(params): if i <= skip_after_index: continue if v == ANSI_FULL_RESET: last_null_index = i elif v in (ANSI_FOREGROUND, ANSI_BACKGROUND): try: x_bit_color_id = params[i + 1] except IndexError: x_bit_color_id = -1 is_256_color = x_bit_color_id == ANSI_256_COLOR_ID shift = 2 if is_256_color else 4 skip_after_index = i + shift # Process reset marker, drop everything before if last_null_index is not None: params = params[last_null_index + 1 :] if state.inside_span: state.inside_span = False if self.latex: yield "}" else: yield "" state.reset() if not params: continue # Turn codes into CSS classes skip_after_index = -1 for i, v in enumerate(params): if i <= skip_after_index: continue is_x_bit_color = v in (ANSI_FOREGROUND, ANSI_BACKGROUND) try: x_bit_color_id = params[i + 1] except IndexError: x_bit_color_id = -1 is_256_color = x_bit_color_id == ANSI_256_COLOR_ID is_truecolor = x_bit_color_id == ANSI_TRUECOLOR_ID if is_x_bit_color and is_256_color: try: parameter: Optional[str] = str(params[i + 2]) except IndexError: continue skip_after_index = i + 2 elif is_x_bit_color and is_truecolor: try: state.adjust_truecolor( v, params[i + 2], params[i + 3], params[i + 4] ) except IndexError: continue skip_after_index = i + 4 continue else: parameter = None state.adjust(v, parameter=parameter) if state.inside_span: if self.latex: yield "}" else: yield "" state.inside_span = False css_classes = state.to_css_classes() if not css_classes: continue styles_used.update(css_classes) if self.inline: self.styles.update(pop_truecolor_styles()) if self.latex: style = [ self.styles[klass].kwl[0][1] for klass in css_classes if self.styles[klass].kwl[0][0] == "color" ] yield "\\textcolor[HTML]{%s}{" % style[0] else: style = [ self.styles[klass].kw for klass in css_classes if klass in self.styles ] yield '' % "; ".join(style) else: if self.latex: yield "\\textcolor{%s}{" % " ".join(css_classes) else: yield '' % " ".join(css_classes) state.inside_span = True yield ansi[last_end:] def _collapse_cursor( self, parts: Iterator[Union[str, OSC_Link, CursorMoveUp]] ) -> List[Union[str, OSC_Link]]: """Act on any CursorMoveUp commands by deleting preceding tokens""" final_parts: List[Union[str, OSC_Link]] = [] for part in parts: # Throw out empty string tokens ("") if not part: continue # Go back, deleting every token in the last 'line' if isinstance(part, CursorMoveUp): if final_parts: final_parts.pop() while final_parts and ( isinstance(final_parts[-1], OSC_Link) or ( isinstance(final_parts[-1], str) and "\n" not in final_parts[-1] ) ): final_parts.pop() continue # Otherwise, just pass this token forward final_parts.append(part) return final_parts def prepare( self, ansi: str = "", ensure_trailing_newline: bool = False ) -> Attributes: """Load the contents of 'ansi' into this object""" body, styles = self.apply_regex(ansi) if ensure_trailing_newline and _needs_extra_newline(body): body += "\n" self._attrs = { "dark_bg": self.dark_bg, "line_wrap": self.line_wrap, "font_size": self.font_size, "body": body, "styles": styles, } return self._attrs def convert( self, ansi: str, full: bool = True, ensure_trailing_newline: bool = False ) -> str: r""" :param ansi: ANSI sequence to convert. :param full: Whether to include the full HTML document or only the body. :param ensure_trailing_newline: Ensures that ``\n`` character is present at the end of the output. """ attrs = self.prepare(ansi, ensure_trailing_newline=ensure_trailing_newline) if not full: return attrs["body"] if self.latex: _template = _latex_template else: _template = _html_template all_styles = get_styles(self.dark_bg, self.line_wrap, self.scheme) backgrounds = all_styles[:5] used_styles = filter( lambda e: e.klass.lstrip(".") in attrs["styles"], all_styles ) return _template % { "style": "\n".join(list(map(str, backgrounds + list(used_styles)))), "title": self.title, "font_size": self.font_size, "content": attrs["body"], "output_encoding": self.output_encoding, "hyperref": "\\usepackage{hyperref}" if self.hyperref else "", } def produce_headers(self) -> str: return '\n' % { "style": "\n".join( map(str, get_styles(self.dark_bg, self.line_wrap, self.scheme)) ) } def main() -> None: """ $ ls --color=always | ansi2html > directories.html $ sudo tail /var/log/messages | ccze -A | ansi2html > logs.html $ task burndown | ansi2html > burndown.html """ scheme_names = sorted(SCHEME.keys()) version_str = version("ansi2html") parser = argparse.ArgumentParser(usage=main.__doc__) parser.add_argument( "-V", "--version", action="version", version=f"%(prog)s {version_str}" ) parser.add_argument( "-p", "--partial", dest="partial", default=False, action="store_true", help="Process lines as them come in. No headers are produced.", ) parser.add_argument( "-L", "--latex", dest="latex", default=False, action="store_true", help="Export as LaTeX instead of HTML.", ) parser.add_argument( "-i", "--inline", dest="inline", default=False, action="store_true", help="Inline style without headers or template.", ) parser.add_argument( "-H", "--headers", dest="headers", default=False, action="store_true", help="Just produce the
 black  red  green  yellow  blue  magenta cyan  white 
 black  red  green  yellow  blue  magenta cyan  white 
 black  red  green  yellow  blue  magenta cyan  white 
 black  red  green  yellow  blue  magenta cyan  white 
 black  red  green  yellow  blue  magenta cyan  white 
 black  red  green  yellow  blue  magenta cyan  white 
 black  red  green  yellow  blue  magenta cyan  white 
 black  red  green  yellow  blue  magenta cyan  white 
 black  red  green  yellow  blue  magenta cyan  white 
 black  red  green  yellow  blue  magenta cyan  white 
 black  red  green  yellow  blue  magenta cyan  white 
 black  red  green  yellow  blue  magenta cyan  white 
 black  red  green  yellow  blue  magenta cyan  white 
 black  red  green  yellow  blue  magenta cyan  white 
 black  red  green  yellow  blue  magenta cyan  white 
 black  red  green  yellow  blue  magenta cyan  white 

ansi2html-1.9.2/tests/ansicolor.txt000066400000000000000000000032401463560412000173200ustar00rootroot00000000000000 black  red  green  yellow  blue  magenta cyan  white   black  red  green  yellow  blue  magenta cyan  white   black  red  green  yellow  blue  magenta cyan  white   black  red  green  yellow  blue  magenta cyan  white   black  red  green  yellow  blue  magenta cyan  white   black  red  green  yellow  blue  magenta cyan  white   black  red  green  yellow  blue  magenta cyan  white   black  red  green  yellow  blue  magenta cyan  white   black  red  green  yellow  blue  magenta cyan  white   black  red  green  yellow  blue  magenta cyan  white   black  red  green  yellow  blue  magenta cyan  white   black  red  green  yellow  blue  magenta cyan  white   black  red  green  yellow  blue  magenta cyan  white   black  red  green  yellow  blue  magenta cyan  white   black  red  green  yellow  blue  magenta cyan  white   black  red  green  yellow  blue  magenta cyan  white  ansi2html-1.9.2/tests/ansicolor_eix.html000066400000000000000000000267721463560412000203310ustar00rootroot00000000000000
[U] dev-python/pysvn
     Available versions:  1.7.6 (~)1.7.7^t{tbz2} (~)1.7.8^t {doc examples PYTHON_TARGETS="python2_6 python2_7 python3_2 python3_3"}
     Installed versions:  1.7.7^t{tbz2}(22:19:41 13.03.2013)(-doc -examples PYTHON_TARGETS="python2_7 python3_2 -python2_5 -python2_6 -python3_1")
     Homepage:            http://pysvn.tigris.org/
     Description:         Object-oriented python bindings for subversion

[I] dev-vcs/rsvndump
     Available versions:  (~)0.5.2-r3 (~)0.5.3 (~)0.5.4 (~)0.5.5 (~)0.5.6 (~)0.5.7 (~)0.5.8 (~)0.6 {debug doc}
     Installed versions:  0.6(22:39:58 15.05.2012)(doc -debug)
     Homepage:            http://rsvndump.sourceforge.net
     Description:         Dump a remote Subversion repository

[I] dev-vcs/svn2git
     Available versions:  (~)0_pre20100303 (~)0_pre20100324 (~)0_pre20100327 (~)0_pre20101008 (~)0_pre20101101 (~)1.0.2.1 (~)1.0.3_p1 (~)1.0.4 (~)1.0.5 (~)1.0.6 (~)1.0.8-r1 (~)1.0.10 **9999
     Installed versions:  1.0.10(23:36:18 21.05.2013)
     Homepage:            http://gitorious.org/svn2git/svn2git
     Description:         Tool for one-time conversion from svn to git.

[I] dev-vcs/svneverever
     Available versions:  (~)1.2.2
     Installed versions:  1.2.2(03:13:17 11.05.2013)
     Homepage:            http://git.goodpoint.de/?p=svneverever.git;a=summary
     Description:         Tool collecting path entries across SVN history

[I] sys-apps/hidesvn [1]
     Available versions:  (~)1.1-r1 (~)1.2
     Installed versions:  1.2(14:51:53 28.07.2011)
     Homepage:            http://80386.nl/projects/hidesvn/
     Description:         Uses LD_PRELOAD to hide .svn directories from readdir() and readdir_r()

[1] "betagarden" /home/sping/__playground/betagarden

Found 5 matches.


ansi2html-1.9.2/tests/ansicolor_eix.txt000066400000000000000000000112531463560412000201700ustar00rootroot00000000000000[U] dev-python/pysvn  Available versions: 1.7.6 (~)1.7.7^t{tbz2} (~)1.7.8^t {doc examples PYTHON_TARGETS="python2_6 python2_7 python3_2 python3_3"}  Installed versions: 1.7.7^t{tbz2}(22:19:41 13.03.2013)(-doc -examples PYTHON_TARGETS="python2_7 python3_2 -python2_5 -python2_6 -python3_1")  Homepage: http://pysvn.tigris.org/  Description: Object-oriented python bindings for subversion  [I] dev-vcs/rsvndump  Available versions: (~)0.5.2-r3 (~)0.5.3 (~)0.5.4 (~)0.5.5 (~)0.5.6 (~)0.5.7 (~)0.5.8 (~)0.6 {debug doc}  Installed versions: 0.6(22:39:58 15.05.2012)(doc -debug)  Homepage: http://rsvndump.sourceforge.net  Description: Dump a remote Subversion repository  [I] dev-vcs/svn2git  Available versions: (~)0_pre20100303 (~)0_pre20100324 (~)0_pre20100327 (~)0_pre20101008 (~)0_pre20101101 (~)1.0.2.1 (~)1.0.3_p1 (~)1.0.4 (~)1.0.5 (~)1.0.6 (~)1.0.8-r1 (~)1.0.10 **9999  Installed versions: 1.0.10(23:36:18 21.05.2013)  Homepage: http://gitorious.org/svn2git/svn2git  Description: Tool for one-time conversion from svn to git.  [I] dev-vcs/svneverever  Available versions: (~)1.2.2  Installed versions: 1.2.2(03:13:17 11.05.2013)  Homepage: http://git.goodpoint.de/?p=svneverever.git;a=summary  Description: Tool collecting path entries across SVN history  [I] sys-apps/hidesvn [1]  Available versions: (~)1.1-r1 (~)1.2  Installed versions: 1.2(14:51:53 28.07.2011)  Homepage: http://80386.nl/projects/hidesvn/  Description: Uses LD_PRELOAD to hide .svn directories from readdir() and readdir_r()  [1] "betagarden" /home/sping/__playground/betagarden Found 5 matches.  ansi2html-1.9.2/tests/produce_headers.txt000066400000000000000000001106131463560412000204660ustar00rootroot00000000000000 ansi2html-1.9.2/tests/test_ansi2html.py000066400000000000000000000467101463560412000201110ustar00rootroot00000000000000# This file is part of ansi2html # Convert ANSI (terminal) colours and attributes to HTML # Copyright (C) 2012 Ralph Bean # Copyright (C) 2012 Kuno Woudt # Copyright (C) 2012 Martin Zimmermann # Copyright (C) 2013 Sebastian Pipping # # Inspired by and developed off of the work by pixelbeat and blackjack. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 3 of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with this program; if not, write to the Free Software Foundation, # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. import sys import textwrap from io import StringIO from os.path import abspath, dirname, join from subprocess import PIPE, Popen, run from typing import List from unittest.mock import patch from ansi2html import Ansi2HTMLConverter from ansi2html.converter import ( ANSI_BLINK_FAST, ANSI_BLINK_OFF, ANSI_BLINK_SLOW, ANSI_INTENSITY_INCREASED, ANSI_INTENSITY_NORMAL, ANSI_INTENSITY_REDUCED, ANSI_NEGATIVE_OFF, ANSI_NEGATIVE_ON, ANSI_VISIBILITY_OFF, ANSI_VISIBILITY_ON, main, ) from ansi2html.util import read_to_unicode _here = dirname(abspath(__file__)) class TestAnsi2HTML: maxDiff = None def test_linkify(self) -> None: ansi = "http://threebean.org#foobar" target = 'http://threebean.org#foobar' html = Ansi2HTMLConverter(linkify=True).convert(ansi) assert target in html def test_not_linkify(self) -> None: ansi = "http://threebean.org" target = 'http://threebean.org' html = Ansi2HTMLConverter().convert(ansi) assert target not in html def test_osc_link(self) -> None: ansi = "[\x1b[01;35m\x1b[K\x1b]8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wtype-limits\x07-Wtype-limits\x1b]8;;\x07\x1b[m\x1b[K]\n" target = '[-Wtype-limits]' html = Ansi2HTMLConverter().convert(ansi) assert target in html def test_osc_link_latex(self) -> None: ansi = "[\x1b[01;35m\x1b[K\x1b]8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wtype-limits\x07-Wtype-limits\x1b]8;;\x07\x1b[m\x1b[K]\n" target = "[\\textcolor{ansi1 ansi35}{\\href{https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wtype-limits}{-Wtype-limits}}]" html = Ansi2HTMLConverter(latex=True).convert(ansi) assert target in html def test_conversion(self) -> None: for input_filename, expected_output_filename in ( ("ansicolor.txt", "ansicolor.html"), ("ansicolor_eix.txt", "ansicolor_eix.html"), ): with open(join(_here, input_filename), "rb") as input: test_data = "".join(read_to_unicode(input)) with open(join(_here, expected_output_filename), "rb") as output: expected_data = [e.rstrip("\n") for e in read_to_unicode(output)] html = ( Ansi2HTMLConverter() .convert(test_data, ensure_trailing_newline=True) .split("\n") ) if html and html[-1] == "": html = html[:-1] assert "\n".join(html) == "\n".join(expected_data) @patch("sys.argv", new_callable=lambda: ["ansi2html"]) @patch("sys.stdout", new_callable=StringIO) def test_conversion_as_command( self, mock_stdout: StringIO, mock_argv: List[str] ) -> None: with open(join(_here, "ansicolor.txt"), "rb") as input: test_data = "".join(read_to_unicode(input)) with open(join(_here, "ansicolor.html"), "rb") as output: expected_data = "".join(read_to_unicode(output)) def f() -> StringIO: return StringIO(test_data) with patch("sys.stdin", new_callable=f): main() html = mock_stdout.getvalue() assert html == expected_data def test_unicode(self) -> None: """Ensure that the converter returns unicode(py2)/str(py3) objs.""" with open(join(_here, "ansicolor.txt"), "rb") as input: test_data = "".join(read_to_unicode(input)) html = Ansi2HTMLConverter().convert(test_data).split("\n") for chunk in html: assert isinstance(chunk, str) @patch("sys.argv", new_callable=lambda: ["ansi2html", "--inline"]) @patch("sys.stdout", new_callable=StringIO) def test_inline_as_command( self, mock_stdout: StringIO, mock_argv: List[str] ) -> None: test_input = textwrap.dedent( """ this is a test """ ) with patch("sys.stdin", new_callable=lambda: StringIO(test_input)): main() ms_val = mock_stdout.getvalue() assert ms_val == test_input, "%r != %r" % (ms_val, test_input) @patch("sys.argv", new_callable=lambda: ["ansi2html", "--partial"]) @patch("sys.stdout", new_callable=StringIO) def test_partial_as_command( self, mock_stdout: StringIO, mock_argv: List[str] ) -> None: rainbow = "\x1b[1m\x1b[40m\x1b[31mr\x1b[32ma\x1b[33mi\x1b[34mn\x1b[35mb\x1b[36mo\x1b[37mw\x1b[0m\n" with patch("sys.stdin", new_callable=lambda: StringIO(rainbow)): main() html = mock_stdout.getvalue().strip() expected = ( '' + '' + 'r' + 'a' + 'i' + 'n' + 'b' + 'o' + 'w' ) assert isinstance(html, str) assert isinstance(expected, str) assert expected == html @patch("sys.argv", new_callable=lambda: ["ansi2html", "--headers"]) @patch("sys.stdout", new_callable=StringIO) def test_headers_as_command( self, mock_stdout: StringIO, mock_argv: List[str] ) -> None: main() with open(join(_here, "produce_headers.txt"), "rb") as produce_headers: expected = read_to_unicode(produce_headers) html = mock_stdout.getvalue() assert isinstance(html, str) assert html == "".join(expected) def test_partial(self) -> None: rainbow = "\x1b[1m\x1b[40m\x1b[31mr\x1b[32ma\x1b[33mi\x1b[34mn\x1b[35mb\x1b[36mo\x1b[37mw\x1b[0m\n" html = Ansi2HTMLConverter().convert(rainbow, full=False).strip() expected = ( '' + '' + 'r' + 'a' + 'i' + 'n' + 'b' + 'o' + 'w' ) assert expected == html def test_inline(self) -> None: rainbow = "\x1b[1m\x1b[40m\x1b[31mr\x1b[32ma\x1b[33mi\x1b[34mn\x1b[35mb\x1b[36mo\x1b[37mw\x1b[0m" html = Ansi2HTMLConverter(inline=True).convert(rainbow, full=False) expected = ( '' + '' + 'r' + 'a' + 'i' + 'n' + 'b' + 'o' + 'w' ) assert expected == html def test_produce_headers(self) -> None: conv = Ansi2HTMLConverter() headers = conv.produce_headers() inputfile = join(_here, "produce_headers.txt") with open(inputfile, "rb") as produce_headers: expected_data = read_to_unicode(produce_headers) assert headers == "".join(expected_data) def test_escaped_implicit(self) -> None: test = "

awesome

" expected = "<p>awesome</p>" html = Ansi2HTMLConverter().convert(test, full=False) assert expected == html def test_escaped_explicit(self) -> None: test = "

awesome

" expected = "<p>awesome</p>" html = Ansi2HTMLConverter(escaped=True).convert(test, full=False) assert expected == html def test_unescaped(self) -> None: test = "

awesome

" expected = "

awesome

" html = Ansi2HTMLConverter(escaped=False).convert(test, full=False) assert expected == html def test_markup_lines(self) -> None: test = " wat \n " expected = ' wat \n ' html = Ansi2HTMLConverter(markup_lines=True).convert(test, full=False) assert expected == html def test_no_markup_lines(self) -> None: test = " wat \n " expected = test html = Ansi2HTMLConverter().convert(test, full=False) assert expected == html def test_issue_25(self) -> None: sample = "\x1b[0;38;5;238;48;5;231mTEXT\x1b[0m" html = Ansi2HTMLConverter(inline=False).convert(sample, full=False) expected = 'TEXT' assert expected == html def test_italic(self) -> None: sample = "\x1b[3mITALIC\x1b[0m" html = Ansi2HTMLConverter(inline=True).convert(sample, full=False) expected = 'ITALIC' assert expected == html def test_hidden_text(self) -> None: sample = "\x1b[%dmHIDDEN\x1b[%dmVISIBLE\x1b[0m" % ( ANSI_VISIBILITY_OFF, ANSI_VISIBILITY_ON, ) html = Ansi2HTMLConverter(inline=True).convert(sample, full=False) expected = 'HIDDENVISIBLE' assert expected == html def test_lighter_text(self) -> None: sample = "NORMAL\x1b[%dmLIGHTER\x1b[%dmBOLD\x1b[%dmNORMAL" % ( ANSI_INTENSITY_REDUCED, ANSI_INTENSITY_INCREASED, ANSI_INTENSITY_NORMAL, ) html = Ansi2HTMLConverter(inline=True).convert(sample, full=False) expected = 'NORMALLIGHTERBOLDNORMAL' assert expected == html def test_blinking_text(self) -> None: sample = "\x1b[%dm555\x1b[%dm666\x1b[%dmNOBLINK\x1b[0m" % ( ANSI_BLINK_SLOW, ANSI_BLINK_FAST, ANSI_BLINK_OFF, ) html = Ansi2HTMLConverter(inline=True).convert(sample, full=False) expected = '555666NOBLINK' assert expected == html html = Ansi2HTMLConverter(inline=False).convert(sample, full=False) expected = '555666NOBLINK' assert expected == html def test_inverse_text(self) -> None: sample = "NORMAL\x1b[%dmINVERSE\x1b[%dmNORMAL\x1b[0m" % ( ANSI_NEGATIVE_ON, ANSI_NEGATIVE_OFF, ) html = Ansi2HTMLConverter(inline=False).convert(sample, full=False) expected = ( 'NORMALINVERSENORMAL' ) assert expected == html sample = "NORMAL\x1b[%dm303030\x1b[%dm!30!30!30\x1b[%dm303030\x1b[0m" % ( 30, ANSI_NEGATIVE_ON, ANSI_NEGATIVE_OFF, ) html = Ansi2HTMLConverter(inline=False).convert(sample, full=False) expected = 'NORMAL303030!30!30!30303030' assert expected == html sample = ( "NORMAL\x1b[%dm313131\x1b[%dm!31!31!31\x1b[%dm!31!43\x1b[%dm31+43\x1b[0mNORMAL" % (31, ANSI_NEGATIVE_ON, 43, ANSI_NEGATIVE_OFF) ) html = Ansi2HTMLConverter(inline=False).convert(sample, full=False) expected = 'NORMAL313131!31!31!31!31!4331+43NORMAL' assert expected == html def test_cross_line_state(self) -> None: # covers issue 36, too sample = "\x1b[31mRED\nSTILL RED" html = Ansi2HTMLConverter(inline=True).convert( sample, full=False, ensure_trailing_newline=False ) expected = 'RED\nSTILL RED' assert expected == html sample = "\x1b[31mRED\nSTILL RED\n" html = Ansi2HTMLConverter(inline=True).convert( sample, full=False, ensure_trailing_newline=False ) expected = 'RED\nSTILL RED\n' assert expected == html sample = "\x1b[31mRED\nSTILL RED" html = Ansi2HTMLConverter(inline=True).convert( sample, full=False, ensure_trailing_newline=True ) expected = 'RED\nSTILL RED\n' assert expected == html sample = "\x1b[31mRED\nSTILL RED\n" html = Ansi2HTMLConverter(inline=True).convert( sample, full=False, ensure_trailing_newline=True ) expected = 'RED\nSTILL RED\n\n' assert expected == html sample = "\x1b[31mRED\nSTILL RED\x1b[m\n" html = Ansi2HTMLConverter(inline=True).convert( sample, full=False, ensure_trailing_newline=True ) expected = 'RED\nSTILL RED\n' assert expected == html def test_scheme(self) -> None: # covers issue 36, too sample = "\x1b[33mYELLOW/BROWN" # ansi2html scheme is brown #aa5500 html = Ansi2HTMLConverter(inline=True).convert( sample, full=False, ensure_trailing_newline=False ) expected = 'YELLOW/BROWN' assert expected == html # xterm scheme is yellow #cdcd00 html = Ansi2HTMLConverter(inline=True, scheme="xterm").convert( sample, full=False, ensure_trailing_newline=False ) expected = 'YELLOW/BROWN' assert expected == html def test_latex_inline(self) -> None: ansi = "\x1b[33mYELLOW/BROWN" target = "\\textcolor[HTML]{aa5500}{YELLOW/BROWN}" latex = Ansi2HTMLConverter(latex=True, inline=True).convert(ansi) assert target in latex def test_latex_title(self) -> None: ansi = "" title = "testing" target = "\\title{%s}" % title latex = Ansi2HTMLConverter(latex=True, inline=True, title=title).convert(ansi) assert target in latex def test_latex_linkify(self) -> None: ansi = "http://python.org/" target = "\\url{%s}" % ansi latex = Ansi2HTMLConverter(latex=True, inline=True, linkify=True).convert(ansi) assert target in latex def test_truecolor(self) -> None: ansi = ( "\u001b[38;2;255;102;102m 1 \u001b[0m " + "\u001b[38;2;0;0;255m 2 \u001b[0m " + "\u001b[48;2;65;105;225m 3 \u001b[0m" ) target = ( ' 1 ' + ' 2 ' + ' 3 ' ) html = Ansi2HTMLConverter().convert(ansi) assert target in html def test_truecolor_inline(self) -> None: ansi = ( "\u001b[38;2;255;102;102m 1 \u001b[0m " + "\u001b[38;2;0;0;255m 2 \u001b[0m " + "\u001b[48;2;65;105;225m 3 \u001b[0m" ) target = ( ' 1 ' + ' 2 ' + ' 3 ' ) html = Ansi2HTMLConverter(inline=True).convert(ansi) assert target in html def test_truecolor_malformed(self) -> None: ansi = "\u001b[38;2;255;102m malformed \u001b[0m " # ^ e.g. ";102" missed target = ' malformed ' html = Ansi2HTMLConverter().convert(ansi) assert target in html def test_256_color_malformed(self) -> None: ansi = "\u001b[38;5m malformed \u001b[0m " # ^ e.g. ";255" missed target = ' malformed ' html = Ansi2HTMLConverter().convert(ansi) assert target in html def test_x_bit_color_malformed(self) -> None: ansi = "\u001b[38m malformed \u001b[0m " # ^ e.g. ";5;255m" missed target = ' malformed ' html = Ansi2HTMLConverter().convert(ansi) assert target in html def test_command_script(self) -> None: result = run(["ansi2html", "--version"], check=True) assert result.returncode == 0 def test_command_input_output_encoding(self) -> None: input_encoding = "utf-16" input_bytes = "regular \033[31mred\033[0m regular".encode(input_encoding) output_encoding = "utf-32" output_bytes_expected = ( 'regular red regular\n'.encode( output_encoding ) ) with Popen( [ "ansi2html", "--inline", f"--input-encoding={input_encoding}", f"--output-encoding={output_encoding}", ], stdin=PIPE, stdout=PIPE, ) as process: assert process.stdin # for mypy assert process.stdout # for mypy process.stdin.write(input_bytes) process.stdin.close() stdout_bytes_actual = process.stdout.read() assert stdout_bytes_actual == output_bytes_expected assert process.returncode == 0 def test_command_module(self) -> None: result = run([sys.executable, "-m", "ansi2html", "--version"], check=True) assert result.returncode == 0 ansi2html-1.9.2/tox.ini000066400000000000000000000037571463560412000147540ustar00rootroot00000000000000[tox] minversion = 4.0.0 envlist = lint py pkg isolated_build = True [testenv] setenv = PYTHONWARNINGS=error::FutureWarning # Aim to replace with below once other issues are fixed: # PYTHONWARNINGS=error COVERAGE_FILE = {env:COVERAGE_FILE:{toxworkdir}/.coverage.{envname}} deps = pytest pytest-cov sitepackages = False usedevelop = True commands = python -m pytest -ra --cov=src/ --no-cov-on-fail --cov-append --cov-report=xml:{toxworkdir}/coverage-{envname}.xml [testenv:lint] description = Runs all linting tasks commands = # to run a single linter you can do "pre-commit run flake8" python -m pre_commit run {posargs:--all} deps = pre-commit>=1.18.1 extras = skip_install = true usedevelop = false [testenv:pkg] description = Do packaging/distribution. If tag is not present or PEP440 compliant upload to PYPI could fail # `usedevelop = true` overrides `skip_install` instruction, it's unwanted usedevelop = false # don't install molecule itself in this env skip_install = true deps = asciidoc >= 10.1.4 collective.checkdocs >= 0.2 build >= 0.7.0 pip >= 20.2.2 setuptools_scm >= 6.0.1 toml >= 0.10.1 twine >= 3.2.0 # pyup: ignore setenv = commands = rm -rfv {toxinidir}/dist/ python -m build \ --outdir {toxinidir}/dist/ \ {toxinidir} # metadata validation sh -c "python -m twine check --strict {toxinidir}/dist/*" allowlist_externals = rm sh [testenv:docs] description = Generate Sphinx docs under build/docs extras = docs commands = # Disabled due https://github.com/pycontribs/ansi2html/issues/193 ; sh -c 'a2x \ ; --verbose \ ; --no-xmllint \ ; --conf-file=man/asciidoc.conf \ ; --attribute="manual_package=ansi2html" \ ; --attribute="manual_title=ansi2html Manual" \ ; --attribute="manual_version=$(python3 -m setuptools_scm)" \ ; --format=manpage -D man \ ; man/ansi2html.1.txt' mkdocs {posargs:build --strict --site-dir=_readthedocs/html/}