Skip to content

Commit

Permalink
python 3.5 test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjsewell committed Feb 26, 2020
1 parent 89d602a commit 5f09f73
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions myst_parser/docutils_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ def run(self):
from docutils.parsers.rst.directives.body import CodeBlock, NumberLines

if not self.document.settings.file_insertion_enabled:
raise DirectiveError(2, f'Directive "{self.name}" disabled.')
raise DirectiveError(2, 'Directive "{}" disabled.'.format(self.name))

source_dir = Path(self.document["source"]).absolute().parent
include_arg = "".join([s.strip() for s in self.arguments[0].splitlines()])
Expand All @@ -848,7 +848,10 @@ def run(self):
file_content = path.read_text(encoding=encoding, errors=error_handler)
except Exception as error:
raise DirectiveError(
4, f'Directive "{self.name}": error reading file: {path}\n{error}.'
4,
'Directive "{}": error reading file: {}\n{error}.'.format(
self.name, path, error
),
)

# get required section of text
Expand All @@ -863,8 +866,9 @@ def run(self):
if split_index < 0:
raise DirectiveError(
4,
f'Directive "{self.name}"; option "{split_on_type}": '
f'text not found "{split_on}".',
'Directive "{}"; option "{}": text not found "{}".'.format(
self.name, split_on_type, split_on
),
)
if split_on_type == "start-after":
file_content = file_content[split_index + len(split_on) :]
Expand Down

0 comments on commit 5f09f73

Please sign in to comment.