Skip to content

Commit

Permalink
Make se.css linting path variable unique
Browse files Browse the repository at this point in the history
Doesn’t break anything as it stands as it overrides the earlier core_css_path_name, but we might as well match the process for the rest of the checks.
  • Loading branch information
robinwhittleton committed Jun 10, 2024
1 parent b3397bc commit 15aa6be
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions se/se_epub_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
"f-011", "JPEG files must end in [path].jpg[/]."
"f-012", "TIFF files must end in [path].tif[/]."
"f-013", "Glossary search key map must be named [path]glossary-search-key-map.xml[/]."
"f-014", f"File does not match [path][link=file://{self.path / 'src/epub/css/se.css'}]{core_css_file_path}[/][/]."
"f-014", f"File does not match [path][link=file://{se_css_file_path}]{se_css_file_path}[/][/]."
"f-015", "Filename doesn’t match [attr]id[/] attribute of primary [xhtml]<section>[/] or [xhtml]<article>[/]. Hint: [attr]id[/] attributes don’t include the file extension."
"f-016", "Image more than 1.5MB in size."
"f-017", f"[path][link=file://{self.path / 'images/cover.jpg'}]cover.jpg[/][/] must be exactly {se.COVER_WIDTH} × {se.COVER_HEIGHT}."
Expand Down Expand Up @@ -3414,9 +3414,9 @@ def lint(self, skip_lint_ignore: bool, allowed_messages: Optional[List[str]] = N
missing_files.append("text/uncopyright.xhtml")

try:
with importlib.resources.as_file(importlib.resources.files("se.data.templates").joinpath("se.css")) as core_css_file_path:
if not filecmp.cmp(core_css_file_path, self.content_path / "css/se.css"):
messages.append(LintMessage("f-014", f"File does not match [path][link=file://{self.path / 'src/epub/css/se.css'}]{core_css_file_path}[/][/].", se.MESSAGE_TYPE_ERROR, self.content_path / "css/se.css"))
with importlib.resources.as_file(importlib.resources.files("se.data.templates").joinpath("se.css")) as se_css_file_path:
if not filecmp.cmp(se_css_file_path, self.content_path / "css/se.css"):
messages.append(LintMessage("f-014", f"File does not match [path][link=file://{se_css_file_path}]{se_css_file_path}[/][/].", se.MESSAGE_TYPE_ERROR, self.content_path / "css/se.css"))
except Exception:
missing_files.append("css/se.css")

Expand Down

0 comments on commit 15aa6be

Please sign in to comment.