1
0
forked from SPC/spc-site

Hack to fix language switch

This commit is contained in:
Alexander Nozik 2024-02-28 22:06:36 +03:00
parent f1ee6c5942
commit bf746a4227
14 changed files with 54 additions and 70 deletions

@ -12,15 +12,15 @@ language: en
<h2>Master program</h2>
</header>
<p>Master program "Scientific programming" at MIPT aims to prepare specialists both in application programming and domain field (such as physics, biology, biotechnology, computer science and other research areas).</p>
<p> In modern science and technology application level programming is an integral part of any major work. And in order to be successful in this field one needs to know both software engineering and the domain field. </p>
<p> In modern science and technology, application level programming is an integral part of any major work. And in order to be successful in this field, one needs to know both software engineering and the domain field. </p>
<ul class="actions">
<li><a href="${resolvePageRef("education.masters")}" class="button next">More</a></li>
<li><a href="/education/masters" class="button next">More</a></li>
</ul>
</div>
</section>
<hr/>
## Courses in 2022-2023:
## Courses in 20222023:
### [Scientific literature seminar](#)
*curated by [Aleksandr Svetlichnyi](${resolvePageRef("team")}#svetlichnyi)*

@ -1,3 +1,7 @@
---
language: en
---
**Director of the centre**
* PhD in particle physics.

@ -1 +1,5 @@
---
language: en
---
**Vice-director for education**

@ -1,3 +1,7 @@
---
language: en
---
Controls.kt is a data acquisition framework (work in progress). It is based on DataForge, a software framework for automated data processing.
[Repository and documentation](https://github.com/mipt-npm/controls.kt)

@ -1,3 +1,7 @@
---
language: en
---
A metadata processing workflow manipulation framework.
[Repository and documentation](https://github.com/mipt-npm/dataforge-core)

@ -1,3 +1,7 @@
---
language: en
---
An experimental Kotlin library for mathematical operations, built on the principle of context-oriented programming using mathematical abstractions.
[Repository and documentation](https://github.com/mipt-npm/kmath)

@ -1 +1,5 @@
---
language: en
---
Geological gas storage monitoring and leaks prevention using muons from atmosphere.

@ -1,3 +1,7 @@
---
language: en
---
A kotlin visualization library wrapping popular [Plotly](https://plotly.com/javascript/) library.
[Repository and documentation](https://github.com/mipt-npm/plotly.kt)

@ -1,3 +1,7 @@
---
language: en
---
A visualization framework written in Kotlin-multiplatform
[Repository and documentation](https://github.com/mipt-npm/visionforge)

@ -4,4 +4,4 @@ title: WIP
language: en
---
This page is work in progress.
This page is a work in progress.

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

@ -1,7 +1,6 @@
rootProject.name = "spc-site"
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
//enableFeaturePreview("VERSION_CATALOGS")
pluginManagement {

@ -3,8 +3,10 @@ package center.sciprog
import html5up.forty.fortyScripts
import kotlinx.html.*
import space.kscience.dataforge.data.*
import space.kscience.dataforge.meta.Meta
import space.kscience.dataforge.meta.get
import space.kscience.dataforge.meta.string
import space.kscience.dataforge.names.Name
import space.kscience.dataforge.names.asName
import space.kscience.dataforge.names.startsWith
import space.kscience.snark.html.*
@ -233,28 +235,25 @@ internal val spcHomePage = HtmlPage {
}
}
private fun SiteContextWithData.allPagesIn(location: String){
private fun SiteContextWithData.allPagesIn(location: String) {
siteData.filterByType<PageFragment> { name, meta, _ ->
name.startsWith(location) && meta["type"].string == "page"
}.forEach { (name, content) ->
page(name, content = spcPage(content))
page(name, content = spcPage(content), pageMeta = content.meta)
}
}
internal val spcHome: HtmlSite = HtmlSite {
static("assets")
static("images")
static("common", "")
multiLanguageSite(
siteData,
mapOf(
"en" to Language(""),
"ru" to Language("ru"),
)
Language("en", route = Name.EMPTY),
Language("ru"),
) {
page(content = spcHomePage)
static("assets")
static("images")
static("common", "")
page(content = spcHomePage, pageMeta = siteData.meta ?: Meta.EMPTY)
allPagesIn("consulting")
@ -268,53 +267,5 @@ internal val spcHome: HtmlSite = HtmlSite {
name.startsWith("projects".asName()) && meta["type"].string == "project"
}
}
// withLanguages(
// "en" to "",
// "ru" to "ru"
// ) {
// page { spcHomePage() }
//
// localizedPages("consulting", dataRenderer = FortyDataRenderer)
//
// localizedPages("education", dataRenderer = FortyDataRenderer)
//
// spcSpotlight("team") { _, meta ->
// meta["type"].string == "team"
// }
//
// spcSpotlight("research") { name, meta ->
// name.startsWith("projects".asName()) && meta["type"].string == "project"
// }
// }
}
//
//internal fun SiteBuilder.spcHome(homePageData: DataTree<Any>, prefix: Name = Name.EMPTY) {
//
// //val homePageData: DataTree<Any> = snark.readDirectory(dataPath.resolve("content"))
//
// site(prefix, homePageData) {
// static("assets")
// static("images")
// static("common", "")
//
// withLanguages(
// "en" to "",
// "ru" to "ru"
// ) {
// page { spcHomePage() }
//
// localizedPages("consulting", dataRenderer = FortyDataRenderer)
//
// localizedPages("education", dataRenderer = FortyDataRenderer)
//
// spcSpotlight("team") { _, meta ->
// meta["type"].string == "team"
// }
//
// spcSpotlight("research") { name, meta ->
// name.startsWith("projects".asName()) && meta["type"].string == "project"
// }
// }
// }
//}
}

@ -1,7 +1,8 @@
package center.sciprog
import io.ktor.http.URLBuilder
import io.ktor.http.appendPathSegments
import kotlinx.html.*
import space.kscience.dataforge.meta.get
import space.kscience.dataforge.meta.string
import space.kscience.snark.html.*
import java.time.LocalDate
@ -168,11 +169,12 @@ internal fun wrapper(contentBody: FlowContent.() -> Unit) = postprocess {
}
languageMap.takeIf { it.isNotEmpty() }?.let { languageMap ->
languageMap.takeIf { it.size > 1 }?.let { languageMap ->
div {
languageMap.forEach { (key, meta) ->
a(classes = "button primary small") {
href = resolvePageRef(meta["target"].string ?: "#")
val pageUrl = URLBuilder(host).appendPathSegments(meta.string ?: "#")
href = pageUrl.buildString().removeSuffix("/") //resolveRef(meta.string ?: "#")
+key
}
}