All Projects → otherjoel → Try Pollen

otherjoel / Try Pollen

Licence: other
📔🌼 An example website/book created with Pollen.

Programming Languages

perl
6916 projects
racket
414 projects

Labels

Projects that are alternatives of or similar to Try Pollen

Latexdiagrams
Latex Diagrams that I have generated/taken from internet.
Stars: ✭ 77 (-18.09%)
Mutual labels:  latex
Spmathkit
Render math exercises for your view. Contains the rendering of mathematical formulas and mathematical graphics, as well as the general text
Stars: ✭ 81 (-13.83%)
Mutual labels:  latex
Texstudio
TeXstudio is a fully featured LaTeX editor. Our goal is to make writing LaTeX documents as easy and comfortable as possible.
Stars: ✭ 1,300 (+1282.98%)
Mutual labels:  latex
Mathematical modeling
🎊 Mathematical Modeling Algorithms and Applications
Stars: ✭ 78 (-17.02%)
Mutual labels:  latex
Heckle
✒️ Jekyll in Haskell (feat. LaTeX)
Stars: ✭ 80 (-14.89%)
Mutual labels:  latex
Hacking vim
Hacking Vim 7.2 中文翻译, 采用 LaTeX 排版
Stars: ✭ 84 (-10.64%)
Mutual labels:  latex
Laravel Smartmd
🎯 A simple markdown editor compatible most markdown parse,You can choose any parse methods on server or client,like Mathematical formula、flowchart、upload image...
Stars: ✭ 76 (-19.15%)
Mutual labels:  latex
Good Articles By Sort
本仓库用来存放我看过的认为比较好的文章---根据分类排序
Stars: ✭ 93 (-1.06%)
Mutual labels:  latex
Cookietemple
A collection of best practice cookiecutter templates for all domains and languages with extensive Github support
Stars: ✭ 81 (-13.83%)
Mutual labels:  latex
Texreg
Conversion of R Regression Output to LaTeX or HTML Tables
Stars: ✭ 85 (-9.57%)
Mutual labels:  latex
Cppadcodegen
Source Code Generation for Automatic Differentiation using Operator Overloading
Stars: ✭ 77 (-18.09%)
Mutual labels:  latex
Excel2latex
Javascript .xlsx to LaTeX table converter
Stars: ✭ 79 (-15.96%)
Mutual labels:  latex
Tongjithesis
同济大学本科毕业设计LaTeX模板 LaTeX template for Tongji Undergaduate Thesis
Stars: ✭ 85 (-9.57%)
Mutual labels:  latex
Pandoc Letter Din5008
Pandoc template for writing Markdown letters (DIN 5008)
Stars: ✭ 77 (-18.09%)
Mutual labels:  latex
Adstex
Automated generation of NASA ADS bibtex entries directly from citation keys in your TeX source files
Stars: ✭ 89 (-5.32%)
Mutual labels:  latex
Latex Homework Class
A class for homework assignments written in LaTeX.
Stars: ✭ 76 (-19.15%)
Mutual labels:  latex
Mathbin
Math pastebin with LaTeX and Markdown support
Stars: ✭ 83 (-11.7%)
Mutual labels:  latex
Awesome Resume For Chinese
📄 适合中文的简历模板收集(LaTeX,HTML/JS and so on)由 @hoochanlon 维护
Stars: ✭ 1,324 (+1308.51%)
Mutual labels:  latex
Code2race
Solve the problem. 😊 If you like ❤ give us a star⭐. HACKTOBERFEST
Stars: ✭ 91 (-3.19%)
Mutual labels:  latex
Aaulatextemplates
A collection of Aalborg University LaTeX-templates
Stars: ✭ 85 (-9.57%)
Mutual labels:  latex

“Secretary of Foreign Relations”

(A test Pollen site: version 0.25)

I’ve created this site to experiment with making websites that are also printed books using Pollen, as well as to help explain Pollen to people who might be interested in using it for themselves. The official Pollen documentation is well done and improving all the time, and you should really start by reading it thoroughly. But a quasi-guided tour through a simple working site might help put the pieces together, and illustrate the benefits of the Pollen system.

You can see the site live at https://thelocalyarn.com/excursus/secretary. While browsing there, be sure to click on the “◊ Pollen Source” links at the top of the individual pages to see the Pollen markup that was used to generate that page.

Thanks to Matthew Butterick and Malcolm Still for their help with my Racket and Pollen questions.

Support

If you find this project helpful, consider chipping a few bucks towards the author!

Buy Me a Coffee at ko-fi.com

Setup

  1. Install Pollen (instructions)
  2. (Optional) To be able to generate PDFs as well as HTML, you should have a working installation of LaTeX (specifically xelatex) and the Tufte-Latex classes installed. If you're on a Mac, installing MacTeX will satisfy both of these. (Note, if your shell is something other than bash, you'll need to take steps to ensure /Library/TeX/texbin is on your PATH.) Also see the note in the LaTeX/PDF section (further down) on specifying fonts that you have installed on your system, otherwise PDF builds may fail.
  3. Clone or download this repo
  4. raco pollen start from the main folder, then point your browser to http://localhost:8080

If you have GNU Make installed (Mac or Linux) you can run make all from the main project folder. Run make spritz to clean up various working directories, or make zap to delete all the output files and start fresh. See the makefile for more info (it’s pretty well commented), and of course see the docs on raco pollen for more on generating the files in Pollen.

Points of interest

A brief and incomplete self-guided tour of the code follows. I add new things from time to time, so check back.

  • Look at pollen.rkt to see the definitions for the markup I use in this project, and the code that glues everything together.
  • feed.xml.pp is where the RSS feed is generated.
  • The two files flatland-book.pdf.pp and flatland-book.ltx.pp generate a complete PDF book of Flatland using the same .poly.pm source files in the flatland/ subfolder. This PDF file can be sent right to CreateSpace or any other print-on-demand service; as a demonstration, I’ve made the print book available for order at CreateSpace.
  • Look through the .pm files to see what writing in Pollen markup looks like. (Another way to do this is to click the “Pollen source” links on sub-pages at the live site.)

Custom markup

So far I’ve added two minor markup innovations to this project:

  1. A ◊verse tag for poetry: This is one example of an area that Markdown does not (and likely will never) address properly. By using this tag I can output the exact HTML markup I need, which I can then style with CSS to center based on the width of the longest line. In LaTeX/PDF, this tag also automatically replaces double-spaces with \vin to indent lines.

  2. An ◊index-entry tag: Intended to mark passages of text for inclusion in a book-style index. A separate page, bookindex.html, iterates through the pagetree, gathers up all of these entries and displays them in alphabetical order, grouped by heading. (Basically just like the index at the back of any serious book you have on your shelf.) This is another example of something that would be impossible in Markdown. Of course, on the web, this is something of an anachronism: it would probably be better for the reader to have a normal search form to use. However, besides serving as an illustration, this tag will allow for effortless inclusion of an index when I add support for this in LaTeX/PDF.

    You can see the code used to generate the index at the bottom of pollen.rkt and in the template-bookindex.html file.

LaTeX/PDF support

Any file with the .poly.pm extension can be generated as a pretty darn nice-looking PDF file as well as HTML. My LaTeX templates make use of the Tufte-LaTeX document classes, to match the Tufte-CSS in use on the web side.

In addition, the preprocessor files flatland/flatland-book.ltx.pp and flatland/flatland-book.pdf.pp generate a complete PDF of the entire Flatland book.

You may want to edit the fonts specified in the \setromanfont and \setmonofont commands in template.ltx.p, template.pdf.p and flatland/flatland-book.ltx.pp; I have them set to Adobe Caslon Pro and Triplicate, respectively, so if you don't have those fonts installed you will get errors.

The official Pollen docs describe the basic method for LaTeX and PDF targets, but my method differs somewhat due to the need for additional cleverness.

In my LaTeX template, any hyperlinks also get auto-converted to numbered side-notes. Unfortunately, this niftiness also means that when targeting LaTeX, you can't have a hyperlink inside a side-note since that would equate to a side-note within a side-note, which causes Problems. I could simply stipulate "don't put hyperlinks in margin notes" but I wanted a more elegant solution. Solving this problem meant departing from the methods in the official tutorial. The details are in this post at the Pollen mailing list.

RSS feed

The site now generates an RSS feed in Atom 1.0 format (tested at the Feed Validator, of course). The feed.xml.pp file is heavily commented and explains how this works.

Grouping pages by series

I implemented a simple system for grouping pages according to a “series” — think of a series of articles in a journal or magazine (or maybe what you’d call categories in a blog).

As specified in index.ptree all posts sit together in one big pool in the posts subfolder. Each post can optionally specify a series:

◊(define-meta series "series/poems.html")

I opted to specify the series by the Pollen target filename, but it could just as easily be the human-friendly name of the series (doing it this way allows me to change that name without affecting the posts that refer to it).

Then for every series, I create a Pollen file in the series subfolder which serves as a brief introduction to the series, and manually add that to index.ptree.

The file template-index.html (the template specified in index.html.pm) includes code that iterates over all the pages in the series subfolder, prints out its contents, then lists all the posts that specify that series in their metadata (using the list-posts-in-series function defined in pollen.rkt).

Converting Markdown to Pollen

I’ve created a basic custom writer for pandoc that allows you to convert Markdown files (or anything, really) into Pollen markup. I’d see three appropriate uses for this. One is for banging out first drafts that consist of long stretches of simple prose. In those cases there's not a lot of structure or metadata to be concerned with at the very outset, and you can take advantage of editors and tools that recognize Markdown syntax. Second, it allows you to more easily accept drafts in other formats from other people who aren't familiar with Pollen concepts. Third (the big one for me) it can help a lot with automating the process of mass-importing old material into a Pollen publication.

The code is in util/pandoc-pollen.lua, and the template file is in util/pandoc-pollen-template.pm. You can use it like so from within the project root folder:

pandoc -t util/pandoc-pollen.lua -o YOUR-OUTPUT.poly.pm --template=util/pandoc-pollen-template.pm SOURCEFILE.md

Or to convert a bunch of Markdown files at once, run this Bash script:

#!/bin/bash

for f in *.md; do \
 pandoc --template=util/pandoc-pollen-template.pm -t pandoc-pollen.lua "$f" > "$f.poly.pm"
done

You should open up util/pandoc-pollen.lua and util/pandoc-pollen-template.pm and customize the code to match the Pollen markup for your project. You’ll likely still need to clean up the resulting files once they’ve been sent through the wringer, but this will do a lot of the tedious work for you.

Other good examples

Besides getting answers to my inane newbie questions in the discussion group (which I try my best to keep to a minimum), I’m greatly assisted by being able to peruse the code of a couple of other Pollen creations.

Matthew Butterick's article Making a dual typed/untyped Racket library was created with Pollen and is a good learning resource. I initially missed the links at the bottom to the Pollen source code for the article, which is very well commented.

Malcolm Still also has the code for his blog in a public repository.

Matthew Butterick also keeps a list of other Pollen projects and guides in the official Pollen documentation.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].