Pollen: The Book Is a Program

tosh2 pts0 comments

Pollen: the book is a programâ–¼Pollen: the book is a program<br>1 Installation2 Quick tour3 Backstory4 The big picture5 First tutorial: the project server & preprocessor6 Second tutorial: Markdown, templates, & pagetrees7 Third tutorial: Pollen markup & tag functions8 Fourth tutorial: multiple output targets9 Mini tutorials10 Using raco pollen11 File formats12 Pollen command syntax13 Programming Pollen14 Module reference15 Unstable module reference16 Acknowledgments17 License & source code18 Version notes (3.2.4604.793)Index

On this page:<br>Pollen: the book is a program

9.2<br>Racket<br>top contents &larr; prev up next &rarr;<br>Pollen: the book is a program🔗ℹ<br>Matthew Butterick mb@mbtype.com>

#lang pollen package: pollen<br>Pollen is a publishing system that helps authors make functional and beautiful digital books.<br>I created Pollen so I could make my web-based books Practical Typography, Typography for Lawyers, and Beautiful Racket. Sure, go take a look. Are they better than the last digital books you encountered? Yes they are. Would you like your next digital book to work like that? If so, keep reading.<br>At the core of Pollen is an argument:<br>Digital books should be the best books we&rsquo;ve ever had. So far, they&rsquo;re not even close.

Because digital books are software, an author shouldn&rsquo;t think of a book as merely data. The book is a program.

The way we make digital books better than their predecessors is by exploiting this programmability.

That&rsquo;s what Pollen is for.<br>Not that you need to be a programmer to start using Pollen. On the contrary, the Pollen language is markup-based, so you can write & edit text naturally. But when you want to automate repetitive tasks, add cross-references, or pull in data from other sources, you can access a full programming language from within the text.<br>That language is Racket. I chose Racket because it has some unique features that made Pollen possible. So if it&rsquo;s unfamiliar to you, don&rsquo;t panic. It was unfamiliar to me. Once you see what you can do with Racket & Pollen, you may be persuaded. I was.<br>Or, if you can find a better digital-publishing tool, use that. But I&rsquo;m never going back to the way I used to work.<br>1 Installation<br>1.1 Prerequisites<br>1.2 How to install<br>1.3 Beyond that<br>1.4 Getting more help<br>1.4.1 Bugs and feature requests<br>1.4.2 Can I see the source for Practical Typography or Typography for Lawyers?<br>1.4.3 Utilities & libraries<br>1.4.4 More projects & guides

2 Quick tour<br>2.1 Creating a source file<br>2.2 Running a source file<br>2.3 Naming, saving, and rendering a source file<br>2.4 The project server<br>2.5 Intermission<br>2.6 Pollen as a preprocessor<br>2.7 Markdown mode<br>2.8 Pollen markup<br>2.9 Templates<br>2.10 PS for Scribble users<br>2.11 The end of the beginning

3 Backstory<br>3.1 Web development and its discontents<br>3.2 The better idea: a programming model<br>3.3 &ldquo;Now you have two problems&rdquo;<br>3.4 Rethinking the solution for digital books<br>3.5 Enter Racket<br>3.6 What is Pollen?

4 The big picture<br>4.1 The book is a program<br>4.2 One language, multiple dialects<br>4.3 Development environment<br>4.4 A special data structure for HTML<br>4.5 Pollen command syntax<br>4.6 The preprocessor<br>4.7 Templated source files<br>4.8 Pagetrees

5 First tutorial: the project server & preprocessor<br>5.1 Prerequisites<br>5.2 Optional reading: the relationship of Racket & Pollen<br>5.3 Starting a new file in DrRacket<br>5.3.1 Setting the #lang line<br>5.3.2 Putting in the text of the poem<br>5.3.3 Saving & naming your source file<br>5.4 Using the project server<br>5.4.1 Starting the project server with raco pollen<br>5.4.2 The project dashboard<br>5.4.3 Source files in the dashboard<br>5.5 Working with the preprocessor<br>5.5.1 Setting up a preprocessor source file<br>5.5.2 Creating valid HTML output<br>5.5.3 Adding Pollen commands<br>5.5.4 Racket basics (if you&rsquo;re not familiar)<br>5.5.5 Defining variables with Racket-style commands<br>5.5.6 Inserting values from variables<br>5.5.7 Inserting variables within CSS<br>5.6 First tutorial complete

6 Second tutorial: Markdown, templates, & pagetrees<br>6.1 Prerequisites<br>6.2 Optional reading: the case against Markdown<br>6.3 Markdown in Pollen: two options<br>6.3.1 Using Markdown with the preprocessor<br>6.3.2 Authoring mode<br>6.3.3 X-expressions<br>6.3.4 Markdown authoring mode<br>6.3.5 Review: authoring mode vs. preprocessor mode<br>6.4 Templates<br>6.4.1 The doc export and the ->html function<br>6.4.2 Making a custom template<br>6.4.3 Inserting specific source data into templates<br>6.4.4 Linking to an external CSS file<br>6.5 Intermission<br>6.6 Pagetrees<br>6.6.1 Pagetree navigation<br>6.6.2 Using the automatic pagetree<br>6.6.3 Adding navigation links to the template with here<br>6.6.4 Handling navigation boundaries with conditionals<br>6.6.5 Making a pagetree file<br>6.6.6 index.ptree & the project server<br>6.7 Second tutorial complete

7 Third tutorial: Pollen markup & tag functions<br>7.1 Prerequisites<br>7.2 Optional reading: Pollen markup vs. XML<br>7.2.1 The XML problem<br>7.2.2 What Pollen markup does differently<br>7.2.3 &ldquo;But I really need XML…&rdquo;<br>7.3...

pollen source book tutorial file racket

Related Articles