diff --git a/Makefile b/Makefile index d51c703..d6c82b5 100644 --- a/Makefile +++ b/Makefile @@ -34,8 +34,8 @@ deps: .PHONY: pdf pdf: build deps - @echo "Generating PDF with headless Chrome..." - @$(GO) run ./cmd/pdf --in $(OUT_DIR)/print.html --out $(PDF) + @echo "Generating PDF by rendering each page and merging..." + @$(GO) run ./cmd/pdfbook --pages $(OUT_DIR) --order pages.yaml --out $(PDF) .PHONY: pdf-2up pdf-2up: build deps diff --git a/assets/css/smartbar.css b/assets/css/smartbar.css index 002508a..5470601 100644 --- a/assets/css/smartbar.css +++ b/assets/css/smartbar.css @@ -1,6 +1,6 @@ @font-face { font-family: "Heading Now"; - src: url("/assets/font/HeadingNow-95Medium.otf"); + src: url("../font/HeadingNow-95Medium.otf"); } .ytmnd-1 { diff --git a/cmd/build/main.go b/cmd/build/main.go index a65333d..216911c 100644 --- a/cmd/build/main.go +++ b/cmd/build/main.go @@ -8,7 +8,6 @@ import ( "io/fs" "os" "path/filepath" - "regexp" "sort" "strings" @@ -27,152 +26,6 @@ func floatToIn(v float64) string { return strings.TrimRight(strings.TrimRight(fmt.Sprintf("%.4fin", v), "0"), ".") } -func min(a, b int) int { - if a < b { - return a - } - return b -} - -// extractAndScopeCSS extracts `) - matches := styleRegex.FindAllStringSubmatch(content, -1) - - var scopedCSS strings.Builder - contentWithoutCSS := content - - // Remove all \ No newline at end of file + \ No newline at end of file diff --git a/templates/print.gohtml b/templates/print.gohtml index fe97eaf..bb64325 100644 --- a/templates/print.gohtml +++ b/templates/print.gohtml @@ -5,6 +5,7 @@ Print + {{ range .Pages }} -
{{ .Content }}
+
{{ .Content }}
{{ end }} diff --git a/templates/print_2up.gohtml b/templates/print_2up.gohtml index de4c31b..339a663 100644 --- a/templates/print_2up.gohtml +++ b/templates/print_2up.gohtml @@ -14,18 +14,16 @@ /* Each .sheet is one letter-sized page */ .sheet { display: flex; gap: 0; margin: 0; padding: 0; width: 11in; height: 8.5in; } .cell { width: 5.5in; height: 8.5in; overflow: hidden; } - .cell > .page-content { width: 5.5in; height: 8.5in; box-shadow: none !important; } + .cell > #page { width: 5.5in; height: 8.5in; box-shadow: none !important; } .sheet { page-break-after: always; break-after: page; } .sheet:last-child { page-break-after: auto; break-after: auto; } - - PLACEHOLDER_FOR_SCOPED_CSS {{ range .Sheets }}
-
{{ .Left.Content }}
- {{ if .Right }}
{{ .Right.Content }}
{{ end }} +
{{ .Left.Content }}
+ {{ if .Right }}
{{ .Right.Content }}
{{ end }}
{{ end }}