Repository navigation
Recipes, part 6: the cookbook as PDF and EPUB - #98
Merged
Merged
Conversation
A category that holds recipes can be exported as a book, made on the device after the passphrase and a warning that the file is in clear: a PDF laid out in phi (golden 144 x 233 mm, A5 or A4) with a cover, linked contents, a chapter per category in its serv.pub colour, each recipe from a new page, a QR code to a published step video and an index of ingredients; or an EPUB 3 for e-readers. Recipes go through the same PublicationPolicy and PageComposer as serv.pub, so no private link or vault id reaches the file; pictures are rewritten as JPEG from their pixels alone. The book's category colours are a Dart port of the server's colour.rs. Files are saved on Android and iOS through the system document dialogs, which also brings backup and export to phones. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rvr6HJwgZKVC2FvU1Tmgyp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is the last part of the recipes plan: exporting a cookbook as a book.
What changes
lib/cookbook/cookbook.dart,cookbook_pages.dart):PublicationPolicyandPageComposer, so the book shows exactly what serv.pub would show: no private note links and no vault ids.CategoryColoursinpublishingis a Dart port ofcolour.rs. A test checks it against the server's values.cookbook_pdf.dart,pdfpackage):cookbook_epub.dart): the mimetype entry comes first and is stored uncompressed. The book haspackage.opf,nav.xhtml, a page per chapter and per recipe, and a linked ingredient index. The CSS uses the φ scale and the chapter colours; there is no script and no font. All text is escaped, Markdown is read by the app's own reader, and only http(s) links are kept.NativeFileExchange(file_picker) uses the Storage Access Framework on Android and the document picker on iOS. It is now passed toVaultGate.fileson mobile too, so «Backup ed esportazione» also appears on Android and iOS.describeFieldis moved out of the publish sheet so the book can reuse it.Tests
test/cookbook/cookbook_test.dart:<script>,javascript:, trackers) never become markup;test/cookbook/cookbook_sheet_test.dart: the warning, PDF, EPUB without photos, and a category with no recipes.packages/publishing/test/category_colours_test.dart.flutter analyzeclean), as do publishing and architecture_guard.pdftoppm. Every EPUB XML file parses as well-formed. I did not run epubcheck in this environment.Known limits
Generated by Claude Code