diff --git a/cli/src/lib.rs b/cli/src/lib.rs index d588dca..7391272 100644 --- a/cli/src/lib.rs +++ b/cli/src/lib.rs @@ -15,7 +15,7 @@ use std::path::PathBuf; use clap::{ArgAction, Parser, Subcommand, ValueEnum}; #[derive(Debug, Parser)] -#[clap(name = "shiroa", version = "0.1.0")] +#[clap(name = "shiroa", version = "0.1.1")] pub struct Opts { /// Print Version #[arg(short = 'V', long, group = "version-dump")] diff --git a/cli/src/main.rs b/cli/src/main.rs index 134b3d2..62cb0ac 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -100,7 +100,7 @@ async fn init(args: InitArgs) -> ZResult<()> { dir.join("book.typ"), format!( r##" -#import "@preview/shiroa:0.1.0": * +#import "@preview/shiroa:0.1.1": * #show: book @@ -135,7 +135,7 @@ Sample page write_file( dir.join("ebook.typ"), format!( - r##"#import "@preview/shiroa:0.1.0": * + r##"#import "@preview/shiroa:0.1.1": * #import "{ebook_template}" diff --git a/cli/src/project.rs b/cli/src/project.rs index f9edd35..a8f50e6 100644 --- a/cli/src/project.rs +++ b/cli/src/project.rs @@ -183,12 +183,12 @@ impl Project { let package_meta = res .first() - .ok_or_else(|| error_once!("no internal-package meta in book.typ (are you using old book package?, please import @preview/shiroa:0.1.0; or do you forget the show rule `#show: book`?)"))?; + .ok_or_else(|| error_once!("no internal-package meta in book.typ (are you using old book package?, please import @preview/shiroa:0.1.1; or do you forget the show rule `#show: book`?)"))?; let InternalPackageMeta::Package { version } = &package_meta.value; - if version != "0.1.0" { + if version != "0.1.1" { return Err(error_once!( - "outdated book package, please import @preview/shiroa:0.1.0", importing_version: version, + "outdated book package, please import @preview/shiroa:0.1.1", importing_version: version, )); } } diff --git a/contrib/typst/gh-ebook.typ b/contrib/typst/gh-ebook.typ index 57d3171..02766b6 100644 --- a/contrib/typst/gh-ebook.typ +++ b/contrib/typst/gh-ebook.typ @@ -1,4 +1,4 @@ -#import "@preview/shiroa:0.1.0": * +#import "@preview/shiroa:0.1.1": * #import "/contrib/typst/gh-pages.typ": project, part-style #let _page-project = project diff --git a/contrib/typst/gh-pages.typ b/contrib/typst/gh-pages.typ index 35e10ee..f0e09c3 100644 --- a/contrib/typst/gh-pages.typ +++ b/contrib/typst/gh-pages.typ @@ -1,6 +1,6 @@ // This is important for shiroa to produce a responsive layout // and multiple targets. -#import "@preview/shiroa:0.1.0": get-page-width, target, is-web-target, is-pdf-target, plain-text, templates +#import "@preview/shiroa:0.1.1": get-page-width, target, is-web-target, is-pdf-target, plain-text, templates #import templates: * // Metadata diff --git a/github-pages/docs/book.typ b/github-pages/docs/book.typ index 9e31ec1..93df14a 100644 --- a/github-pages/docs/book.typ +++ b/github-pages/docs/book.typ @@ -1,5 +1,5 @@ -#import "@preview/shiroa:0.1.0": * +#import "@preview/shiroa:0.1.1": * #show: book diff --git a/github-pages/docs/cli/init.typ b/github-pages/docs/cli/init.typ index 5802d9f..8101397 100644 --- a/github-pages/docs/cli/init.typ +++ b/github-pages/docs/cli/init.typ @@ -32,7 +32,7 @@ shiroa build my-book/ # memoryized dest-dir The harder way, by creating the book without `init` command, your `book.typ` should at least provides a `book-meta`, as #cross-link("/guide/get-started.typ")[Get Started] shown. ```typ -#import "@preview/shiroa:0.1.0": * +#import "@preview/shiroa:0.1.1": * #show: book #book-meta( @@ -43,11 +43,15 @@ The harder way, by creating the book without `init` command, your `book.typ` sho ) ``` -// todo: update it -What is arguable, your `template.typ` must import and respect the `page-width` and `target` variable from `@preview/typst-ts-variables:0.1.0` to this time. +Your `template.typ` must import and respect the `page-width` and `target` variable from `@preview/shiroa:0.1.1` to this time. The two variables will be used by the tool for rendering responsive layout and multiple targets. ```typ -#import "@preview/typst-ts-variables:0.1.0": page-width, target +#import "@preview/shiroa:0.1.1": get-page-width, target, is-web-target, is-pdf-target + +// Metadata +#let page-width = get-page-width() +#let is-pdf-target = is-pdf-target() // target.starts-with("pdf") +#let is-web-target = is-web-target() // target.starts-with("web") #let project(body) = { // set web/pdf page properties @@ -65,7 +69,7 @@ What is arguable, your `template.typ` must import and respect the `page-width` a bottom: 0.5em, // remove rest margins. rest: 0pt, - )) if target.starts-with("web"); + )) if is-web-target; body } diff --git a/github-pages/docs/format/theme.typ b/github-pages/docs/format/theme.typ index 13fb592..fab1d54 100644 --- a/github-pages/docs/format/theme.typ +++ b/github-pages/docs/format/theme.typ @@ -17,7 +17,7 @@ Currently we have no much design on theme's html part. But you can still configu Your `book.typ` should at least provides a `book-meta`, as #t shown. ```typ -#import "@preview/shiroa:0.1.0": * +#import "@preview/shiroa:0.1.1": * #show: book #book-meta( @@ -29,10 +29,10 @@ Your `book.typ` should at least provides a `book-meta`, as #t shown. ``` // todo: update it -What is arguable, your `template.typ` must import and respect the `page-width` and `target` variable from `@preview/typst-ts-variables:0.1.0` to this time. +What is arguable, your `template.typ` must import and respect the `page-width` and `target` variable from `@preview/typst-ts-variables:0.1.1` to this time. ```typ -#import "@preview/typst-ts-variables:0.1.0": page-width, target +#import "@preview/typst-ts-variables:0.1.1": page-width, target #let project(body) = { // set web/pdf page properties diff --git a/github-pages/docs/guide/get-started.typ b/github-pages/docs/guide/get-started.typ index c4e6373..1d4ad61 100644 --- a/github-pages/docs/guide/get-started.typ +++ b/github-pages/docs/guide/get-started.typ @@ -48,7 +48,7 @@ Before a chapter can be viewed, it must be added to this list. Here's a basic summary file with a few chapters: ```typ -#import "@preview/shiroa:0.1.0": * +#import "@preview/shiroa:0.1.1": * #show: book #book-meta( // put metadata of your book like book.toml of mdbook diff --git a/github-pages/docs/pdf.typ b/github-pages/docs/pdf.typ index 6b52fd0..bd30c8c 100644 --- a/github-pages/docs/pdf.typ +++ b/github-pages/docs/pdf.typ @@ -1,4 +1,4 @@ -#import "@preview/shiroa:0.1.0": * +#import "@preview/shiroa:0.1.1": * #import "/contrib/typst/gh-ebook.typ" #let ebook = gh-ebook diff --git a/packages/shiroa-tests/test-no-bad-import.typ b/packages/shiroa-tests/test-no-bad-import.typ new file mode 100644 index 0000000..c7e929d --- /dev/null +++ b/packages/shiroa-tests/test-no-bad-import.typ @@ -0,0 +1,13 @@ +#import "../shiroa/lib.typ" +#import "../shiroa/media.typ" +#import "../shiroa/supports-link.typ" +#import "../shiroa/supports-text.typ" +#import "../shiroa/meta-and-state.typ" +#import "../shiroa/sys.typ" +#import "../shiroa/template-link.typ" +#import "../shiroa/template-theme.typ" +#import "../shiroa/templates.typ" +#import "../shiroa/summary-internal.typ" +#import "../shiroa/summary.typ" +#import "../shiroa/xcommand.typ" +#import "../shiroa/utils.typ" \ No newline at end of file diff --git a/packages/shiroa/typst.toml b/packages/shiroa/typst.toml index cd021f4..c859b10 100644 --- a/packages/shiroa/typst.toml +++ b/packages/shiroa/typst.toml @@ -1,6 +1,6 @@ [package] name = "shiroa" -version = "0.1.0" +version = "0.1.1" entrypoint = "lib.typ" authors = ["Myriad-Dreamin "] license = "Apache-2.0"