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

View File

@ -12,15 +12,15 @@ language: en
<h2>Master program</h2> <h2>Master program</h2>
</header> </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>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"> <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> </ul>
</div> </div>
</section> </section>
<hr/> <hr/>
## Courses in 2022-2023: ## Courses in 20222023:
### [Scientific literature seminar](#) ### [Scientific literature seminar](#)
*curated by [Aleksandr Svetlichnyi](${resolvePageRef("team")}#svetlichnyi)* *curated by [Aleksandr Svetlichnyi](${resolvePageRef("team")}#svetlichnyi)*

View File

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

View File

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

View File

@ -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. 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) [Repository and documentation](https://github.com/mipt-npm/controls.kt)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists 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 zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

View File

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

View File

@ -3,8 +3,10 @@ package center.sciprog
import html5up.forty.fortyScripts import html5up.forty.fortyScripts
import kotlinx.html.* import kotlinx.html.*
import space.kscience.dataforge.data.* import space.kscience.dataforge.data.*
import space.kscience.dataforge.meta.Meta
import space.kscience.dataforge.meta.get import space.kscience.dataforge.meta.get
import space.kscience.dataforge.meta.string import space.kscience.dataforge.meta.string
import space.kscience.dataforge.names.Name
import space.kscience.dataforge.names.asName import space.kscience.dataforge.names.asName
import space.kscience.dataforge.names.startsWith import space.kscience.dataforge.names.startsWith
import space.kscience.snark.html.* 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, _ -> siteData.filterByType<PageFragment> { name, meta, _ ->
name.startsWith(location) && meta["type"].string == "page" name.startsWith(location) && meta["type"].string == "page"
}.forEach { (name, content) -> }.forEach { (name, content) ->
page(name, content = spcPage(content)) page(name, content = spcPage(content), pageMeta = content.meta)
} }
} }
internal val spcHome: HtmlSite = HtmlSite { internal val spcHome: HtmlSite = HtmlSite {
static("assets")
static("images")
static("common", "")
multiLanguageSite( multiLanguageSite(
siteData, Language("en", route = Name.EMPTY),
mapOf( Language("ru"),
"en" to Language(""),
"ru" to Language("ru"),
)
) { ) {
page(content = spcHomePage) static("assets")
static("images")
static("common", "")
page(content = spcHomePage, pageMeta = siteData.meta ?: Meta.EMPTY)
allPagesIn("consulting") allPagesIn("consulting")
@ -268,53 +267,5 @@ internal val spcHome: HtmlSite = HtmlSite {
name.startsWith("projects".asName()) && meta["type"].string == "project" 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"
// }
// }
// }
//}

View File

@ -1,7 +1,8 @@
package center.sciprog package center.sciprog
import io.ktor.http.URLBuilder
import io.ktor.http.appendPathSegments
import kotlinx.html.* import kotlinx.html.*
import space.kscience.dataforge.meta.get
import space.kscience.dataforge.meta.string import space.kscience.dataforge.meta.string
import space.kscience.snark.html.* import space.kscience.snark.html.*
import java.time.LocalDate 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 { div {
languageMap.forEach { (key, meta) -> languageMap.forEach { (key, meta) ->
a(classes = "button primary small") { 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 +key
} }
} }