How to create an EPUB ebook from RFCs

There are three steps to create an EPUB ebook from an RFC.

  1. Download the RFC tools.ietf.org. Either as HTML:

    wget -O- https://tools.ietf.org/html/rfc2328 > download/rfc2328.html

    or as plain text:

    wget -O- https://tools.ietf.org/rfc/rfc2328.txt > download/rfc2328.txt
  2. Since the HTML RFCs from https://tools.ietf.org/html/ are not directly suitable for use in an EPUB, clean up the HTML file with this script in the directory examples/rfc.

    bin/finish-htmlrfc.pl download/rfc2328.html > clean/rfc2328.html

    This HTML-RFC looks exactly as the plain text version and is only suitable for ebook readers with big screen because it does use the <pre> tag to render the text.

    The alternative is to take the plaintext RFC and convert it like this

    bin/rfc2xhtml.pl download/rfc2328.txt > clean/rfc2328.html

    This HTML-RFC is formatted using <p> tags for paragraphs and <pre> tags only for figures and tables.

  3. Make the EPUB (this works with the output of rfc2xhtml.pl).

        make-epub -publisher IETF \
                  -rights 'The Internet Society' \
    	      -creator 'John Moy' \
    	      -title RFC2328 \
    	      -tocdepth 2 \
    	      -level2 '_tag:h2' \
    	      -output rfc2328.epub \
    	      clean

Check your EPUB ebook

If you happen to have installed epubcheck you can verify the EPUB

epubcheck rfc2328.epub

If there are any problems with the HTML in the ebook, try to repair them by adjusting the script bin/finish-htmlrfc.pl.

If there are any problem with the rest of the EPUB please file a bug at rt.pan.org.