Skip to content

Commit

Permalink
Merge pull request #7 from adamtheturtle/type-list
Browse files Browse the repository at this point in the history
Change type of `substitution` to `List`
  • Loading branch information
adamtheturtle authored Nov 12, 2018
2 parents 7c9bb15 + 2db3780 commit e2e2d6b
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 9 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ install:
cache: pip
script:
- make lint
- make sample
- pytest -s -vvv --cov=src/ --cov=tests tests/
after_success:
- codecov
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Changelog
Next
----

- Make ``substitution`` a list, not a tuple.

2018.11.12.2
------------

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ fix-lint:

.PHONY: sample
sample:
sphinx-build -b html sample/source sample/build
sphinx-build -W -b html sample/source sample/build
python -c 'import os, webbrowser; webbrowser.open("file://" + os.path.abspath("sample/build/contents.html"))'
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ Setup

.. code:: python
substitutions = (
substitutions = [
('|release|', '0.1'),
('|author|', 'Eleanor'),
)
]
This will replace ``|release|`` in the new directives with ``0.1``, and ``|author|`` with ``Eleanor``.

Expand Down
2 changes: 1 addition & 1 deletion sample/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
]

_substitution_pair = ('|author|', 'Eleanor')
substitutions = (_substitution_pair, )
substitutions = [_substitution_pair]
2 changes: 1 addition & 1 deletion src/sphinx_substitution_extensions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@ def setup(app: Sphinx) -> None:
"""
Add the custom directives to Sphinx.
"""
app.add_config_value('substitutions', (), 'html')
app.add_config_value('substitutions', [], 'html')
app.add_directive('substitution-prompt', SubstitutionPrompt)
app.add_directive('substitution-code-block', SubstitutionCodeBlock)
8 changes: 4 additions & 4 deletions tests/test_substitution_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ def test_substitution_prompt(tmpdir: local) -> None:
conf_py_content = dedent(
"""\
extensions = ['sphinx_substitution_extensions']
substitutions = (
substitutions = [
('|a|', 'example_substitution'),
)
]
""",
)
conf_py.write(conf_py_content)
Expand Down Expand Up @@ -66,9 +66,9 @@ def test_substitution_code_block(tmpdir: local) -> None:
conf_py_content = dedent(
"""\
extensions = ['sphinx_substitution_extensions']
substitutions = (
substitutions = [
('|a|', 'example_substitution'),
)
]
""",
)
conf_py.write(conf_py_content)
Expand Down

0 comments on commit e2e2d6b

Please sign in to comment.