Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warning about invalid escape sequence in docstring #683

Merged
merged 2 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ford/_markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def convert(


class AliasPreprocessor(Preprocessor):
"""Substitute text aliases of the form ``|foo|`` from a dictionary
r"""Substitute text aliases of the form ``|foo|`` from a dictionary
of aliases and their replacements.
The backslash ``\`` acts as an escape character, aliases of the
form ``\|foo|`` will not be replaced, but instead copied verbatim
Expand All @@ -157,8 +157,8 @@ def run(self, lines: List[str]) -> List[str]:
# replace the real aliases
line = self.ALIAS_RE.sub(self._lookup, line)
# replace the escaped aliases verbatim, without the preceding `\`
line = re.sub(r"\\(\|([^ ].*?[^ ]?)\|)", r"\g<1>",line)
lines[line_num]=line
line = re.sub(r"\\(\|([^ ].*?[^ ]?)\|)", r"\g<1>", line)
lines[line_num] = line
return lines


Expand Down
3 changes: 1 addition & 2 deletions ford/intrinsics.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""This module just has a big list of the intrinsic functions to save space in sourceform.py
"""
"""This module just has a big list of the intrinsic functions to save space in sourceform.py"""

INTRINSICS = [
"abort",
Expand Down
2 changes: 1 addition & 1 deletion ford/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def __init__(self, settings: ProjectSettings, proj_docs: str, project, pagetree)
# Also, in future for other template, we may not need to
# pass the data obj.
env.globals["projectData"] = asdict(settings)
env.loader=jinja2.FileSystemLoader(
env.loader = jinja2.FileSystemLoader(
settings.html_template_dir + [loc / "templates"]
)

Expand Down
1 change: 1 addition & 0 deletions ford/tipue_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@

from ford.settings import EntitySettings


class Tipue_Search_JSON_Generator:
def __init__(self, output_path: os.PathLike, project_url: str):
self.output_path = pathlib.Path(output_path)
Expand Down
3 changes: 1 addition & 2 deletions test/test_markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def test_sub_alias():


def test_sub_alias_escape():
def_alias={"a":"b"}
def_alias = {"a": "b"}

result = MetaMarkdown(aliases=def_alias).convert("\|a|")
assert result == "<p>|a|</p>"
Expand All @@ -24,7 +24,6 @@ def test_sub_alias_escape():
assert result == "<p>|undefined|</p>"



def test_sub_alias_with_equals():
result = MetaMarkdown(aliases={"a": "b=c"}).convert("|a|")

Expand Down
Loading