summaryrefslogtreecommitdiff
path: root/Hutch/Views/Repositories
diff options
context:
space:
mode:
authorChristian Cleberg <[email protected]>2026-03-30 17:20:15 -0500
committerChristian Cleberg <[email protected]>2026-03-30 17:20:15 -0500
commitd897109d0d23560bf19ece6ea1122b1229f3b164 (patch)
tree1202221e2100528b2147eaecbfa8fbd727fe02d3 /Hutch/Views/Repositories
parentda81b67dc8b74fdef6691d79ba06b28712c8b046 (diff)
downloadhutch-d897109d0d23560bf19ece6ea1122b1229f3b164.tar.gz
hutch-d897109d0d23560bf19ece6ea1122b1229f3b164.tar.bz2
hutch-d897109d0d23560bf19ece6ea1122b1229f3b164.zip
Fix nonisolated table alignment lookup in Readme View
Diffstat (limited to 'Hutch/Views/Repositories')
-rw-r--r--Hutch/Views/Repositories/ReadmeView.swift9
1 files changed, 7 insertions, 2 deletions
diff --git a/Hutch/Views/Repositories/ReadmeView.swift b/Hutch/Views/Repositories/ReadmeView.swift
index 38c9d18..93fee26 100644
--- a/Hutch/Views/Repositories/ReadmeView.swift
+++ b/Hutch/Views/Repositories/ReadmeView.swift
@@ -1001,7 +1001,7 @@ nonisolated private func renderHTMLTable(
if hasHeaderSeparator {
html += "<thead><tr>"
for (index, cell) in headerRow.enumerated() {
- html += "<th" + tableAlignmentStyleAttribute(columnAlignments[safe: index] ?? nil) + ">" + inlineRenderer(cell) + "</th>"
+ html += "<th" + tableAlignmentStyleAttribute(columnAlignment(at: index, in: columnAlignments)) + ">" + inlineRenderer(cell) + "</th>"
}
html += "</tr></thead>\n"
}
@@ -1010,7 +1010,7 @@ nonisolated private func renderHTMLTable(
for row in bodyRows {
html += "<tr>"
for (index, cell) in row.enumerated() {
- html += "<td" + tableAlignmentStyleAttribute(columnAlignments[safe: index] ?? nil) + ">" + inlineRenderer(cell) + "</td>"
+ html += "<td" + tableAlignmentStyleAttribute(columnAlignment(at: index, in: columnAlignments)) + ">" + inlineRenderer(cell) + "</td>"
}
html += "</tr>\n"
}
@@ -1019,6 +1019,11 @@ nonisolated private func renderHTMLTable(
return html
}
+nonisolated private func columnAlignment(at index: Int, in alignments: [String?]) -> String? {
+ guard alignments.indices.contains(index) else { return nil }
+ return alignments[index]
+}
+
nonisolated private func tableAlignmentStyleAttribute(_ alignment: String?) -> String {
guard let alignment, !alignment.isEmpty else { return "" }
return #" style="text-align: \#(alignment);""#