chore(reading): lint-clean lift — local renames, tab escape, DOX pass (#76)
Spike-locals renamed at lift time (identifier_name), literal tab in a string escape fixed (unprintable-ASCII build error), swiftlint force_try disable for the static regex. AGENTS.md reading-mode section rewritten for the apex HTML pipeline; native-only Work Guidance line rescoped to the editing side per ADR-0011.
This commit is contained in:
1 parent
cc04ec236e
commit
f1c915fed1
5 files changed
+111
-83
No files matched your search
@@ -18,14 +18,14 @@ struct ReadingPresenterTests {
|
||||
/// Chunker: sentinels before chunks, blank structure preserved (spike
|
||||
/// self-check fixture).
|
||||
@Test
|
||||
func chunkerStampsSentinels() {
|
||||
func `chunker stamps sentinels`() {
|
||||
let md = "# T\n\nA\n\nB\n1. x\n\n\nC"
|
||||
#expect(ReadingPresenter.stampSource(md) == "<!--S:1-->\n# T\n\n<!--S:3-->\nA\n\n<!--S:5-->\nB\n1. x\n\n<!--S:9-->\nC")
|
||||
}
|
||||
|
||||
/// Stamper: sentinel → attribute on the following element; multi-digit.
|
||||
@Test
|
||||
func stamperRewritesAttributes() {
|
||||
func `stamper rewrites attributes`() {
|
||||
let html = "<h1>T</h1>\n<!--S:1-->\n<p>A</p>\n<!--S:12-->\n<ul>\n<li>B</li>\n</ul>"
|
||||
#expect(ReadingPresenter.stampHTML(html) == "<h1>T</h1>\n<p data-source-line=\"1\">A</p>\n<ul data-source-line=\"12\">\n<li>B</li>\n</ul>")
|
||||
}
|
||||
@@ -33,7 +33,7 @@ struct ReadingPresenterTests {
|
||||
/// The #68 click→edit map: blocks are monotonic, lines are 1-based, and
|
||||
/// ranges point at the exact chunk offsets in the source.
|
||||
@Test
|
||||
func blocksMapChunks() {
|
||||
func `blocks map chunks`() {
|
||||
let src = "# A\n\nfirst para\n\n- l1\n- l2\n\nlast para"
|
||||
let blocks = ReadingPresenter.blocks(for: src)
|
||||
#expect(blocks.count == 4)
|
||||
@@ -45,7 +45,7 @@ struct ReadingPresenterTests {
|
||||
|
||||
/// Blocks over CRLF and multi-blank separators stay monotonic.
|
||||
@Test
|
||||
func blocksSurviveBlankRuns() {
|
||||
func `blocks survive blank runs`() {
|
||||
let src = "one\n\n\n\n two"
|
||||
let blocks = ReadingPresenter.blocks(for: src)
|
||||
#expect(blocks.count == 2)
|
||||
@@ -57,7 +57,7 @@ struct ReadingPresenterTests {
|
||||
|
||||
/// Headings + paragraphs + inline marks render; markup never leaks.
|
||||
@Test
|
||||
func pipelineHeadingsAndInline() throws {
|
||||
func `pipeline headings and inline`() throws {
|
||||
let (html, blocks) = ReadingPresenter.page(for: "# Title\n\nBody with _em_ and `code`.", postFolder: nil)
|
||||
try assertRendered(html, blocks: blocks, count: 2)
|
||||
#expect(html.contains("<h1 data-source-line=\"1\""))
|
||||
@@ -68,7 +68,7 @@ struct ReadingPresenterTests {
|
||||
|
||||
/// `1. 1. 1.` renumbers via native <ol> (the #69 hard requirement).
|
||||
@Test
|
||||
func pipelineOrderedRenumber() throws {
|
||||
func `pipeline ordered renumber`() throws {
|
||||
let src = "1. one\n1. two\n1. three"
|
||||
let (html, blocks) = ReadingPresenter.page(for: src, postFolder: nil)
|
||||
try assertRendered(html, blocks: blocks, count: 1)
|
||||
@@ -82,7 +82,7 @@ struct ReadingPresenterTests {
|
||||
/// `--no-mixed-lists`: an ordered list after a bullet list stays two
|
||||
/// lists (default apex merges them — kills renumbering).
|
||||
@Test
|
||||
func pipelineMixedListsStaySplit() throws {
|
||||
func `pipeline mixed lists stay split`() {
|
||||
let src = "- bullet\n- another\n\n1. one\n1. two"
|
||||
let (html, _) = ReadingPresenter.page(for: src, postFolder: nil)
|
||||
#expect(html.contains("<ul"))
|
||||
@@ -92,7 +92,7 @@ struct ReadingPresenterTests {
|
||||
|
||||
/// Tables, quotes, fenced code, HR, links — the #69 set on one page.
|
||||
@Test
|
||||
func pipelineConstructs() throws {
|
||||
func `pipeline constructs`() throws {
|
||||
let src = """
|
||||
| A | B |
|
||||
| --- | --- |
|
||||
@@ -121,7 +121,7 @@ struct ReadingPresenterTests {
|
||||
|
||||
/// Images embed as base64 data URLs against the post folder (#69/#74).
|
||||
@Test
|
||||
func pipelineImageEmbeds() throws {
|
||||
func `pipeline image embeds`() throws {
|
||||
let prose = URL(fileURLWithPath: #filePath) // …/MuseionTests/ReadingPresenterTests.swift
|
||||
.deletingLastPathComponent().deletingLastPathComponent()
|
||||
.appendingPathComponent("spike/prose")
|
||||
@@ -133,7 +133,7 @@ struct ReadingPresenterTests {
|
||||
|
||||
/// Footnotes render natively (apex upgrade over #69's fallback).
|
||||
@Test
|
||||
func pipelineFootnotes() throws {
|
||||
func `pipeline footnotes`() {
|
||||
let src = "Text with note[^1]\n\n[^1]: the note"
|
||||
let (html, _) = ReadingPresenter.page(for: src, postFolder: nil)
|
||||
#expect(html.contains("footnote"))
|
||||
@@ -142,14 +142,14 @@ struct ReadingPresenterTests {
|
||||
|
||||
/// Fallback: apex failure → editing-treated source (#69 rule), escaped.
|
||||
@Test
|
||||
func fallbackIsSourceText() {
|
||||
func `fallback is source text`() {
|
||||
let page = ReadingPresenter.fallbackPage("a < b & c > d")
|
||||
#expect(page.contains("<pre data-source-line=\"1\">a < b & c > d</pre>"))
|
||||
}
|
||||
|
||||
/// The stylesheet carries the live slot values as CSS variables.
|
||||
@Test
|
||||
func stylesheetCarriesSlots() {
|
||||
func `stylesheet carries slots`() {
|
||||
let css = ReadingPresenter.styleSheet()
|
||||
#expect(css.contains("--body-face:"))
|
||||
#expect(css.contains("--headings-size:"))
|
||||
@@ -167,7 +167,7 @@ struct ReadingPresenterTests {
|
||||
}
|
||||
|
||||
/// Regex count helper (Swift Testing has no XCTest import here).
|
||||
private func XCTRegexMatches(_ s: String, pattern: String) throws -> Int {
|
||||
let re = try NSRegularExpression(pattern: pattern)
|
||||
return re.numberOfMatches(in: s, range: NSRange(s.startIndex..., in: s))
|
||||
private func XCTRegexMatches(_ text: String, pattern: String) throws -> Int {
|
||||
let regex = try NSRegularExpression(pattern: pattern)
|
||||
return regex.numberOfMatches(in: text, range: NSRange(text.startIndex..., in: text))
|
||||
}
|
||||
Reference in new issue
Block a user