diff --git a/docs/OOP.md b/docs/OOP.md index 62169ec..0791d40 100644 --- a/docs/OOP.md +++ b/docs/OOP.md @@ -1,6 +1,10 @@ -# OO implementation in Lyng +# Object-oriented programming -## Declaration +[//]: # (topMenu) + +Lyng supports first class OOP constructs, based on classes with multiple inheritance. + +## Class Declaration The class clause looks like diff --git a/docs/declaring_arguments.md b/docs/declaring_arguments.md index 3e8df3c..7930cd0 100644 --- a/docs/declaring_arguments.md +++ b/docs/declaring_arguments.md @@ -1,5 +1,7 @@ # Declaring arguments in Lyng +[//]: # (topMenu) + It is a common thing that occurs in many places in Lyng, function declarations, lambdas and class declarations. diff --git a/docs/parallelism.md b/docs/parallelism.md index 736789c..2db6435 100644 --- a/docs/parallelism.md +++ b/docs/parallelism.md @@ -1,4 +1,6 @@ -# Parallelism in Lyng +# Multithreading/parallel execution + +[//]: # (topMenu) Lyng is built to me multithreaded where possible (e.g. all targets byt JS and wasmJS as for now) and cooperatively parallel (coroutine based) everywhere. diff --git a/docs/proposals/map_literal.md b/docs/proposals/map_literal.md index e0b51a7..8b853db 100644 --- a/docs/proposals/map_literal.md +++ b/docs/proposals/map_literal.md @@ -1,6 +1,8 @@ # Map literals — refined proposal +[//]: # (excludeFromIndex) + Implement JavaScript-like literals for maps. The syntax and semantics align with named arguments in function calls, but map literals are expressions that construct `Map` values. Keys can be either: diff --git a/docs/proposals/named_args.md b/docs/proposals/named_args.md index 2fee6e9..9e499bf 100644 --- a/docs/proposals/named_args.md +++ b/docs/proposals/named_args.md @@ -1,4 +1,7 @@ -# Named arguments proposal +# Named arguments in calls + +[//]: # (excludeFromIndex) + Extend function/method calls to allow setting arguments by name using colon syntax at call sites. This is especially convenient with many parameters and default values. diff --git a/docs/when.md b/docs/when.md index 5dc65a3..773b480 100644 --- a/docs/when.md +++ b/docs/when.md @@ -1,5 +1,7 @@ # The `when` statement (expression) +[//]: # (topMenu) + Lyng provides a concise multi-branch selection with `when`, heavily inspired by Kotlin. In Lyng, `when` is an expression: it evaluates to a value. If the selected branch contains no value (e.g., it ends with `void` or calls a void function like `println`), the whole `when` expression evaluates to `void`. Currently, Lyng implements the "subject" form: `when(value) { ... }`. The subject-less form `when { condition -> ... }` is not implemented yet. diff --git a/site/src/jsMain/kotlin/Main.kt b/site/src/jsMain/kotlin/Main.kt index 571d026..231023c 100644 --- a/site/src/jsMain/kotlin/Main.kt +++ b/site/src/jsMain/kotlin/Main.kt @@ -379,8 +379,9 @@ suspend fun initDocsDropdown() { val arr = JSON.parse(text) as Array val all = arr.toList().sorted() dlog("docs-dd", "index entries=${all.size}") - // Filter excluded by reading each markdown and looking for the marker + // Filter excluded by reading each markdown and looking for the marker, and collect titles val filtered = mutableListOf() + val titles = mutableMapOf() var excluded = 0 var failed = 0 for (path in all) { @@ -393,8 +394,12 @@ suspend fun initDocsDropdown() { continue } val body = r.text().await() - if (!body.contains("[//]: # (excludeFromIndex)")) { + if (!body.contains("[//]: # (excludeFromIndex)") && + body.contains("[//]: # (topMenu)") ) { filtered.add(path) + // Reuse shared title extractor: first H1 or fallback to file name + val title = extractTitleFromMarkdown(body) ?: path.substringAfterLast('/') + titles[path] = title } else excluded++ } catch (t: Throwable) { failed++ @@ -404,10 +409,10 @@ suspend fun initDocsDropdown() { dlog("docs-dd", "filtered=${filtered.size} excluded=$excluded failed=$failed") // Sort entries by display name (file name) case-insensitively val sortedFiltered = filtered.sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER) { it.substringAfterLast('/') }) - // Build items after the static first two existing children (tutorial + divider) + // Build items after the static first items (tutorial, optional static entries, divider) var appended = 0 sortedFiltered.forEach { path -> - val name = path.substringAfterLast('/') + val name = titles[path] ?: path.substringAfterLast('/') val li = document.createElement("li") val a = document.createElement("a") as HTMLAnchorElement a.className = "dropdown-item" diff --git a/site/src/jsMain/resources/index.html b/site/src/jsMain/resources/index.html index 968634b..cacc43e 100644 --- a/site/src/jsMain/resources/index.html +++ b/site/src/jsMain/resources/index.html @@ -212,12 +212,14 @@