Skip to content

Commit

Permalink
BUMP-VERSION: 0.7.0 (was: 0.6.0)
Browse files Browse the repository at this point in the history
Add diagnostic support:
* Use environment variable SPHINXCONTRIB_ANSI_DIAG=yes to enable it.
  • Loading branch information
jenisys committed Nov 4, 2020
1 parent 99da1fd commit 324e62d
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ MANIFEST
.cache
.hypothesis/
.pytest_cache/
py*-tests.xml


# Sphinx documentation
docs/_build/
Expand Down
14 changes: 14 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -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)
=================

Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
22 changes: 20 additions & 2 deletions sphinxcontrib/ansi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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):
"""
Expand Down Expand Up @@ -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()]
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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,
}

0 comments on commit 324e62d

Please sign in to comment.