Skip to content

Commit

Permalink
Deploy: 0.3.3 (#54)
Browse files Browse the repository at this point in the history
* force mistune to version 0.8.4 (#43)

closes #42 
closes #40

* pin

* Remove calls to ErrorString and SafeString removed in docutils 0.19 (#49)

* remove python2

* fix pipelines

* fix linter pipeline

* set language for sphinx

* fix tests pipeline

* fix pipeline, set docutiles dependency

* why did I change this

* bump

Co-authored-by: Ezequiel Rosas <nhtzr.rg@gmail.com>
Co-authored-by: Ian Glen <ian@ianglen.me>
  • Loading branch information
3 people committed Aug 11, 2022
1 parent d169644 commit e609984
Show file tree
Hide file tree
Showing 12 changed files with 85 additions and 83 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.3.2
current_version = 0.3.3
commit = False
tag = False

Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/linter.yml
Expand Up @@ -3,15 +3,17 @@ name: Run linters and formatters
on: [push]

jobs:
deploy:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install dependencies
- name: Install nox
run: pip install nox
- name: Install dependencies
run: pip install -r requirements-dev.txt
- name: Run cop session
run: nox --sessions cop
run: nox --sessions cop
4 changes: 2 additions & 2 deletions .github/workflows/sphinx_building.yml
Expand Up @@ -3,7 +3,7 @@ name: Check sphinx building
on: [push]

jobs:
deploy:
sphinx_building:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -16,4 +16,4 @@ jobs:
- name: Build with an old sphinx version
run: nox --sessions test_sphinx_old_build
- name: Build with latest sphinx version
run: nox --sessions test_sphinx_build
run: nox --sessions test_sphinx_build
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.5, 3.6, 3.7, 3.8, 3.9, '3.10.0-beta.4']
python-version: [3.7, 3.8, 3.9, "3.10"]

steps:
- uses: actions/checkout@v2
Expand Down
20 changes: 5 additions & 15 deletions .pre-commit-config.yaml
@@ -1,29 +1,25 @@
repos:
- repo: git://github.com/pre-commit/pre-commit-hooks
rev: v2.5.0
hooks:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: trailing-whitespace
- id: requirements-txt-fixer
- repo: local
hooks:
- id: flake8
name: flake8
entry: flake8
language: system
types: [python]
args: [--max-line-length=88]
exclude: (docs|tests)/*
- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.0.6
hooks:
- id: isort
name: isort
entry: isort
language: system
types: [python]
args: [--multi-line=3,--trailing-comma,--force-grid-wrap=0,--use-parentheses,--line-width=88]
exclude: (docs|tests)/*
- repo: https://github.com/psf/black
rev: 19.10b0
hooks:
- id: black
name: black
entry: black
Expand All @@ -32,18 +28,12 @@ repos:
args: []
language_version: python3.7
exclude: (docs|tests)/*
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.770
hooks:
- id: mypy
name: mypy
entry: mypy
language: system
types: [python]
exclude: (tests|docs)/*
- repo: https://github.com/pre-commit/mirrors-pylint
rev: v2.4.4
hooks:
- id: pylint
name: pylint
entry: pylint
Expand Down
4 changes: 4 additions & 0 deletions CHANGES.md
@@ -1,3 +1,7 @@
### Version 0.3.3 (2022-08-11)
* Drop support for all python versions prior to 3.7
* Upgrade to docutils 0.19

### Version 0.3.2 (2021-12-10)
* Pin mistune version

Expand Down
79 changes: 40 additions & 39 deletions docs/conf.py
Expand Up @@ -13,8 +13,10 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys
import os
import sys

from m2r2 import __version__ as __m2r2_version__

sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

Expand All @@ -32,24 +34,23 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.mathjax',
'sphinx.ext.viewcode',
'sphinx.ext.githubpages',
'm2r2',
"sphinx.ext.autodoc",
"sphinx.ext.mathjax",
"sphinx.ext.viewcode",
"sphinx.ext.githubpages",
"m2r2",
]

from m2r2 import __version__ as __m2r2_version__

suppress_warnings = ['image.nonlocal_uri']
suppress_warnings = ["image.nonlocal_uri"]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
# source_suffix = ['.rst', '.md']
source_suffix = '.md'
source_suffix = ".md"
no_underscore_emphasis = True
m2r_parse_relative_links = True
m2r_anonymous_references = False
Expand All @@ -59,12 +60,12 @@
# source_encoding = 'utf-8-sig'

# The master toctree document.
master_doc = 'index'
master_doc = "index"

# General information about the project.
project = 'M2R2'
copyright = '2016, Hiroyuki Takagi'
author = 'Hiroyuki Takagi'
project = "M2R2"
copyright = "2016, Hiroyuki Takagi"
author = "Hiroyuki Takagi"

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand All @@ -80,7 +81,7 @@
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
language = "en"

# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
Expand All @@ -91,7 +92,7 @@
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

# The reST default role (used for this markup: `text`) to use for all
# documents.
Expand All @@ -109,7 +110,7 @@
# show_authors = False

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = "sphinx"

# A list of ignored prefixes for module index sorting.
# modindex_common_prefix = []
Expand All @@ -125,22 +126,22 @@

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'alabaster'
html_theme = "alabaster"

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
html_theme_options = {
'description': 'Markdown mixed to reST',
'github_user': 'CrossNox',
'github_repo': 'm2r2',
'github_banner': True,
'github_type': 'mark',
'github_count': False,
'font_family': '"Charis SIL", "Noto Serif", serif',
'head_font_family': 'Lato, sans-serif',
'code_font_family': '"Code new roman", "Ubuntu Mono", monospace',
'code_font_size': '1rem',
"description": "Markdown mixed to reST",
"github_user": "CrossNox",
"github_repo": "m2r2",
"github_banner": True,
"github_type": "mark",
"github_count": False,
"font_family": '"Charis SIL", "Noto Serif", serif',
"head_font_family": "Lato, sans-serif",
"code_font_family": '"Code new roman", "Ubuntu Mono", monospace',
"code_font_size": "1rem",
}

# Add any paths that contain custom themes here, relative to this directory.
Expand All @@ -165,7 +166,7 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = ["_static"]

# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
Expand All @@ -183,7 +184,7 @@

# Custom sidebar templates, maps document names to template names.
html_sidebars = {
'**': ['about.html', 'navigation.html', 'relations.html', 'searchbox.html',]
"**": ["about.html", "navigation.html", "relations.html", "searchbox.html",]
}

# Additional templates that should be rendered to pages, maps page names to
Expand Down Expand Up @@ -232,7 +233,7 @@
# html_search_scorer = 'scorer.js'

# Output file base name for HTML help builder.
htmlhelp_basename = 'M2Rdoc'
htmlhelp_basename = "M2Rdoc"

# -- Options for LaTeX output ---------------------------------------------

Expand All @@ -251,7 +252,7 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'M2R.tex', 'M2R Documentation', 'Hiroyuki Takagi', 'manual'),
(master_doc, "M2R.tex", "M2R Documentation", "Hiroyuki Takagi", "manual"),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -279,7 +280,7 @@

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [(master_doc, 'm2r', 'M2R Documentation', [author], 1)]
man_pages = [(master_doc, "m2r", "M2R Documentation", [author], 1)]

# If true, show URL addresses after external links.
# man_show_urls = False
Expand All @@ -293,12 +294,12 @@
texinfo_documents = [
(
master_doc,
'M2R',
'M2R Documentation',
"M2R",
"M2R Documentation",
author,
'M2R',
'One line description of project.',
'Miscellaneous',
"M2R",
"One line description of project.",
"Miscellaneous",
),
]

Expand All @@ -316,4 +317,4 @@


# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'https://docs.python.org/': None}
intersphinx_mapping = {"https://docs.python.org/": None}
28 changes: 19 additions & 9 deletions m2r2.py
Expand Up @@ -11,9 +11,8 @@

import mistune
from docutils import io, nodes, statemachine, utils
from docutils.core import ErrorString
from docutils.parsers import rst
from docutils.utils import SafeString, column_width
from docutils.utils import column_width
from pkg_resources import get_distribution

__version__ = get_distribution("m2r2").version
Expand Down Expand Up @@ -81,9 +80,18 @@ def parse_options():


class RestBlockGrammar(mistune.BlockGrammar):
directive = re.compile(r"^( *\.\..*?)\n(?=\S)", re.DOTALL | re.MULTILINE,)
oneline_directive = re.compile(r"^( *\.\..*?)$", re.DOTALL | re.MULTILINE,)
rest_code_block = re.compile(r"^::\s*$", re.DOTALL | re.MULTILINE,)
directive = re.compile(
r"^( *\.\..*?)\n(?=\S)",
re.DOTALL | re.MULTILINE,
)
oneline_directive = re.compile(
r"^( *\.\..*?)$",
re.DOTALL | re.MULTILINE,
)
rest_code_block = re.compile(
r"^::\s*$",
re.DOTALL | re.MULTILINE,
)


class RestBlockLexer(mistune.BlockLexer):
Expand Down Expand Up @@ -621,12 +629,12 @@ def run(self):
raise self.severe(
'Problems with "%s" directive path:\n'
'Cannot encode input file path "%s" '
"(wrong locale?)." % (self.name, SafeString(path))
"(wrong locale?)." % (self.name, str(path))
)
except IOError as error:
raise self.severe(
'Problems with "%s" directive path:\n%s.'
% (self.name, ErrorString(error))
% (self.name, io.error_string(error))
)

# read from the file
Expand All @@ -640,7 +648,7 @@ def run(self):
rawtext = include_file.read()
except UnicodeError as error:
raise self.severe(
'Problem with "%s" directive:\n%s' % (self.name, ErrorString(error))
'Problem with "%s" directive:\n%s' % (self.name, io.error_string(error))
)

config = self.state.document.settings.env.config
Expand Down Expand Up @@ -676,7 +684,9 @@ def setup(app):
app.add_source_parser(M2RParser)
app.add_directive("mdinclude", MdInclude)
metadata = dict(
version=__version__, parallel_read_safe=True, parallel_write_safe=True,
version=__version__,
parallel_read_safe=True,
parallel_write_safe=True,
)
return metadata

Expand Down
4 changes: 4 additions & 0 deletions mypy.ini
@@ -0,0 +1,4 @@
[mypy]

ignore_missing_imports = True
follow_imports = skip

0 comments on commit e609984

Please sign in to comment.