💾 Archived View for idiomdrottning.org › rfc-epub captured on 2024-05-26 at 14:38:45. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2024-05-12)

🚧 View Differences

-=-=-=-=-=-=-

RFC on e-ink readers

I used httrack and Calibre’s ebook-convert for what I thought was the best results.

First, go to rfc-editor.org and select the HTML version of your RFC, for example RFC 9421:

RFC 9421: HTTP Message Signatures

Then, I downloaded it with:

httrack -g https://www.rfc-editor.org/rfc/rfc9421.html --levels 1

Then I converted that like this:

ebook-convert rfc9421.html "RFC 9421: HTTP Message Signatures.epub" --max-levels 1

Background

Since I was heading down this particular yak-shaving rabbit-hole this morning, with a couple of false starts and dead ends, I thought I’d note down for posterity what I landed on.

I tried out three or four other solutions, like RFC2Kindle.py and rfc2epub.php, but they didn’t work very well. I didn’t realize that rfc-editor has HTML versions now.

Truth is, I already had an iPad shortcut set up to grab any URL, SSH into my Debian machine and run httrack and ebook-convert, and calibre-smtp to send it. Sometimes the Kindle app gives better results, usually this httrack method is the best, often neither works since in the grim darkness of the world wide web there is only war.

It just took me a while to think of using that approach for this as opposed to solutions trying to parse the traditional RFC format, and the results ended up good, at least for 9421.

Here’s the shortcut I’ve been using, in zshbrev:

(define (kindlepage url #!key (levels 0))
  (if (strse?* url "youtube")
    (kindletube url)
    (with-temp-dir
      (eif levels (httrack '-g url '-D (conc '-r levels)) (httrack '-g url))
      (with (conc (broodal-title (car (glob "*.html"))) '.epub)
            (ebook-convert (car (glob "*.html")) it '--max-levels levels)
            (kindlesend it)))))

(define (broodal-title (= ->string hfile))
  (strse (with-input-from-file hfile read-string)
         (: "<title>" (* space) (=> keep (* nonl)) (* space) "</title>")
         (return keep)))

(define-ir-syntax*
  (with-temp-dir . body)
  `(let ((cur (current-directory)) (,(inject 'it) (mktemp '-d)))
     (change-directory ,(inject 'it))
     ,@body
     (change-directory cur)
     (delete-directory ,(inject 'it) #t)))

(And then kindlesend is just a wrapper for calibre-smtp that prefills the args with the right email addresses.)

I’ve had this set up for years but didn’t think of using it for RFCs since I was like “I’m sure someone else musta figured out a better solution for reading RFCs on e-ink many years ago” but nope.

zshbrev