Thread: PostgreSQL docs in ePub format

PostgreSQL docs in ePub format

From
Edward Hooper
Date:
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

Re: PostgreSQL docs in ePub format

From
Alvaro Herrera
Date:
Edward Hooper escribió:

> 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.

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


Re: PostgreSQL docs in ePub format

From
Peter Eisentraut
Date:
On 1/9/13 2:13 PM, Edward Hooper wrote:
> 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.

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



Re: PostgreSQL docs in ePub format

From
Bruce Momjian
Date:
On Wed, Jan  9, 2013 at 04:59:17PM -0500, Peter Eisentraut wrote:
> On 1/9/13 2:13 PM, Edward Hooper wrote:
> > 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.
>
> 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

Should this be in the SGML docs?

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

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


Re: PostgreSQL docs in ePub format

From
Josh Kupershmidt
Date:
On Wed, Jan 9, 2013 at 3:10 PM, Bruce Momjian <bruce@momjian.us> wrote:
> On Wed, Jan  9, 2013 at 04:59:17PM -0500, Peter Eisentraut wrote:
>> On 1/9/13 2:13 PM, Edward Hooper wrote:
>> > 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.
>>
>> 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
>
> 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


Re: PostgreSQL docs in ePub format

From
Magnus Hagander
Date:
On Wed, Jan 9, 2013 at 11:10 PM, Bruce Momjian <bruce@momjian.us> wrote:
> On Wed, Jan  9, 2013 at 04:59:17PM -0500, Peter Eisentraut wrote:
>> On 1/9/13 2:13 PM, Edward Hooper wrote:
>> > 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.
>>
>> 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
>
> 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/


Re: PostgreSQL docs in ePub format

From
Peter Eisentraut
Date:
On Thu, 2013-01-10 at 11:28 +0100, Magnus Hagander wrote:
> To take that one step further, should this be distributed on the
> 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.




Re: PostgreSQL docs in ePub format

From
Magnus Hagander
Date:
On Thu, Jan 10, 2013 at 1:06 PM, Peter Eisentraut <peter_e@gmx.net> wrote:
> On Thu, 2013-01-10 at 11:28 +0100, Magnus Hagander wrote:
>> To take that one step further, should this be distributed on the
>> 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.

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?


> 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.

That would probably not hurt in either case :)

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


Re: PostgreSQL docs in ePub format

From
"Yuto HAYAMIZU"
Date:
> 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.

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

Attachment

Re: PostgreSQL docs in ePub format

From
Josh Kupershmidt
Date:
On Wed, Jan 9, 2013 at 8:28 PM, Yuto HAYAMIZU
<haya@tkl.iis.u-tokyo.ac.jp> wrote:
> 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.

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


Re: PostgreSQL docs in ePub format

From
"Yuto HAYAMIZU"
Date:
On Fri, 11 Jan 2013 10:11:24 +0900, Josh Kupershmidt <schmiddy@gmail.com>
wrote:
> 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.

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


> On Wed, Jan 9, 2013 at 8:28 PM, Yuto HAYAMIZU
> <haya@tkl.iis.u-tokyo.ac.jp> wrote:
>> 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.
>

>
> 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
>


Re: PostgreSQL docs in ePub format

From
Peter Eisentraut
Date:
On Fri, 2013-01-11 at 11:03 +0900, Yuto HAYAMIZU wrote:
> 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:

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



Re: PostgreSQL docs in ePub format

From
Julie Xu
Date:


unsubscribe

Re: PostgreSQL docs in ePub format

From
"Yuto HAYAMIZU"
Date:
On Fri, 11 Jan 2013 11:51:23 +0900, Peter Eisentraut <peter_e@gmx.net>
wrote:

> On Fri, 2013-01-11 at 11:03 +0900, Yuto HAYAMIZU wrote:
>> 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:
>
> I don't see the point of doing it that way, since the docbook-xsl
> 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.


Re: PostgreSQL docs in ePub format

From
Peter Eisentraut
Date:
On Wed, 2013-01-09 at 16:59 -0500, Peter Eisentraut wrote:
> On 1/9/13 2:13 PM, Edward Hooper wrote:
> > 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.
>
> 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

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.