From 324e62dbb6bf6c78d1a2e1408a4f772d69330090 Mon Sep 17 00:00:00 2001 From: jenisys Date: Wed, 4 Nov 2020 14:55:17 +0100 Subject: [PATCH] BUMP-VERSION: 0.7.0 (was: 0.6.0) Add diagnostic support: * Use environment variable SPHINXCONTRIB_ANSI_DIAG=yes to enable it. --- .gitignore | 2 ++ CHANGES.rst | 14 ++++++++++++++ setup.py | 4 ++-- sphinxcontrib/ansi.py | 22 ++++++++++++++++++++-- 4 files changed, 38 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index daeba53..e50cd58 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,8 @@ MANIFEST .cache .hypothesis/ .pytest_cache/ +py*-tests.xml + # Sphinx documentation docs/_build/ diff --git a/CHANGES.rst b/CHANGES.rst index f2d1d3c..3a3a474 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,17 @@ +0.7.0 (UNRELEASED) +===================== + +- docs: Changed URLs to github repository. +- Add support for sphinx >= 2.0 +- Add support for newer python3 versions. +- test: Fixed tests. + +RELATED: + +- OFFICIAL NEW REPO: https://github.com/sphinx-contrib/ansi +- https://pypi.org/project/sphinxcontrib-ansi/0.6.dev20201023/ + (tag missing; NOT REFLECTED on branch=master) + 0.6 (Jul 8, 2011) ================= diff --git a/setup.py b/setup.py index 1913208..90d3571 100644 --- a/setup.py +++ b/setup.py @@ -29,11 +29,11 @@ with open('README.rst') as stream: long_desc = stream.read() -requires = ['Sphinx>=1.0b2'] +requires = ['sphinx>=1.0'] setup( name='sphinxcontrib-ansi', - version='0.6.1', + version='0.7.0', url='https://github.com/sphinx-contrib/ansi', download_url='http://pypi.org/project/sphinxcontrib-ansi', license='BSD', diff --git a/sphinxcontrib/ansi.py b/sphinxcontrib/ansi.py index dd89467..99eceb3 100644 --- a/sphinxcontrib/ansi.py +++ b/sphinxcontrib/ansi.py @@ -34,8 +34,10 @@ """ from __future__ import absolute_import, print_function -import re +import logging +import os from os import path +import re from docutils import nodes from docutils.parsers import rst @@ -46,6 +48,13 @@ __version__ = '0.7.0' +# -- DIAGNOSTIC SUPPORT: +DIAG = os.environ.get("SPHINXCONTRIB_ANSI_DIAG", "no") == "yes" +console = logging.getLogger("sphinxcontrib.ansi") +console.setLevel(logging.ERROR) +if DIAG: + console.setLevel(logging.INFO) + class ansi_literal_block(nodes.literal_block): """ @@ -125,6 +134,8 @@ def _colorize_block_contents(self, block): # this holds the end of the last regex match last_end = 0 # iterate over all color codes + console.warn("\nANSI_COLORIZE.block:\n{}\nANSI_COLORIZE.block.end\n".format(raw)) + for match in COLOR_PATTERN.finditer(raw): # add any text preceeding this match head = raw[last_end:match.start()] @@ -173,7 +184,8 @@ def __call__(self, app, doctree, docname): def add_stylesheet(app): if app.config.html_ansi_stylesheet: # -- RemovedInSphinx40Warning: - # The app.add_stylesheet() is deprecated. Please use app.add_css_file() instead. + # The app.add_stylesheet() is deprecated. + # Please use app.add_css_file() instead. if hasattr(app, 'add_css_file'): app.add_css_file('ansi.css') else: @@ -225,3 +237,9 @@ def setup(app): app.connect('builder-inited', add_stylesheet) app.connect('build-finished', copy_stylesheet) app.connect('doctree-resolved', ANSIColorParser()) + + return { + 'version': __version__, + 'parallel_read_safe': True, + 'parallel_write_safe': True, + }