Documentation
¶
Overview ¶
Package deliver holds what every deliverable a page sells shares: the unlisted folder its files are served from, file names, and the download page buyers land on after paying.
Index ¶
- Constants
- Variables
- func CSSValue(s string) string
- func CopyLink(url, kind string) string
- func JPEGStamp(jpg []byte) string
- func NewPath() string
- func Page(d Download) []byte
- func PlainText(md string) string
- func RawSection(text string, d concept.Document, name string) string
- func Sell(mode string) string
- func Shop(raw string) string
- func Shops() []string
- func Slug(title, fallback string) string
- func StampJPEG(jpg []byte, key string) []byte
- func ValidPath(p string) bool
- type Download
- type File
- type Issue
- type Link
- type Price
- type ShopListing
- type ShopPackage
- type Wording
Constants ¶
const ( // SellPage sells through the page's checkout: after paying, buyers land // on an unlisted download page lfm publishes. The default. SellPage = "page" // SellShops sells through shops that deliver the files themselves; the // page's buy buttons link to the shop listings and no download page exists. SellShops = "shops" // SellBundle sells a deliverable only inside the bundle. SellBundle = "bundle" )
How a deliverable or a bundle is sold, as its "sell" in lfm.json says.
const ( MaxTitle = 140 MaxTags = 13 MaxTag = 20 MinDescription = 200 )
Store limits, from the strictest channel (Etsy).
const ( EtsyFiles = 5 EtsyFileBytes = 20 << 20 EtsyImages = 20 )
Shop limits that shape a package.
const MinPathLength = 16
MinPathLength is the shortest unlisted download folder name: the path is the only lock on the files.
Variables ¶
var LinkText = regexp.MustCompile(`(?i)\bhttps?://|\bwww\.[a-z0-9-]+\.|[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}`)
LinkText matches a web address or email address in store copy, which stores refuse in descriptions.
var ShopListingSections = []concept.SectionSpec{
{Name: "Title"}, {Name: "Description"}, {Name: "Tags"}, {Name: "Price"}, {Name: "AI"},
}
ShopListingSections are the sections of a shop listing.md, in order.
Functions ¶
func CopyLink ¶
CopyLink turns the address of a shared Google Docs, Slides or Sheets master of kind (document, presentation, spreadsheets) into the link that makes the buyer's own copy; "" for any other address.
func Page ¶
Page renders the download page: marked noindex and sending no referrer, so the address does not travel.
func RawSection ¶
RawSection returns the source lines of a section as written, blank lines included, so Markdown paragraphs survive.
func Shop ¶
Shop names the shop a checkout URL belongs to, or "" for any other host, such as a Stripe Payment Link.
func Shops ¶
func Shops() []string
Shops returns the keys of the digital shops lfm prepares guides for.
func Slug ¶
Slug is a file name for a title: lowercase ASCII, accents folded and the letters that do not decompose spelled out, so "Größer leben" is groesser-leben. fallback names a title without letters.
Types ¶
type Download ¶
type Download struct {
Language, Title, Subtitle, Accent string
Heading string // the page title, e.g. "Download: <title>"
Links []Link // shown before the files
Files []File
Thanks string // above the files
Pending string // instead of the files while they are not ready
Keep string // below the files
}
Download is the unlisted page buyers land on after paying.
type Issue ¶
type Issue struct{ Message, Hint string }
Issue is a reason a shop would refuse what was built.
type Link ¶
type Link struct{ Label, URL, Note string }
Link is an address on the download page, such as a Google Sheets copy link.
type Price ¶
Price is one list price, e.g. of an edition or a product.
func ParsePrice ¶
ParsePrice reads a price written as 7.99 EUR or 7,99 EUR.
type ShopListing ¶
type ShopListing struct {
Present bool
Title string
Description string // Markdown
Tags []string
Price *Price
AIText string
AIImages string
AITools string
AIStatement string
}
ShopListing is a parsed listing.md of a product sold in digital shops: a printable or a bundle.
func CheckShopListing ¶
func CheckShopListing(text string, offer *Price, add func(line int, message, hint string)) ShopListing
CheckShopListing parses a shop listing.md and reports where a shop would refuse it or where its price differs from the page's offer.
func (ShopListing) AIUsed ¶
func (l ShopListing) AIUsed() bool
AIUsed reports whether the product declares any AI use.
type ShopPackage ¶
type ShopPackage struct {
Name string
Source string // the folder it is built from, e.g. deliverables/printable
Listing ShopListing
Files []string // every download, in order; their bytes are in the files map
Groups map[string][]string // when Etsy's five files do not hold Files: ZIP name -> files in it
Images []string // listing images under images/, in order
Facts []string // what the files hold, from the build
Decide []string // the README's decisions for the owner
Pending bool // prints wait for the next release
External []string // outside links inside the files
}
ShopPackage is a product sold in digital shops (Etsy, Gumroad, Payhip, Ko-fi): its files, listing images and texts.