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 @@ -48,3 +48,7 @@
## 2024-08-01 - λ„€μ΄ν‹°λΈŒ λΈŒλΌμš°μ € UI의 닀크 λͺ¨λ“œ 지원 κ°•μ œ
**ν•™μŠ΅:** CSS λ―Έλ””μ–΄ 쿼리(`@media (prefers-color-scheme: dark)`)λ₯Ό 톡해 닀크 λͺ¨λ“œλ₯Ό μ§€μ›ν•˜λ”λΌλ„, λΈŒλΌμš°μ €μ˜ λ„€μ΄ν‹°λΈŒ UI μš”μ†Œ(μŠ€ν¬λ‘€λ°”, κΈ°λ³Έ 폼 컨트둀, κΈ°λ³Έ λ°±κ·ΈλΌμš΄λ“œ λ“±)λŠ” ν…Œλ§ˆ 변경을 μΈμ‹ν•˜μ§€ λͺ»ν•΄ μ–΄λ‘μš΄ ν…Œλ§ˆ ν™˜κ²½μ—μ„œ 밝은 μŠ€ν¬λ‘€λ°”κ°€ ν‘œμ‹œλ˜λŠ” λ“± μ‹œκ°μ  뢈일치λ₯Ό μ΄ˆλž˜ν•©λ‹ˆλ‹€.
**쑰치:** 항상 HTML λ¬Έμ„œμ˜ `<head>` μ˜μ—­μ— `<meta name="color-scheme" content="light dark">` 메타 νƒœκ·Έλ₯Ό λͺ…μ‹œμ μœΌλ‘œ μΆ”κ°€ν•˜μ—¬ λΈŒλΌμš°μ € μˆ˜μ€€μ—μ„œ μ‚¬μš©μžμ˜ μ‹œμŠ€ν…œ ν…Œλ§ˆ(닀크 λͺ¨λ“œ λ“±)λ₯Ό μ™„μ „νžˆ 상속받아 일관성 μžˆλŠ” λ„€μ΄ν‹°λΈŒ UIλ₯Ό λ Œλ”λ§ν•˜λ„λ‘ 보μž₯ν•˜μ‹­μ‹œμ˜€.

## 2026-07-18 - 루트 디렉토리 빈 이름 μ‹œλ§¨ν‹± κ°œμ„ 
**ν•™μŠ΅:** 루트 디렉토리와 같이 File.getName()이 빈 λ¬Έμžμ—΄("")을 λ°˜ν™˜ν•˜λŠ” 디렉토리λ₯Ό μ²˜λ¦¬ν•  λ•Œ, `<title>` 및 `<h1>` μš”μ†Œκ°€ 빈 ν…μŠ€νŠΈλ‘œ μƒμ„±λ˜μ–΄ 슀크린 리더 μ‚¬μš©μžμ™€ μ‹œκ°μ  μ‚¬μš©μž λͺ¨λ‘μ—κ²Œ ν˜Όλž€μ„ μ£Όκ³  μ›Ή μ ‘κ·Όμ„±(a11y)을 μ €ν•΄ν•  수 μžˆμŠ΅λ‹ˆλ‹€.
**쑰치:** 디렉토리 λͺ©λ‘μ˜ HTML을 λ™μ μœΌλ‘œ 생성할 λ•Œ 항상 디렉토리 이름이 λΉ„μ–΄μžˆλŠ”μ§€ ν™•μΈν•˜κ³ , λΉ„μ–΄μžˆλŠ” 경우 빈 νƒœκ·Έ λ Œλ”λ§μ„ λ°©μ§€ν•˜κΈ° μœ„ν•΄ μ ˆλŒ€ κ²½λ‘œλ‚˜ μ μ ˆν•œ 폴백(예: `absolutePath`)을 μ œκ³΅ν•˜μ—¬ λͺ…ν™•ν•œ μ»¨ν…μŠ€νŠΈμ™€ μ ‘κ·Όμ„± μ‹œλ§¨ν‹±μ„ μœ μ§€ν•˜μ‹­μ‹œμ˜€.
4 changes: 2 additions & 2 deletions src/main/kotlin/html4tree/main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -327,12 +327,12 @@ ${cssContent} </style>
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src '${styleHash}'; base-uri 'none'; form-action 'none';">
<!-- λ³΄μ•ˆ ν–₯상: 리퍼러λ₯Ό ν†΅ν•œ 디렉토리 경둜 λ…ΈμΆœ λ°©μ§€ -->
<meta name="referrer" content="no-referrer">
<title>${curr_dir.getName().escapeHtml()}</title>
<title>${(curr_dir.getName().ifEmpty { curr_dir.absolutePath }).escapeHtml()}</title>
${css}
</head>
<body>
<main>
<h1>${curr_dir.getName().escapeHtml()}</h1>
<h1>${(curr_dir.getName().ifEmpty { curr_dir.absolutePath }).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
15 changes: 15 additions & 0 deletions src/test/kotlin/html4tree/MainTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,21 @@ class MainTest {
assertTrue(htmlContent.contains("margin: 0 auto;"))
}

@Test
fun testEmptyDirectoryNameFallback() {
val fakeRoot = object : File(tempDir, "fakeRoot") {
override fun getName() = ""
}
fakeRoot.mkdir()
process_dir(fakeRoot)
val indexFile = File(fakeRoot, "index.html")
assertTrue(indexFile.exists())
val htmlContent = indexFile.readText()
val expectedTitleAndH1 = fakeRoot.absolutePath.escapeHtml()
assertTrue(htmlContent.contains("<title>$expectedTitleAndH1</title>"))
assertTrue(htmlContent.contains("<h1>$expectedTitleAndH1</h1>"))
}

@Test
fun testWriteIndexFileCleansUpTempFileOnFailure() {
// Files.move cannot replace a non-empty directory, so this drives the
Expand Down
Loading