Skip to content

Commit

Permalink
Improve t-001 and its test
Browse files Browse the repository at this point in the history
  • Loading branch information
vr8hub authored and acabal committed Oct 9, 2024
1 parent 93dd260 commit 91019a2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion se/se_epub_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -3822,7 +3822,7 @@ def lint(self, skip_lint_ignore: bool, allowed_messages: Optional[List[str]] = N
messages.append(LintMessage("c-006", f"Semantic found, but missing corresponding style in [path][link=file://{local_css_path}]local.css[/][/].", se.MESSAGE_TYPE_ERROR, local_css_path, sorted(set(missing_styles))))

for double_spaced_file in double_spaced_files:
messages.append(LintMessage("t-001", "Double spacing found. Sentences should be single-spaced. (Note that double spaces might include Unicode no-break spaces!)", se.MESSAGE_TYPE_ERROR, double_spaced_file))
messages.append(LintMessage("t-001", "Double spacing found. Sentences should be single-spaced. (Note that double spaces might include Unicode no-break and/or hair spaces!)", se.MESSAGE_TYPE_ERROR, double_spaced_file))

if missing_files:
messages.append(LintMessage("f-002", "Missing expected file or directory.", se.MESSAGE_TYPE_ERROR, self.metadata_file_path, missing_files))
Expand Down
3 changes: 2 additions & 1 deletion tests/lint/typography/t-001/golden/t-001-out.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
t-001 [Error] chapter-1.xhtml Double spacing found. Sentences should be
single-spaced. (Note that double spaces might include Unicode no-break spaces!)
single-spaced. (Note that double spaces might include Unicode no-break and/or
hair spaces!)
17 changes: 17 additions & 0 deletions tests/lint/typography/t-001/in/src/epub/text/chapter-1.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,24 @@
<body epub:type="bodymatter z3998:fiction">
<section id="chapter-1" epub:type="chapter">
<h2 epub:type="ordinal z3998:roman">I</h2>
<!-- VALID 1, no consecutive spaces, spaces only -->
<p>What we don't know for sure is whether or not before orchids, currents were only distributors. A briny swedish without celestes is truly a twine of ribless weasels. The sofas could be said to resemble rival yachts. In recent years, the soapless bit comes from a wiry health.</p>
<!-- VALID 2, no consecutive spaces, at least one hair space -->
<p>In modern times few can name a looser fridge that isn't a brazen china. The argentinas could be said to resemble eterne puppies. This could be, or perhaps alined waves show us how damages can be passives⁠ ⁠… Nowhere is it disputed that the literature would have us believe that a dumbstruck triangle is not but an engine.</p>
<!-- VALID 3, no consecutive spaces, at least one no-break space -->
<p>Carp are splashy activities. Before roasts, billboards were only flights. <abbr epub:type="z3998:name-title">Mr.</abbr> Smith was lost without the misused thunderstorm that composed his cord.</p>
<!-- VALID 4, no consecutive spaces, at least one each hair and no-break space -->
<p>The mechanic of a spy becomes a xanthous europe. Smith &amp; Jones is a libra. Few can name an unspoilt case that isn't a windy geranium. The suspect lace reveals itself as an unscathed wallet to those who look. “A legal of the loss is assumed to be a ‘dusky elbow.’ ”</p>
<!-- ERROR 1, two consecutive spaces -->
<p>We can assume that any instance of a point can be construed as a themeless fisherman. Framed in a different way, some picked shakes are thought of simply as crabs. Nowhere is it disputed that a dinner sees a modem as a warming customer. The zeitgeist contends that we can assume that any instance of a kenneth can be construed as an entranced belgian. A rotate is a gaumless debt.</p>
<!-- ERROR 2, consecutive space and hairspace -->
<p>Extending this logic, authors often misinterpret the plastic as a zealous mint, when in actuality it feels more like a  khaki sidecar. Their ticket was, in this moment, an ireful giraffe. A bee can hardly be considered an attached shape without also being a beaver. Few can name a creedal college that isn't a plastics christmas. A step-sister is a zone from the right perspective.</p>
<!-- ERROR 3, consecutive no-break space and space -->
<p>The degrees could be said to resemble swirly fertilizers. Far from the truth, <abbr epub:type="z3998:name-title">Mrs.</abbr>  Redmond is a stitch of the mind. A sugar of the crocodile is assumed to be a spheric parcel.</p>
<!-- ERROR 4, consecutive hairspace and no-break space -->
<p>The first kaput cuticle is, in its own way, a tree. A sunflower is an underwear from the right perspective. A flashy sprout's hydrant comes with it the thought that the deictic freon is a cheque. ⁠ ⁠… Some sonless elements are thought of simply as caravans.</p>
<!-- ERROR 5, consecutive spaces on either side of an HTML comment -->
<p>Far from the truth, an innocent sees a glue as an unposed thumb. A Thursday of the lier is assumed to be an honied donna. Nowhere <!-- HTML comment --> is it disputed that the widest rutabaga comes from a flamy kendo.</p>
</section>
</body>
</html>

0 comments on commit 91019a2

Please sign in to comment.