package docs
// HTML rendering for the writing passport. Self-contained (no external assets)
// and styled for print, so the browser's "Save as PDF" turns it into the file a
// writer actually hands over.
import (
"fmt"
"math"
"strings"
"time"
)
// Chart geometry. The plot is wide and short on purpose: the report's question
// is "what shape did this document grow in", and a wide aspect makes a steady
// climb read as steady rather than dramatic.
const (
chartW, chartH = 760, 260
padL, padR, padT, padB = 52, 20, 18, 34
plotW, plotH = chartW - padL - padR, chartH - padT - padB
minBandW = 2.0 // so a single-snapshot session still shows
// gutterSlots is the space between sessions, in snapshot-slot widths. Wide
// enough to read as a break and to seat its duration label.
gutterSlots = 2.5
)
// Palette — the export stylesheet's tokens, reused so a passport looks like it
// came from the same application as the document it describes.
const (
rose = "#b04a6a"
roseLight = "#f6d6e0"
roseWash = "#fdeef3"
surface = "#fffafb"
)
func renderPassport(d passportData) []byte {
var b strings.Builder
fmt.Fprintf(&b, passportHead, htmlEscape(d.Doc.Title))
fmt.Fprintf(&b, ` Writing passport Generated %s%s
This document has no saved history yet, so there is nothing to report. History builds up automatically as you write.