diff --git a/internal/build/funcs.go b/internal/build/funcs.go index f30aab8..933899c 100644 --- a/internal/build/funcs.go +++ b/internal/build/funcs.go @@ -194,11 +194,11 @@ func funcs(s *site.Site, a *Assets, md *site.Markdown, icons Icons) template.Fun "excerpt": func(n int, v any) string { return site.Excerpt(n, fmt.Sprint(v)) }, // termURL "tags" "Open Source" -> /tags/open-source/ (or "" if it has none). "termURL": s.TermURL, - // term "tags" "Linux" -> that term's page (nil if there is none), with - // what content/tags/linux.md says about it. + // term "tags" "Garden" -> that term's page (nil if there is none), with + // what content/tags/garden.md says about it. "term": s.TermPage, - // tagged "tags" "Linux" (collection "products"): the products tagged - // Linux, in the collection's order. + // tagged "tags" "Garden" (collection "products"): the products tagged + // Garden, in the collection's order. "tagged": s.Tagged, // isExternal: an absolute link to another site. "isExternal": md.External, diff --git a/internal/importer/html2md_test.go b/internal/importer/html2md_test.go index 22cbf5a..99c065f 100644 --- a/internal/importer/html2md_test.go +++ b/internal/importer/html2md_test.go @@ -68,8 +68,8 @@ func TestShortSummary(t *testing.T) { if got := shortSummary(one); len([]rune(got)) > 160 || !strings.HasSuffix(got, "word…") { t.Errorf("one long sentence: %q (%d)", got, len([]rune(got))) } - dotted := "A black heavyweight tee with the kitten on it. A small mark sits on the left chest. The full mark and example.org run across the back. Sizes S to 4XL, printed to order." - if got := shortSummary(dotted); got != "A black heavyweight tee with the kitten on it. A small mark sits on the left chest. The full mark and example.org run across the back." { + dotted := "A green canvas apron with a deep pocket for your garden tools. A small logo sits on the chest. The full logo and example.org run across the back. Sizes S to XL, made to order." + if got := shortSummary(dotted); got != "A green canvas apron with a deep pocket for your garden tools. A small logo sits on the chest. The full logo and example.org run across the back." { t.Errorf("a full stop inside a word: %q", got) } if got := shortSummary("Short and sweet."); got != "Short and sweet." { diff --git a/internal/packs/bundled_test.go b/internal/packs/bundled_test.go index 8395912..baa5b6e 100644 --- a/internal/packs/bundled_test.go +++ b/internal/packs/bundled_test.go @@ -160,23 +160,23 @@ func TestBundledPacksBuildAndPass(t *testing.T) { {"content/products/kit.md", "---\ntitle: Starter kit\nsummary: A jar of starter.\nprice: 24\ncurrency: USD\nweight: 1\nphotos:\n - { image: /media/a.png, alt: A jar }\n - { image: /media/b.png, alt: The card }\nbuy: \"https://buy.stripe.com/test_1\"\noptions:\n - { name: With a basket, price: 39.5, buy: \"https://buy.stripe.com/test_2\" }\n---\nWhat's in the box.\n"}, {"content/products/mug.md", "---\ntitle: Mug\nsummary: A mug.\nprice: 12\ncurrency: EUR\nweight: 2\nsold_out: true\n---\n"}, {"content/products/hoodie.md", "---\ntitle: Hoodie\nprice: 40\ncurrency: USD\nweight: 4\nphotos:\n - { image: /media/a.png, alt: Hoodie in red, group: Red }\n - { image: /media/b.png, alt: Hoodie in blue, group: Blue }\nchoose: Size\nvariants:\n - { group: Red, name: S, price: 40, id: r1 }\n - { group: Red, name: M, price: 40, id: r2 }\n - { group: Blue, name: S, price: 40, id: b1 }\ncheckout: { action: \"https://shop.example/cart/checkout\", field: products, item: \"{id}:{qty}\" }\n---\n"}, - {"content/products/tee.md", "---\ntitle: Tee\nsummary: A tee.\nprice: 24\nprice_from: true\ncurrency: USD\nweight: 3\ntags: [Linux, Shirts]\nphotos:\n - { image: /media/a.png, alt: The tee }\nchoose: Size\nvariants:\n - { name: S, price: 24, id: v1 }\n - { name: 2XL, price: 26, id: v2 }\n - { name: 3XL, price: 28, id: v3, sold_out: true }\ncheckout: { action: \"https://shop.example/cart/checkout\", field: products, item: \"{id}:{qty}\", join: \",\", fields: { currency: USD } }\n---\n"}, - {"content/products/cap.md", "---\ntitle: Cap\nsummary: A cap.\nprice: 20\ncurrency: USD\nweight: 4\ntags: [linux]\nvariants:\n - { group: Black, name: One size, price: 20, value: \"c1:1\" }\ncheckout: { action: \"https://shop.example/cart/checkout\" }\n---\n"}, + {"content/products/tee.md", "---\ntitle: Tee\nsummary: A tee.\nprice: 24\nprice_from: true\ncurrency: USD\nweight: 3\ntags: [Garden, Shirts]\nphotos:\n - { image: /media/a.png, alt: The tee }\nchoose: Size\nvariants:\n - { name: S, price: 24, id: v1 }\n - { name: 2XL, price: 26, id: v2 }\n - { name: 3XL, price: 28, id: v3, sold_out: true }\ncheckout: { action: \"https://shop.example/cart/checkout\", field: products, item: \"{id}:{qty}\", join: \",\", fields: { currency: USD } }\n---\n"}, + {"content/products/cap.md", "---\ntitle: Cap\nsummary: A cap.\nprice: 20\ncurrency: USD\nweight: 4\ntags: [garden]\nvariants:\n - { group: Black, name: One size, price: 20, value: \"c1:1\" }\ncheckout: { action: \"https://shop.example/cart/checkout\" }\n---\n"}, {"content/cart.md", "---\ntitle: Your cart\nlayout: cart\nsuggest: 3\n---\n"}, - {"content/tags/linux.md", "---\ntitle: Linux things\nlayout: shelf\n---\nFor the penguin people.\n"}, + {"content/tags/garden.md", "---\ntitle: Garden things\nlayout: shelf\n---\nFor people with dirt under their nails.\n"}, {"content/tags/kitchen.md", "---\ntitle: Kitchen\n---\nComing soon.\n"}, {"content/tags/shirts.md", "---\ntitle: Shirts\nsummary: Cotton, mostly.\nlayout: shelf\n---\n"}, - {"content/picks.md", "---\ntitle: Picks\nsummary: Picks.\nsections:\n - products: { heading: Penguin picks, tag: Linux, more: All Linux things }\n---\n"}, + {"content/picks.md", "---\ntitle: Picks\nsummary: Picks.\nsections:\n - products: { heading: Gardener's picks, tag: Garden, more: All garden things }\n---\n"}, {"content/products/print.md", "---\ntitle: Print\nsummary: A print.\nprice: 30\ncurrency: USD\nweight: 5\nvariants:\n - { group: Matte, name: A4, price: 30, buy: \"https://buy.stripe.com/a4\" }\n - { group: Matte, name: A3, price: 40, buy: \"https://buy.stripe.com/a3\", sold_out: true }\n---\n"}, }, map[string][]string{ "products/tee/index.html": {`
`, ``, "Size", `name="products" value="v1:1" required data-option="S" data-cart-variant data-id="v1" data-name="S" data-price="24">`, "2XL $26.00", `value="v3:1" required disabled data-option="3XL" data-cart-variant`, "3XL sold out", `data-cart-add hidden>Add to cart`, `product-buy-button" type="submit">Buy now`, `