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-26 - ๋ฃจํŠธ ๋””๋ ‰ํ† ๋ฆฌ ํ‘œ์‹œ ์ด๋ฆ„ ์˜ˆ์™ธ ์ฒ˜๋ฆฌ
**Learning:** ํŒŒ์ผ ์‹œ์Šคํ…œ ๋ฃจํŠธ(์˜ˆ: `/` ๋˜๋Š” `C:\`)์˜ ๊ฒฝ์šฐ `File.getName()`์€ ๋นˆ ๋ฌธ์ž์—ด์„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. ์ด๋ฅผ ์ฒ˜๋ฆฌํ•˜์ง€ ์•Š๊ณ  ๊ธฐ๋ณธ๊ฐ’์œผ๋กœ ์‚ฌ์šฉํ•˜๋ฉด ์ƒ์„ฑ๋œ HTML ๋””๋ ‰ํ† ๋ฆฌ ํŠธ๋ฆฌ์˜ `<title>` ๋ฐ `<h1>`๊ฐ€ ๋น„์–ด ์žˆ๊ฒŒ ๋˜์–ด, ์Šคํฌ๋ฆฐ ๋ฆฌ๋” ์‚ฌ์šฉ์ž์—๊ฒŒ ์ปจํ…์ŠคํŠธ๋ฅผ ์ œ๊ณตํ•˜์ง€ ๋ชปํ•˜๊ณ  ์›น ์ ‘๊ทผ์„ฑ์„ ํ•ด์น˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.
**Action:** `File.getName()`์„ ์‚ฌ์šฉํ•  ๋•Œ `ifEmpty`์™€ ๊ฐ™์€ Fallback์„ ํ†ตํ•ด `absolutePath` ๋“ฑ์„ ๋Œ€์ฒด ๋ฌธ์ž์—ด๋กœ ์ œ๊ณตํ•˜์—ฌ, ๋ฃจํŠธ ๋””๋ ‰ํ† ๋ฆฌ์—์„œ๋„ UI ์ œ๋ชฉ์ด ์˜๋ฏธ ์žˆ๋Š” ๊ฐ’์„ ๊ฐ€์ง€๋„๋ก ๊ตฌํ˜„ํ•˜์‹ญ์‹œ์˜ค.
6 changes: 4 additions & 2 deletions src/main/kotlin/html4tree/main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,8 @@ fun process_dir(curr_dir: File, excludeSet: Set<String>? = null, dirFiles: Array
${cssContent} </style>
"""

val dirNameToDisplay = curr_dir.getName().ifEmpty { curr_dir.absolutePath }

val index_top = """<!doctype html>
<html lang="ko">
<head>
Expand All @@ -327,12 +329,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>${dirNameToDisplay.escapeHtml()}</title>
${css}
</head>
<body>
<main>
<h1>${curr_dir.getName().escapeHtml()}</h1>
<h1>${dirNameToDisplay.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
12 changes: 12 additions & 0 deletions src/test/kotlin/html4tree/MainTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,18 @@ class MainTest {
}
}

@Test
fun testProcessDirWithEmptyNameRootFallback() {
val fakeRoot = object : File(tempDir, "fakeRoot") {
override fun getName(): String = ""
}
fakeRoot.mkdir()
process_dir(fakeRoot)
val indexContent = File(fakeRoot, "index.html").readText()
assertTrue(indexContent.contains("<title>${fakeRoot.absolutePath.escapeHtml()}</title>"), "Should contain fallback title")
assertTrue(indexContent.contains("<h1>${fakeRoot.absolutePath.escapeHtml()}</h1>"), "Should contain fallback h1")
}

@Test
fun testProcessIgnoreFileWithIndexHtml() {
val ignoreFile = File(tempDir, ".html4ignore")
Expand Down
Loading