Subject: PostgreSQL docs in ePub format

From: Edward Hooper <[email-masked]>
Date: Wed, 9 Jan 2013 11:13:17 -0800

I've noticed that the documentation for PostgreSQL comes in two formats:
HTML and PDF.  This is great if you have a full sized screen and an
internet connection.  But what if you have a device that cannot correctly
display in standard page sizes (US or A4)?

I want to make an attempt to take the DocBook/SGML text that comes with
PostgreSQL and produce an ePub file.  However, I have no experience with
this.  I would like to get together with other like minded PostgreSQL users
and produce something useful.

If anyone from O'Reilly Media is on this mailing list please let me know
how you do this, i.e. what tools you use and what commands you run to
produce the ePub books that I buy from you.

Thanks and regards,

Edward Hooper

---

From: Alvaro Herrera <[email-masked]>
Date: Wed, 9 Jan 2013 16:30:43 -0300

> produce the ePub books that I buy from you.

Would it work to just take the single-page HTML output (make
postgres.html) and run Calibre on it?  If it can do War and Peace,
surely it can produce the skinny Postgres manual as well ...  (though I
admit I don't know how many wide tables were put out by Tolstoy)

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

-- 
Sent via pgsql-docs mailing list ([email-masked])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs

---

From: Peter Eisentraut <[email-masked]>
Date: Wed, 09 Jan 2013 16:59:17 -0500

On 1/9/13 2:13 PM, Edward Hooper wrote:
> this.  I would like to get together with other like minded PostgreSQL
> users and produce something useful.

Do this:

cd doc/src/sgml/
make postgres.xml
xsltproc http://docbook.sourceforge.net/release/xsl/current/epub/docbook.xsl postgres.xml
echo 'application/epub+zip' > mimetype
zip -r postgres.epub META-INF OEBPS mimetype

---

From: Bruce Momjian <[email-masked]>
Date: Wed, 9 Jan 2013 17:10:56 -0500

> zip -r postgres.epub META-INF OEBPS mimetype

Should this be in the SGML docs?

-- 
  Bruce Momjian  <[email-masked]>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +

---

From: "Yuto HAYAMIZU" <[email-masked]>
Date: Thu, 10 Jan 2013 12:28:52 +0900

> and produce something useful.

I created a patch for making ePub document and post it to this ML about 3  
month ago, but no response :(
So post again. I'm glad if it helps you.

Yuto HAYAMIZU

---

From: Josh Kupershmidt <[email-masked]>
Date: Wed, 9 Jan 2013 22:09:02 -0700

> Should this be in the SGML docs?

Note, this trick didn't work so cleanly on my Debian lenny machine,
which complained:

warning: failed to load external entity
"http://docbook.sourceforge.net/release/xsl/current/epub/docbook.xsl"
cannot parse http://docbook.sourceforge.net/release/xsl/current/epub/docbook.xsl

I eventually was able to build the .epub by using wget to mirror the
chunks of http://docbook.sourceforge.net/... which I needed.

Josh

---

From: Magnus Hagander <[email-masked]>
Date: Thu, 10 Jan 2013 11:28:35 +0100

> Should this be in the SGML docs?

To take that one step further, should this be distributed on the
website alongside the PDFs?

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/

---

From: Peter Eisentraut <[email-masked]>
Date: Thu, 10 Jan 2013 07:06:09 -0500

> website alongside the PDFs?

Well, maybe someone should take a look at the result first.  A quick
glance revealed that almost all reasonably sized examples run off the
page horizontally, so you're not going to get much value out of reading
it this way.

Since there is CSS behind the scenes, I imagine you can perhaps try to
tweak line-wrapping modes or something.  But in any case, some detail
work is probably necessary before this is ready to use.

---

From: Magnus Hagander <[email-masked]>
Date: Thu, 10 Jan 2013 14:53:28 +0100

> page horizontally, so you're not going to get much value out of reading

I took a quick look, and it looked fine - but I didn't actually look
at anything containing a code sample.

It might also be depending on the reader. I did specifically look at
things like our examples around setting up archive scripts, and they
linebreak properly instead of running off the page horizontally...

Do you have a specific example that looked bad for you, so I can
compare it on my reader?

> work is probably necessary before this is ready to use.

That would probably not hurt in either case :)

---

From: Josh Kupershmidt <[email-masked]>
Date: Thu, 10 Jan 2013 18:11:24 -0700

> So post again. I'm glad if it helps you.

I don't see a previous posting of that patch in my email client or in
the archives, so perhaps your original message got lost. Was there any
more information about the patch (e.g. where the stylesheet-epub.xsl
came from) you could post? Also, there is a spurious whitespace change
in ./doc/src/sgml/Makefile introduced by the patch.

When I try your patch on my Debian lenny machine, I get:

  $ make postgres.epub
  xsltproc --stringparam pg.version '9.3devel' stylesheet-epub.xsl postgres.xml
  runtime error: file stylesheet-epub.xsl line 96 element choose
  Variable 'exsl.node.set.available' has not been declared.
  make: *** [postgres.epub] Error 10

FYI, I'm using xsltproc dpkg version 1.1.24-2, here is some more version info:

  $ xsltproc --version
  Using libxml 20632, libxslt 10124 and libexslt 813
  xsltproc was compiled against libxml 20632, libxslt 10124 and libexslt 813
  libxslt 10124 was compiled against libxml 20632
  libexslt 813 was compiled against libxml 20632

Josh

---

From: "Yuto HAYAMIZU" <[email-masked]>
Date: Fri, 11 Jan 2013 11:03:50 +0900

> in ./doc/src/sgml/Makefile introduced by the patch.

I'm using xlstproc 1.1.26-7ubuntu0.1:

     $ xsltproc --version
     Using libxml 20708, libxslt 10126 and libexslt 815
     xsltproc was compiled against libxml 20708, libxslt 10126 and libexslt  
815
     libxslt 10126 was compiled against libxml 20708
     libexslt 815 was compiled against libxml 20708

stylesheet-epub.xml was copied from docbook-xsl package (version  
1.75.2+dfsg-5ubuntu1) on Ubuntu 11.10, and modified import/include lines  
like this:

@@ -16,10 +16,8 @@

    version="1.0">

-  <xsl:import href="../xhtml-1_1/docbook.xsl" />
-  <xsl:import href="../xhtml-1_1/chunk-common.xsl" />
-  <xsl:include href="../xhtml-1_1/chunk-code.xsl" />
-
+  <xsl:import  
href="http://docbook.sourceforge.net/release/xsl/current/xhtml/chunk.xsl"/>
+  <xsl:include href="stylesheet-common.xsl" />

    <!-- We want a separate TOC file, please -->
    <xsl:param name="chunk.tocs.and.lots">1</xsl:param>

The patch also worked for current head (9d5a160c) my machine, though I'm  
not sure this is the right manner.

Yuto HAYAMIZU

---

From: Peter Eisentraut <[email-masked]>
Date: Thu, 10 Jan 2013 21:51:23 -0500

On Fri, 2013-01-11 at 11:03 +0900, Yuto HAYAMIZU wrote:
> 1.75.2+dfsg-5ubuntu1) on Ubuntu 11.10, and modified import/include
> lines like this: 

I don't see the point of doing it that way, since the docbook-xsl
package already includes everything.

---

From: Julie Xu <[email-masked]>
Date: Fri, 11 Jan 2013 15:17:24 +1100

unsubscribe

---

From: "Yuto HAYAMIZU" <[email-masked]>
Date: Mon, 14 Jan 2013 17:09:47 +0900

> package already includes everything.

I was alien to docbook at that time, and followed instructions of
an online tutorial (missed URL) which said "make stylesheet in the same  
directory of XML file."
It worked and I could got an ePub file, though it might not be a right way  
for making ePub with docbook.

---

From: Peter Eisentraut <[email-masked]>
Date: Wed, 13 Feb 2013 23:15:30 -0500

> zip -r postgres.epub META-INF OEBPS mimetype

There is actually a wrapper program dbtoepub shipped with the stylesheet
distribution, which hides some of these details.

I have committed a make target (make epub) to do this (using dbtoepub)
for further investigation.