Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .jules/palette.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,7 @@
## 2024-07-13 - 빈 디렉토리 μƒνƒœμ˜ μ ‘κ·Όμ„±(Accessibility) κ°œμ„ 
**Learning:** 정적 파일 μ„œλ²„μ˜ 빈 디렉토리 μƒνƒœλŠ” 슀크린 리더 μ‚¬μš©μžμ—κ²Œ 컨텐츠 λˆ„λ½μœΌλ‘œ μ˜€ν•΄λ°›μ„ 수 있으며, μ‹œκ°μ μœΌλ‘œλ„ 일반 리슀트 μ•„μ΄ν…œκ³Ό 정렬이 λ§žμ§€ μ•ŠλŠ” λ¬Έμ œκ°€ μžˆμ—ˆμŠ΅λ‹ˆλ‹€.
**Action:** 빈 μƒνƒœλ₯Ό λ‚˜νƒ€λ‚΄λŠ” μš”μ†Œμ— `role="status"`λ₯Ό μΆ”κ°€ν•˜μ—¬ 슀크린 리더가 λͺ…ν™•ν•˜κ²Œ 인지할 수 μžˆλ„λ‘ ν•˜κ³ , μ•„μ΄μ½˜κ³Ό flex λ ˆμ΄μ•„μ›ƒμ„ 톡해 λ‹€λ₯Έ 리슀트 μ•„μ΄ν…œκ³Ό μΌκ΄€λœ μ‹œκ°μ  흐름을 μ œκ³΅ν•˜λ„λ‘ ν•©λ‹ˆλ‹€.

## 2026-08-08 - 빈 루트 디렉토리 μ΄λ¦„μ˜ μ ‘κ·Όμ„± κ°œμ„ 
**ν•™μŠ΅:** 파일 μ‹œμŠ€ν…œμ˜ 루트 디렉토리(예: `/`)μ—μ„œ `File.getName()`을 ν˜ΈμΆœν•˜λ©΄ 빈 λ¬Έμžμ—΄μ΄ λ°˜ν™˜λ˜μ–΄ μƒμ„±λœ HTML에 빈 `<title>`κ³Ό `<h1>`이 λ°œμƒν•©λ‹ˆλ‹€. μ΄λŠ” 슀크린 리더 μ‚¬μš©μžμ—κ²Œ μ»¨ν…μŠ€νŠΈλ₯Ό μ œκ³΅ν•˜μ§€ λͺ»ν•΄ 접근성을 μ €ν•˜μ‹œν‚΅λ‹ˆλ‹€.
**쑰치:** 디렉토리 이름이 빈 λ¬Έμžμ—΄μΈ 경우 μ‹œκ°μ μΈ 폴백(예: `/`)을 λͺ…μ‹œμ μœΌλ‘œ μ œκ³΅ν•˜μ—¬ 항상 μœ νš¨ν•˜κ³  μ ‘κ·Ό κ°€λŠ₯ν•œ 제λͺ©κ³Ό ν—€λ”© νƒœκ·Έλ₯Ό μƒμ„±ν•˜λ„λ‘ ν•˜μ‹­μ‹œμ˜€.
5 changes: 3 additions & 2 deletions src/main/kotlin/html4tree/main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ fun process_dir(curr_dir: File, excludeSet: Set<String>? = null, dirFiles: Array

val exclude: Set<String> = excludeSet ?: process_ignore_file(curr_dir)

val displayDirName = if (curr_dir.getName().isEmpty()) "/" else curr_dir.getName()
val index_top = """<!doctype html>
<html lang="ko">
<head>
Expand All @@ -336,12 +337,12 @@ fun process_dir(curr_dir: File, excludeSet: Set<String>? = null, dirFiles: Array
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src '${STYLE_HASH}'; base-uri 'none'; form-action 'none';">
<!-- λ³΄μ•ˆ ν–₯상: 리퍼러λ₯Ό ν†΅ν•œ 디렉토리 경둜 λ…ΈμΆœ λ°©μ§€ -->
<meta name="referrer" content="no-referrer">
<title>${curr_dir.getName().escapeHtml()}</title>
<title>${displayDirName.escapeHtml()}</title>
<style>${CSS_CONTENT}</style>
</head>
<body>
<main>
<h1>${curr_dir.getName().escapeHtml()}</h1>
<h1>${displayDirName.escapeHtml()}</h1>
<nav aria-label="디렉토리 λͺ©λ‘">
<ul role="list">
<li><a class="dir-link" href="./.." aria-label="μƒμœ„ λ””λ ‰ν† λ¦¬λ‘œ 이동" title="μƒμœ„ λ””λ ‰ν† λ¦¬λ‘œ 이동"><span class="icon" aria-hidden="true">&#x21B0;</span> <span>..</span></a></li>
Expand Down
14 changes: 14 additions & 0 deletions src/test/kotlin/html4tree/MainTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -706,4 +706,18 @@ class MainTest {
assertFalse(processed, "fileKey mismatch should skip directory processing")
assertFalse(listed, "fileKey mismatch should skip child listing")
}

@Test
fun testRootDirectoryFallbackTitleAndH1() {
val fakeRoot = object : File(tempDir, "fakeRoot") {
override fun getName() = ""
}
fakeRoot.mkdir()
process_dir(fakeRoot, emptySet(), emptyArray())
val indexFile = File(fakeRoot, "index.html")
assertTrue(indexFile.exists())
val content = indexFile.readText()
assertTrue(content.contains("<title>/</title>"))
assertTrue(content.contains("<h1>/</h1>"))
}
}
Loading