From ffb166c5d7967c9bfd23ae438efe3d06cfadc4a4 Mon Sep 17 00:00:00 2001 From: 3w36zj6 <52315048+3w36zj6@users.noreply.github.com> Date: Sat, 14 Dec 2024 19:35:22 +0900 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20outline=E3=81=AE=E8=A6=8B=E5=87=BA?= =?UTF-8?q?=E3=81=97=E3=82=92=E6=97=A5=E6=9C=AC=E8=AA=9E=E3=81=AB=E7=BF=BB?= =?UTF-8?q?=E8=A8=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/src/lib.rs | 36 ++++++++++++++++++++++------- templates/category_template.html.j2 | 2 +- templates/func_template.html.j2 | 4 ++-- templates/type_template.html.j2 | 4 ++-- 4 files changed, 33 insertions(+), 13 deletions(-) diff --git a/docs/src/lib.rs b/docs/src/lib.rs index 1cc843cf88..49e143b9e2 100644 --- a/docs/src/lib.rs +++ b/docs/src/lib.rs @@ -325,9 +325,17 @@ fn category_page(resolver: &dyn Resolver, category: Category) -> PageModel { _ => &title_name, }; let details = Html::markdown(resolver, category.docs(), Some(1)); - let mut outline = vec![OutlineItem::from_name("Summary")]; + let mut outline = vec![OutlineItem { + id: "summary".into(), + name: "概要".into(), + children: vec![], + }]; outline.extend(details.outline()); - outline.push(OutlineItem::from_name("Definitions")); + outline.push(OutlineItem { + id: "definitions".into(), + name: "定義".into(), + children: vec![], + }); if shorthands.is_some() { outline.push(OutlineItem::from_name("Shorthands")); } @@ -500,13 +508,17 @@ fn func_outline(model: &FuncModel, id_base: &str) -> Vec { let mut outline = vec![]; if id_base.is_empty() { - outline.push(OutlineItem::from_name("Summary")); + outline.push(OutlineItem { + id: "summary".into(), + name: "概要".into(), + children: vec![], + }); outline.extend(model.details.outline()); if !model.params.is_empty() { outline.push(OutlineItem { id: "parameters".into(), - name: "Parameters".into(), + name: "引数".into(), children: model .params .iter() @@ -539,7 +551,7 @@ fn scope_outline(scope: &[FuncModel]) -> Option { Some(OutlineItem { id: "definitions".into(), - name: "Definitions".into(), + name: "定義".into(), children: scope .iter() .map(|func| { @@ -558,7 +570,11 @@ fn group_page( group: &GroupData, ) -> (PageModel, CategoryItem) { let mut functions = vec![]; - let mut outline = vec![OutlineItem::from_name("Summary")]; + let mut outline = vec![OutlineItem { + id: "summary".into(), + name: "概要".into(), + children: vec![], + }]; let path: Vec<_> = group.path.iter().map(|s| s.as_str()).collect(); let details = Html::markdown(resolver, &group.details, Some(1)); @@ -642,13 +658,17 @@ fn type_model(resolver: &dyn Resolver, ty: &Type) -> TypeModel { /// Produce an outline for a type page. fn type_outline(model: &TypeModel) -> Vec { - let mut outline = vec![OutlineItem::from_name("Summary")]; + let mut outline = vec![OutlineItem { + id: "summary".into(), + name: "概要".into(), + children: vec![], + }]; outline.extend(model.details.outline()); if let Some(func) = &model.constructor { outline.push(OutlineItem { id: "constructor".into(), - name: "Constructor".into(), + name: "コンストラクタ".into(), children: func_outline(func, "constructor"), }); } diff --git a/templates/category_template.html.j2 b/templates/category_template.html.j2 index cab2adf4ce..cd75c6fd9f 100644 --- a/templates/category_template.html.j2 +++ b/templates/category_template.html.j2 @@ -3,7 +3,7 @@

{{ body['content']['name'] }}

{{ body['content']['details'] | safe }} -

Definitions

+

定義

    {% for item in body['content']['items'] %} {% if item['code'] %} diff --git a/templates/func_template.html.j2 b/templates/func_template.html.j2 index 1509fd2725..623d955554 100644 --- a/templates/func_template.html.j2 +++ b/templates/func_template.html.j2 @@ -7,7 +7,7 @@ macros.tooltip_display('Element', 'Element functions can be customized with set and show rules.') }}{% endif %} {{ body['content']['details'] | safe }}

    - {{ macros.tooltip_display('Parameters', 'Parameters are the inputs to a function. They are specified in parentheses after the function name.', prefix='parameters') }} + {{ macros.tooltip_display('引数', 'Parameters are the inputs to a function. They are specified in parentheses after the function name.', prefix='parameters') }}

    {{ macros.function_definition_display(body['content'], type2class, gen_path, prefix=body['content']['name']) }} {% if body['content']['example'] %} @@ -18,7 +18,7 @@ {% if body['content']['scope'].__len__() > 0 %}

    - {{ macros.tooltip_display('Definitions', 'Functions and types and can have associated definitions. These are accessed by specifying the function or type, followed by a period, and then the definition\'s name.', prefix='definitions') }} + {{ macros.tooltip_display('定義', 'Functions and types and can have associated definitions. These are accessed by specifying the function or type, followed by a period, and then the definition\'s name.', prefix='definitions') }}

    {% endif %} {% for method in body['content']['scope'] %} diff --git a/templates/type_template.html.j2 b/templates/type_template.html.j2 index f681533bbb..f122585d01 100644 --- a/templates/type_template.html.j2 +++ b/templates/type_template.html.j2 @@ -8,7 +8,7 @@ {% if body['content']['constructor'] %}

    - {{ macros.tooltip_display('Constructor', 'If a type has a constructor, you can call it like a function to create a new value of the type.', prefix='constructor') }} + {{ macros.tooltip_display('コンストラクタ', 'If a type has a constructor, you can call it like a function to create a new value of the type.', prefix='constructor') }}

    {{ macros.function_display(body['content']['constructor'], type2class, gen_path, prefix='constructor', is_example_folding=false) }} {% endif %} @@ -16,7 +16,7 @@ {% if body['content']['scope'].__len__() > 0 %}

    - {{ macros.tooltip_display('Definitions', 'Functions and types and can have associated definitions. These are accessed by specifying the function or type, followed by a period, and then the definition\'s name.', prefix='definitions') }} + {{ macros.tooltip_display('定義', 'Functions and types and can have associated definitions. These are accessed by specifying the function or type, followed by a period, and then the definition\'s name.', prefix='definitions') }}

    {% endif %} {% for method in body['content']['scope'] %} From 8bf4358066295ee70b4fb4dc7e5a2cc52e66aee6 Mon Sep 17 00:00:00 2001 From: Shunsuke Kimura Date: Sat, 14 Dec 2024 14:37:46 +0000 Subject: [PATCH 2/2] =?UTF-8?q?trans:=20Examples=E3=82=92=E4=BE=8B?= =?UTF-8?q?=E3=81=AB=E7=BF=BB=E8=A8=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Shunsuke Kimura --- crates/typst/src/model/figure.rs | 2 +- crates/typst/src/visualize/image/mod.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/typst/src/model/figure.rs b/crates/typst/src/model/figure.rs index 963c879ce5..ee05f8720a 100644 --- a/crates/typst/src/model/figure.rs +++ b/crates/typst/src/model/figure.rs @@ -27,7 +27,7 @@ use crate::visualize::ImageElem; /// 自動的にその種類を検出し、それぞれに応じて番号付けします。 /// 例えば、画像を含む図表は表を含む図表とは別々に番号が付けられます。 /// -/// # Examples +/// # 例 /// 以下の例は、画像を含む基本的な図表を示しています。 /// ```example /// @glacier shows a glacier. Glaciers diff --git a/crates/typst/src/visualize/image/mod.rs b/crates/typst/src/visualize/image/mod.rs index 0788800854..905ee85d52 100644 --- a/crates/typst/src/visualize/image/mod.rs +++ b/crates/typst/src/visualize/image/mod.rs @@ -39,7 +39,7 @@ use crate::World; /// ほとんどの要素と同様に、画像はデフォルトでは _ブロックレベル_ であるため、隣接する段落に統合されることはありません。 /// 画像を強制的にインラインにするには、[`box`]の中に入れてください。 /// -/// # Example +/// # 例 /// ```example /// #figure( /// image("molecular.jpg", width: 80%),