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
@@ -0,0 +1,4 @@

## 2024-06-29 - μž₯μ‹μš© 파일/폴더 μ•„μ΄μ½˜μ— λŒ€ν•œ aria-hidden 적용
**배운 점:** 디렉토리 ꡬ쑰λ₯Ό ν‘œν˜„ν•˜λŠ” HTMLμ—μ„œ μž₯μ‹μš©μœΌλ‘œ μ‚¬μš©λ˜λŠ” 이λͺ¨μ§€(파일 λ˜λŠ” 폴더 μ•„μ΄μ½˜)λŠ” 슀크린 리더 ν™˜κ²½μ—μ„œ μ‚¬μš©μžλ₯Ό ν˜Όλž€μŠ€λŸ½κ²Œ ν•  수 μžˆμŠ΅λ‹ˆλ‹€ (예: λΆˆν•„μš”ν•œ 이λͺ¨μ§€ 이름 읽기).
**μ•‘μ…˜ μ•„μ΄ν…œ:** μ‹œκ°μ μΈ μš”μ†Œλ‘œλ§Œ 의미λ₯Ό κ°–λŠ” 이λͺ¨μ§€λ‚˜ 특수 λ¬ΈμžλŠ” 항상 `<span aria-hidden="true">`둜 κ°μ‹Έμ„œ, μ‹œκ° μž₯μ• κ°€ μ—†λŠ” μ‚¬μš©μžμ˜ μ‹œκ°μ  μ •λ³΄λŠ” μœ μ§€ν•˜λ©΄μ„œ 슀크린 리더 μ‚¬μš©μžμ—κ²ŒλŠ” 보닀 κΉ”λ”ν•œ μ˜€λ””μ˜€ κ²½ν—˜μ„ μ œκ³΅ν•˜λ„λ‘ ν•΄μ•Ό ν•©λ‹ˆλ‹€.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# λ³€κ²½ 사항

## [Unreleased]
### 좔가됨
- `index.html` 생성 μ‹œ 슀크린 리더 μ‚¬μš©μžλ₯Ό μœ„ν•œ μ ‘κ·Όμ„± κ°œμ„ μ„ μ μš©ν–ˆμŠ΅λ‹ˆλ‹€. μ£Όμš” μ½˜ν…μΈ  μ˜μ—­μ„ `<main>` νƒœκ·Έλ‘œ 감쌌으며, μ‹œκ°μ μΈ μž₯식 역할을 ν•˜λŠ” 파일/폴더 μ•„μ΄μ½˜(이λͺ¨μ§€)에 `aria-hidden="true"` 속성을 μΆ”κ°€ν•˜μ—¬ 슀크린 리더가 λΆˆν•„μš”ν•˜κ²Œ 읽지 μ•Šλ„λ‘ μˆ˜μ •ν–ˆμŠ΅λ‹ˆλ‹€.
26 changes: 14 additions & 12 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = '1.3.72'
ext.kotlin_version = '1.9.22'

repositories {
mavenCentral()
Expand All @@ -13,7 +13,9 @@ apply plugin: 'kotlin'
apply plugin: 'application'
apply plugin: 'jacoco'

mainClassName = 'html4tree.MainKt'
application {
mainClass = 'html4tree.MainKt'
}

defaultTasks 'build'

Expand All @@ -22,29 +24,29 @@ repositories {
}

dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
testCompile 'junit:junit:4.11'
testCompile "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
compile "com.github.ajalt:clikt:2.7.1"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
testImplementation 'junit:junit:4.13.2'
testImplementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
implementation "com.github.ajalt.clikt:clikt:3.5.0"
}

jar {
manifest {
attributes 'Main-Class': 'html4tree.MainKt'
}

from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
}

jacoco {
toolVersion = "0.8.7"
toolVersion = "0.8.11"
}

jacocoTestReport {
reports {
xml.enabled false
csv.enabled false
html.destination file("${buildDir}/jacocoHtml")
xml.required.set(false)
csv.required.set(false)
html.outputLocation.set(file("${buildDir}/jacocoHtml"))
}
}

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
6 changes: 4 additions & 2 deletions src/main/kotlin/html4tree/main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,10 @@ fun process_dir(curr_dir: File){
${css}
</head>
<body>
<main>
<h1>${curr_dir.getName().escapeHtml()}</h1>
<ul>
<li><a style="display:block; width:100%" href="./.." aria-label="μƒμœ„ λ””λ ‰ν† λ¦¬λ‘œ 이동">&#x21B0; ..</a></li>
<li><a style="display:block; width:100%" href="./.." aria-label="μƒμœ„ λ””λ ‰ν† λ¦¬λ‘œ 이동"><span aria-hidden="true">&#x21B0;</span> ..</a></li>
"""

val index_middle = fun():String{
Expand All @@ -131,7 +132,7 @@ fun process_dir(curr_dir: File){
dir_files.forEach {
val isLinkedDirectory = it.isDirectory() && !java.nio.file.Files.isSymbolicLink(it.toPath())
if((it.getName() !in exclude) && (isLinkedDirectory || !it.isDirectory())) {
l += """ <li><a style="display:block; width:100%" href="${if (isLinkedDirectory) { "./${it.getName().urlEncodePath()}/" } else { "./${it.getName().urlEncodePath()}" }}">${if (isLinkedDirectory) { "&#128193;" } else { "&rtrif;" }} ${it.getName().escapeHtml()}</a></li>"""+"\n"
l += """ <li><a style="display:block; width:100%" href="${if (isLinkedDirectory) { "./${it.getName().urlEncodePath()}/" } else { "./${it.getName().urlEncodePath()}" }}"><span aria-hidden="true">${if (isLinkedDirectory) { "&#128193;" } else { "&rtrif;" }}</span> ${it.getName().escapeHtml()}</a></li>"""+"\n"
}
}

Expand All @@ -140,6 +141,7 @@ fun process_dir(curr_dir: File){

val index_bottom="""
</ul>
</main>
</body>
</html>
"""
Expand Down
4 changes: 4 additions & 0 deletions src/test/kotlin/html4tree/MainTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class MainTest {
val indexFile = File(tempDir, "index.html")
assertTrue(indexFile.exists())
assertTrue(indexFile.readText().contains("<html lang=\"ko\">"))
assertTrue(indexFile.readText().contains("<main>"))
}

@Test
Expand Down Expand Up @@ -110,10 +111,13 @@ class MainTest {
assertTrue(indexFile.exists())
val htmlContent = indexFile.readText()
assertTrue(htmlContent.contains("<html lang=\"ko\">"))
assertTrue(htmlContent.contains("<main>"))
assertTrue(htmlContent.contains("</main>"))
assertTrue(htmlContent.contains("aria-label=\"μƒμœ„ λ””λ ‰ν† λ¦¬λ‘œ 이동\""))
assertTrue(htmlContent.contains("file1.txt"))
assertTrue(htmlContent.contains("subdir/"))
assertTrue(htmlContent.contains("&#128193;"))
assertTrue(htmlContent.contains("<span aria-hidden=\"true\">"))
assertFalse(htmlContent.contains("test.ignore"))
}

Expand Down