Documentation
¶
Overview ¶
Package document is the editable document deliverable: letters, invoices, minutes, programs, binders, contracts and any other document a buyer fills in Word, Google Docs, Pages or LibreOffice, and slide decks with speaker notes for PowerPoint, Keynote and Google Slides. One Markdown file per document and language and a theme from the concept compile to .docx files whose look lives in real styles, per language and paper size; a release prints them in Chrome as Word lays them out and checks what every app will show.
Index ¶
- Constants
- Variables
- func CopyLink(url string) string
- func Distribution(r Report, files []deliver.File, data map[string][]byte, images []Image, ...) (map[string][]byte, []string, []diagnostic.Diagnostic)
- func DownloadPage(r Report, files []deliver.File) []byte
- func FileName(title, ext string) string
- func PagePixels(e Edition) (int64, int64)
- func Present(p project.Project) bool
- func Rules() []diagnostic.RuleInfo
- type Block
- type Built
- type Config
- type Doc
- type Edition
- type Face
- type Field
- type Figure
- type Finding
- type Image
- type ImagePlan
- type Inline
- type Item
- type Paper
- type Plan
- type Planned
- type Report
- func (r Report) Build(previous func(key string) []byte) ([]Built, error)
- func (r Report) Digest() []byte
- func (r Report) Facts() []string
- func (r Report) FileNote(e Edition) string
- func (r Report) Guide(e Edition) []byte
- func (r Report) GuideAssets() map[string][]byte
- func (r Report) GuideName(e Edition) string
- func (r Report) Images(shots []Shot) []ImagePlan
- func (r Report) Inspect(b Built, pdf []byte) []Finding
- func (r Report) Jobs() []Built
- func (r Report) Preview(e Edition) []byte
- func (r Report) PreviewAssets() map[string][]byte
- func (r Report) PrintDoc(b Built) []byte
- func (r Report) ShotDoc(b Built) []byte
- func (r Report) Showcase() Edition
- func (r Report) Slug() string
- func (r Report) Verify(ctx context.Context, soffice string, built []Built) ([]Finding, error)
- func (r Report) Word(built []Built) ([]Finding, error)
- func (r Report) Zip(e Edition, built []Built, pdfs map[string][]byte, guide []byte, key string) ([]byte, error)
- func (r Report) ZipName(e Edition) string
- type Shot
- type Summary
- type Table
- type Theme
Constants ¶
const ( Dir = "deliverables/document" ConceptFile = Dir + "/concept.md" FontsDir = Dir + "/fonts" ImagesDir = Dir + "/images" ListingFile = Dir + "/listing.md" )
The layout under deliverables/document.
const ( RuleConfig = "document.config" RuleConcept = "document.concept" RuleFonts = "document.fonts" RuleSource = "document.source" RuleDesign = "document.design" RuleContent = "document.content" RuleLayout = "document.layout" RuleDelivery = "document.delivery" RuleListing = "document.listing" RuleChannels = "document.channels" )
Rule IDs.
const ( Para = markup.Para Heading = markup.Heading Title = markup.Title Subtitle = markup.Subtitle List = markup.List TableKind = markup.TableKind ImageKind = markup.ImageKind PageBreak = markup.PageBreak Ornament = markup.Ornament Box = markup.Box Columns = markup.Columns Form = markup.Form Signature = markup.Signature )
Block kinds.
Variables ¶
var DocumentColumns = []string{"Document", "Job"}
DocumentColumns are the columns of the Documents table.
var Papers = paper.Office
Papers are the sizes documents are built in.
var Sections = []concept.SectionSpec{ {Name: "Buyer"}, {Name: "Promise"}, {Name: "Documents"}, {Name: "Look"}, {Name: "Changelog", Optional: true}, }
Sections of the document concept, in order.
Functions ¶
func CopyLink ¶
CopyLink turns a Google Docs master's address into the link that makes the buyer's own copy.
func Distribution ¶
func Distribution(r Report, files []deliver.File, data map[string][]byte, images []Image, pending bool, day string) (map[string][]byte, []string, []diagnostic.Diagnostic)
Distribution assembles the shop packages: every edition's ZIP once, the images, a guide per shop and the README.
func DownloadPage ¶
DownloadPage renders the unlisted download page: the Google Docs copy links first, then the files.
func PagePixels ¶
PagePixels is an edition's paper in CSS pixels, for a first-page shot.
func Rules ¶
func Rules() []diagnostic.RuleInfo
Rules describes every document rule for the catalog.
Types ¶
type Built ¶
type Built struct {
Edition Edition
Doc *Doc
Name string // the file name buyers see: the document's title
Key string // the input key it is stamped with
Data []byte
}
Built is one .docx of one edition.
type Config ¶
type Config struct {
Path, Offer, Language, Sell, Version string
Papers []string // paper sizes for every language; default by language
Docs map[string]string // "lang/key" -> Google Docs master, for copy links
Seller string
}
Config is deliverables.document in lfm.json.
type Doc ¶
type Doc struct {
Key, Lang string
File string // path below the project
Title string
Pages int // the pages it must print on; 0 when it may grow
Ceremonial bool // centered layouts allowed: programs, invitations, certificates
Cover bool // the first page has no header or footer
Header string
Blocks []Block
}
Doc is one document of one language, as its Markdown file describes it.
type Edition ¶
type Edition struct {
Key, Lang, Paper string
}
Edition is one language on one paper: the unit buyers download.
type Finding ¶
type Finding struct{ File, Message string }
Finding is a release finding about one source file.
type Plan ¶
type Plan struct {
Name, Buyer, Promise string
Documents []Planned
Look theme.Look
Lines map[string]int
}
Plan is the parsed concept.
type Report ¶
type Report struct {
Config Config
Summary Summary
Plan Plan
Theme Theme
Diagnostics []diagnostic.Diagnostic
Buildable bool
Editions []Edition
Docs map[string][]*Doc // by language, in the concept's order
Listing deliver.ShopListing
// contains filtered or unexported fields
}
Report is the checked document set.
func Check ¶
func Check(p project.Project, cfg Config, configured bool, offers map[string]*deliver.Price, site string) Report
Check reads and checks the document set: concept, fonts, every document of every language, the theme on every paper, and the listing.
func (Report) Build ¶
Build writes every document of every edition. previous returns a file built from the same inputs before, which is used as is; the rest build side by side.
func (Report) Digest ¶
Digest is the hash of what every file of the set shares: the theme, the fonts and their licences, and the images.
func (Report) Guide ¶
Guide is an edition's start-here PDF as HTML to print: the documents, how to open them in every app, how to fill and restyle them, printing, the licence.
func (Report) GuideAssets ¶
GuideAssets are the font files a guide or listing image loads, by bare file name as the print server serves them.
func (Report) Images ¶
Images plans the listing images from the first edition's first pages, rendered from the real files: the first document alone, every document, each one large, then what the set works with.
func (Report) Inspect ¶
Inspect holds Chrome's print of a document to its plan: pages, paper and the theme's fonts.
func (Report) Jobs ¶
Jobs are every document of every edition with the key of its inputs, not yet built.
func (Report) PreviewAssets ¶
PreviewAssets are the fonts and images a preview loads, by path below its folder.
func (Report) Showcase ¶
Showcase is the edition the listing shows: the first in the listing's language, else the first.
func (Report) Verify ¶
Verify opens every built file in LibreOffice, one run for all, and holds its print to the plan as Inspect does Chrome's: another app's view of the real .docx.
func (Report) Word ¶
Word opens every built file in Microsoft Word for Mac and holds Word's own PDF of it to the plan, as Verify does LibreOffice's: a file Word has to repair, other pages, another paper, other fonts.
func (Report) Zip ¶
func (r Report) Zip(e Edition, built []Built, pdfs map[string][]byte, guide []byte, key string) ([]byte, error)
Zip packs an edition: its documents, their PDFs when printed, the start guide, and the fonts with their licence, so Pages users can install them. A key stamps a complete ZIP, so later compiles reuse it as is.
type Summary ¶
type Summary struct {
Name string `json:"name,omitempty"`
Concept bool `json:"concept"`
Fonts []string `json:"fonts,omitempty"` // the families the concept names
Documents int `json:"documents"`
Languages []string `json:"languages,omitempty"`
Editions []string `json:"editions,omitempty"`
Fields int `json:"fields"`
Sell string `json:"sell"`
URL string `json:"url,omitempty"`
Files []string `json:"files,omitempty"`
Listing bool `json:"listing"`
Linked int `json:"linked"`
Channels []string `json:"channels,omitempty"`
Images int `json:"images"`
Pending bool `json:"pending"`
Layout string `json:"layout,omitempty"`
}
Summary is what the compile report shows.