Skip to content

Commit bb25b75

Browse files
authored
Self-Test: Ignore width space after em dash (#654)
AsciiDoctor spits out an em dash when there is an em dash between two words. This is kind of a pleasant surprise because it makes it clear that we can break words after the em dash. This change teaches the `html_diff` utility that we use for finding differences in pages that this particular zero width space doesn't count as a difference.
1 parent 38f60f3 commit bb25b75

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

integtest/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ check: \
1212
style \
1313
minimal_expected_files minimal_same_files \
1414
includes_expected_files includes_same_files \
15+
emdash_expected_files emdash_same_files \
1516
beta_expected_files beta_same_files \
1617
experimental_expected_files experimental_same_files \
1718
missing_include_fails_asciidoc missing_include_fails_asciidoctor \

integtest/emdash.asciidoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
= Title
2+
3+
== Chapter
4+
5+
I have an em dash between some--words.

integtest/html_diff

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ def normalize_html(html):
3131
# Remove the zero width space that asciidoctor adds after each horizontal
3232
# ellipsis. They don't hurt anything but asciidoc doesn't make them
3333
html = html.replace('\u2026\u200b', '\u2026')
34+
# Remove the zero width space that asciidoctor adds after each em dash that
35+
# is between words. They are actively nice to have but asciidoc doesn't
36+
# make them.
37+
html = html.replace('\u2014\u200b', '\u2014')
3438
# Temporary workaround for known issues
3539
html = re.sub(
3640
r'(?m)^\s+<div class="console_widget" data-snippet="[^"]+">'

0 commit comments

Comments
 (0)