Skip to content
Open
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 @@ -13,3 +13,7 @@
## 2024-06-25 - Directory Listing Navigation Landmark
**Learning:** Generated directory listings act as navigation regions, and screen readers benefit when the listing is announced separately from the page's main content.
**Action:** Wrap generated directory listing `<ul>` elements in `<nav aria-label="Directory listing">` while keeping the surrounding semantic `<main>` structure.

## 2024-05-24 - Default Browser Fonts and Spacing
**Learning:** Automatically generated HTML without font-family and layout constraints uses browser defaults (like Times New Roman) and stretches full-width, which hurts readability and feels outdated.
**Action:** Always include basic system-ui font stacks and sensible max-width/margins for generated HTML pages to provide an instantly better, modern reading experience.
13 changes: 11 additions & 2 deletions src/main/kotlin/html4tree/main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ fun main(args: Array<String>) = Html4tree().main(args)

fun go(topDir: String, maxLevel: Int) {
require(topDir.isNotBlank())
val top_dir = File(topDir).canonicalFile
require(Files.isDirectory(top_dir.toPath(), LinkOption.NOFOLLOW_LINKS)) { "Top directory must be an existing non-symlink directory" }
val top_dir_raw = File(topDir)
val top_dir = top_dir_raw.canonicalFile
require(Files.isDirectory(top_dir_raw.toPath(), LinkOption.NOFOLLOW_LINKS)) { "Top directory must be an existing non-symlink directory" }

val ll = LinkedList()

Expand Down Expand Up @@ -134,6 +135,14 @@ fun process_dir(curr_dir: File){

val css = """
<style>
body {
font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
line-height: 1.5;
color: #24292e;
max-width: 800px;
margin: 0 auto;
padding: 1rem;
}
ul {
list-style-type: none;
padding-left: 0;
Expand Down
3 changes: 2 additions & 1 deletion src/test/kotlin/html4tree/MainTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,10 @@ class MainTest {
Assume.assumeTrue("Symlink creation not supported in this environment", false)
}

assertFailsWith<IllegalArgumentException> {
val ex = assertFailsWith<IllegalArgumentException> {
go(symlink.absolutePath, -1)
}
assertTrue(ex.message!!.contains("Top directory must be an existing non-symlink directory"))
} finally {
targetDir.deleteRecursively()
}
Expand Down