Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/typst/src/model/figure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use crate::visualize::ImageElem;
/// 自動的にその種類を検出し、それぞれに応じて番号付けします。
/// 例えば、画像を含む図表は表を含む図表とは別々に番号が付けられます。
///
/// # Examples
/// #
/// 以下の例は、画像を含む基本的な図表を示しています。
/// ```example
/// @glacier shows a glacier. Glaciers
Expand Down
2 changes: 1 addition & 1 deletion crates/typst/src/visualize/image/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ use crate::World;
/// ほとんどの要素と同様に、画像はデフォルトでは _ブロックレベル_ であるため、隣接する段落に統合されることはありません。
/// 画像を強制的にインラインにするには、[`box`]の中に入れてください。
///
/// # Example
/// #
/// ```example
/// #figure(
/// image("molecular.jpg", width: 80%),
Expand Down
36 changes: 28 additions & 8 deletions docs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}
Expand Down Expand Up @@ -500,13 +508,17 @@ fn func_outline(model: &FuncModel, id_base: &str) -> Vec<OutlineItem> {
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()
Expand Down Expand Up @@ -539,7 +551,7 @@ fn scope_outline(scope: &[FuncModel]) -> Option<OutlineItem> {

Some(OutlineItem {
id: "definitions".into(),
name: "Definitions".into(),
name: "定義".into(),
children: scope
.iter()
.map(|func| {
Expand All @@ -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));
Expand Down Expand Up @@ -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<OutlineItem> {
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"),
});
}
Expand Down
2 changes: 1 addition & 1 deletion templates/category_template.html.j2
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<h1 id="summary">{{ body['content']['name'] }}</h1>
{{ body['content']['details'] | safe }}
<h2 id="definitions">Definitions</h2>
<h2 id="definitions">定義</h2>
<ul class="subgridded">
{% for item in body['content']['items'] %}
{% if item['code'] %}
Expand Down
4 changes: 2 additions & 2 deletions templates/func_template.html.j2
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
macros.tooltip_display('Element', 'Element functions can be customized with <code>set</code> and <code>show</code> rules.') }}{% endif %}</small></h1>
{{ body['content']['details'] | safe }}
<h2 id="parameters">
{{ 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') }}
</h2>
{{ macros.function_definition_display(body['content'], type2class, gen_path, prefix=body['content']['name']) }}
{% if body['content']['example'] %}
Expand All @@ -18,7 +18,7 @@

{% if body['content']['scope'].__len__() > 0 %}
<h2 id="definitions">
{{ 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') }}
</h2>
{% endif %}
{% for method in body['content']['scope'] %}
Expand Down
4 changes: 2 additions & 2 deletions templates/type_template.html.j2
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@

{% if body['content']['constructor'] %}
<h2 id="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') }}
</h2>
{{ macros.function_display(body['content']['constructor'], type2class, gen_path, prefix='constructor', is_example_folding=false) }}
{% endif %}


{% if body['content']['scope'].__len__() > 0 %}
<h2 id="definitions">
{{ 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') }}
</h2>
{% endif %}
{% for method in body['content']['scope'] %}
Expand Down
Loading