Skip to content

Commit 4c2b2d6

Browse files
committed
Copilot floundering
1 parent cabdb42 commit 4c2b2d6

2 files changed

Lines changed: 42 additions & 1 deletion

File tree

.github/workflows/mkdocsbuild.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
css = css_path.read_text(encoding="utf-8")
4444
4545
# Ensure the first rendered code block is still multiline in generated HTML.
46-
match = re.search(r'<div class="highlight"><pre><span></span><code>(.*?)</code></pre></div>', html, re.DOTALL)
46+
match = re.search(r'<div class="language-\w+ highlight"><pre><span></span><code>(.*?)</code></pre></div>', html, re.DOTALL)
4747
if not match:
4848
print("Could not locate a rendered fenced code block in passing-loop page")
4949
sys.exit(1)

test_regression.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
from pathlib import Path
2+
import re
3+
import sys
4+
5+
html_path = Path("site/products/ex-commandstation/exrail/cookbooks/driving-trains/passing-loop/index.html")
6+
css_path = Path("site/_static/css/dccex_theme.css")
7+
8+
if not html_path.exists():
9+
print(f"Missing expected page: {html_path}")
10+
sys.exit(1)
11+
if not css_path.exists():
12+
print(f"Missing expected stylesheet: {css_path}")
13+
sys.exit(1)
14+
15+
html = html_path.read_text(encoding="utf-8")
16+
css = css_path.read_text(encoding="utf-8")
17+
18+
# Ensure the first rendered code block is still multiline in generated HTML.
19+
match = re.search(r'<div class="language-\w+ highlight"><pre><span></span><code>(.*?)</code></pre></div>', html, re.DOTALL)
20+
if not match:
21+
print("Could not locate a rendered fenced code block in passing-loop page")
22+
# Let's look for what we actually have
23+
highlight_match = re.search(r'<div class="highlight">(.*?)</div>', html, re.DOTALL)
24+
if highlight_match:
25+
print("\nFound highlight div with content (first 500 chars):")
26+
content = highlight_match.group(1)[:500]
27+
print(content)
28+
print("\n...")
29+
else:
30+
print("\nNo highlight divs found at all")
31+
sys.exit(1)
32+
if "\n" not in match.group(1):
33+
print("Rendered fenced code block no longer contains line breaks")
34+
sys.exit(1)
35+
36+
# Ensure our CSS safeguard that preserves preformatted line breaks is present.
37+
if "white-space: pre !important;" not in css:
38+
print("Missing white-space safeguard for code blocks in compiled CSS")
39+
sys.exit(1)
40+
41+
print("Regression checks passed: multiline code block and CSS safeguard present")

0 commit comments

Comments
 (0)