diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-03-08 10:54:04 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-03-08 11:02:27 +0100 |
| commit | e5eab73374880077971f3f22acbdd3d302877128 (patch) | |
| tree | 07aa926b27032d6bcd82486d664dfd4161ccbd3e /docs | |
| parent | 1b2b53ecb91a9bd7fb3493e471ae03cd142a7c03 (diff) | |
Streamline field names
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/Cargo.toml | 1 | ||||
| -rw-r--r-- | docs/src/html.rs | 5 | ||||
| -rw-r--r-- | docs/src/lib.rs | 26 | ||||
| -rw-r--r-- | docs/src/reference/styling.md | 2 | ||||
| -rw-r--r-- | docs/src/tutorial/3-advanced.md | 6 | ||||
| -rw-r--r-- | docs/src/tutorial/4-template.md | 8 |
6 files changed, 38 insertions, 10 deletions
diff --git a/docs/Cargo.toml b/docs/Cargo.toml index b168fde8..af44dd88 100644 --- a/docs/Cargo.toml +++ b/docs/Cargo.toml @@ -5,7 +5,6 @@ authors = ["The Typst Project Developers"] edition = "2021" [lib] -test = false doctest = false bench = false diff --git a/docs/src/html.rs b/docs/src/html.rs index 7802ee10..33003349 100644 --- a/docs/src/html.rs +++ b/docs/src/html.rs @@ -309,7 +309,10 @@ fn code_block(resolver: &dyn Resolver, lang: &str, text: &str) -> Html { let world = DocWorld(source); let mut frames = match typst::compile(&world, &world.0) { Ok(doc) => doc.pages, - Err(err) => panic!("failed to compile {text}: {err:?}"), + Err(err) => { + let msg = &err[0].message; + panic!("while trying to compile {text}:\n\nerror: {msg}"); + } }; if let Some([x, y, w, h]) = zoom { diff --git a/docs/src/lib.rs b/docs/src/lib.rs index c32f9ff9..7ddc1c70 100644 --- a/docs/src/lib.rs +++ b/docs/src/lib.rs @@ -745,3 +745,29 @@ const TYPE_ORDER: &[&str] = &[ "selector", "stroke", ]; + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_docs() { + provide(&TestResolver); + } + + struct TestResolver; + + impl Resolver for TestResolver { + fn link(&self, _: &str) -> Option<String> { + None + } + + fn example(&self, _: Html, _: &[Frame]) -> Html { + Html::new(String::new()) + } + + fn image(&self, _: &str, _: &[u8]) -> String { + String::new() + } + } +} diff --git a/docs/src/reference/styling.md b/docs/src/reference/styling.md index cdc47f29..43585b13 100644 --- a/docs/src/reference/styling.md +++ b/docs/src/reference/styling.md @@ -85,8 +85,8 @@ fantasy encyclopedia. #set heading(numbering: "(I)") #show heading: it => block[ #set align(center) - \~ _#it.title;_ #set text(font: "Inria Serif") + \~ _#it.body;_ #it.numbers \~ ] diff --git a/docs/src/tutorial/3-advanced.md b/docs/src/tutorial/3-advanced.md index 0e337d86..3784bc8e 100644 --- a/docs/src/tutorial/3-advanced.md +++ b/docs/src/tutorial/3-advanced.md @@ -359,7 +359,7 @@ a way to set any of that, we need to write our own heading show rule. #show heading: it => block[ #set align(center) #set text(12pt, weight: "regular") - #smallcaps(it.title) + #smallcaps(it.body) ] <<< ... @@ -441,7 +441,7 @@ differentiate between section and subsection headings: ): it => block[ #set align(center) #set text(12pt, weight: "regular") - #smallcaps(it.title) + #smallcaps(it.body) ] #show heading.where( @@ -450,7 +450,7 @@ differentiate between section and subsection headings: size: 11pt, weight: "regular", style: "italic", - it.title + [.], + it.body + [.], ) >>> >>> #align(center, text( diff --git a/docs/src/tutorial/4-template.md b/docs/src/tutorial/4-template.md index c97ebbc9..47f9dfc6 100644 --- a/docs/src/tutorial/4-template.md +++ b/docs/src/tutorial/4-template.md @@ -107,7 +107,7 @@ previous chapter. >>> text( >>> 13pt, >>> weight: "regular", ->>> smallcaps(it.title), +>>> smallcaps(it.body), >>> ) >>> ), >>> ) @@ -118,7 +118,7 @@ previous chapter. >>> 11pt, >>> weight: "regular", >>> style: "italic", ->>> it.title + [.], +>>> it.body + [.], >>> ) >>> ) @@ -288,7 +288,7 @@ path of the file after the `{from}` keyword. >>> text( >>> 13pt, >>> weight: "regular", ->>> smallcaps(it.title), +>>> smallcaps(it.body), >>> ) >>> ), >>> ) @@ -299,7 +299,7 @@ path of the file after the `{from}` keyword. >>> 11pt, >>> weight: "regular", >>> style: "italic", ->>> it.title + [.], +>>> it.body + [.], >>> ) >>> ) >>> |
