mantra v0.4.1: SPA-navigated lang toggle + RU core_claim extraction
This commit is contained in:
parent
eebc876216
commit
301129403f
2 changed files with 15 additions and 6 deletions
|
|
@ -235,7 +235,11 @@ fn parse_source(path: &Path, cycle_slug: &str) -> Result<Source> {
|
|||
.map(|l| l.trim_start_matches("# ").trim().to_string())
|
||||
.unwrap_or_else(|| slug.clone());
|
||||
|
||||
// Try known heading variants: EN original + RU translation batch
|
||||
// used «Ключевое утверждение».
|
||||
let core_claim = extract_section(&body_md, "## Core claim")
|
||||
.or_else(|| extract_section(&body_md, "## Ключевое утверждение"))
|
||||
.or_else(|| extract_section(&body_md, "## Ключевой тезис"))
|
||||
.unwrap_or_default()
|
||||
.trim()
|
||||
.replace('\n', " ");
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
//! Shared UI atoms.
|
||||
|
||||
use leptos::prelude::*;
|
||||
use leptos_router::components::A;
|
||||
use leptos_router::hooks::{use_location, use_query_map};
|
||||
|
||||
use crate::corpus::Lang;
|
||||
|
|
@ -8,6 +9,10 @@ use crate::corpus::Lang;
|
|||
/// Minimal top-right language toggle. Two links; current is dimmed,
|
||||
/// the other is hot. Preserves the rest of the URL (path + remaining
|
||||
/// query params) so toggling on a deep page keeps you there.
|
||||
///
|
||||
/// Uses the router's `<A>` component so clicks are SPA-navigated and
|
||||
/// the `use_query_map` signal updates without a page reload (Resources
|
||||
/// keyed on lang re-fetch and the view re-renders in place).
|
||||
#[component]
|
||||
pub fn LangToggle(current: Memo<Lang>) -> impl IntoView {
|
||||
let location = use_location();
|
||||
|
|
@ -23,15 +28,15 @@ pub fn LangToggle(current: Memo<Lang>) -> impl IntoView {
|
|||
|
||||
view! {
|
||||
<nav class="lang-toggle">
|
||||
<a
|
||||
<A
|
||||
href=move || make_href(Lang::Ru)
|
||||
class:lang-active=move || current.get() == Lang::Ru
|
||||
>"ru"</a>
|
||||
attr:class=move || if current.get() == Lang::Ru { "lang-active" } else { "" }
|
||||
>"ru"</A>
|
||||
<span class="lang-dot">"·"</span>
|
||||
<a
|
||||
<A
|
||||
href=move || make_href(Lang::En)
|
||||
class:lang-active=move || current.get() == Lang::En
|
||||
>"en"</a>
|
||||
attr:class=move || if current.get() == Lang::En { "lang-active" } else { "" }
|
||||
>"en"</A>
|
||||
</nav>
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue