Skip to content

theodore-s-beers/ganjoor-pretty

Repository files navigation

ganjoor-pretty

Go to the page for any ghazal or qaṣīdah on Ganjoor, and replace .net with .fly.dev to see a pretty-printed version of the poem.

For example, https://ganjoor.net/hafez/ghazal/sh407 becomes https://ganjoor.fly.dev/hafez/ghazal/sh407.

The developers at Ganjoor were gracious enough to add this functionality to the site itself. You can activate it with a button labeled numā-yi chāpī. I'm continuing to maintain my service so that I can improve it over time.

NB: This is the successor to an earlier mini-project, ghazal-typesetting, which may still be of interest to some.

Technical notes

This is basically a little Rust application, built with Actix Web. It takes a Ganjoor URL, fetches the relevant poem through their API (using the reqwest crate), and constructs a new HTML document with Pandoc—which is a required external dependency. Note that we're asking Pandoc to bundle in head.html, which in turn references styles.css and pretty.js. So those files also need to be present. The application listens on localhost port 8080 and could be put on a server behind a reverse proxy, with a CDN for caching, etc. Pretty straightforward.