Re: DocBook to ePub

2021-03-17 Thread Jean-Marc Lasgouttes

Le 17/03/2021 à 22:07, Pavel Sanda a écrit :

JMarc, could you possibly help with those two switches? (Basically just
on/off switch for installing files in b673ab0838073c.)


I added these two switches now.

This is the last touch I had in mind for epub export so I guess
we can announce epub export capability in the next release
announcement (and perhaps move to beta?).


Sorry, I missed it at the time.

JMarc

--
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: DocBook to ePub

2021-03-17 Thread Pavel Sanda
On Fri, Feb 12, 2021 at 11:52:49PM +0100, Pavel Sanda wrote:
> On Mon, Feb 08, 2021 at 08:43:08AM +0100, Pavel Sanda wrote:
> > On Sun, Feb 07, 2021 at 11:21:28PM +0100, Thibaut Cuvelier wrote:
> > > > 2. There was mention of using system xslt and saxon, but I did not see
> > > > any configure options. Am I correct? BTW: I use autotools.
> > > >
> > > I have added the possibility in the script to use non-built-in Saxon or
> > > XSLT. However, configure.py doesn't look for these: how could I check for
> > > system Saxon or XSLT in a distribution-independent manner?
> > 
> > We could add configure option --saxon-path and 
> > --docbook-xslt-stylesheets-path
> > so packagers can set non local paths.
> > I do not know how confiure interacts with pythonic part, JMarc knows most
> > about the configure stuff I believe.
> 
> I checked that both default stylesheets and xsltproc on debian work fine
> (at least with intro manual) and thus it would make sense to have configure
> option for (not) installing saxon and stylesheets.
> 
> JMarc, could you possibly help with those two switches? (Basically just
> on/off switch for installing files in b673ab0838073c.)

I added these two switches now.

This is the last touch I had in mind for epub export so I guess
we can announce epub export capability in the next release
announcement (and perhaps move to beta?).

Pavel
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: DocBook to ePub

2021-02-12 Thread Pavel Sanda
On Mon, Feb 08, 2021 at 08:43:08AM +0100, Pavel Sanda wrote:
> On Sun, Feb 07, 2021 at 11:21:28PM +0100, Thibaut Cuvelier wrote:
> > > 2. There was mention of using system xslt and saxon, but I did not see
> > > any configure options. Am I correct? BTW: I use autotools.
> > >
> > 
> > I have added the possibility in the script to use non-built-in Saxon or
> > XSLT. However, configure.py doesn't look for these: how could I check for
> > system Saxon or XSLT in a distribution-independent manner?
> 
> We could add configure option --saxon-path and --docbook-xslt-stylesheets-path
> so packagers can set non local paths.
> I do not know how confiure interacts with pythonic part, JMarc knows most
> about the configure stuff I believe.

I checked that both default stylesheets and xsltproc on debian work fine
(at least with intro manual) and thus it would make sense to have configure
option for (not) installing saxon and stylesheets.

JMarc, could you possibly help with those two switches? (Basically just
on/off switch for installing files in b673ab0838073c.)

Pavel
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: DocBook to ePub

2021-02-07 Thread Pavel Sanda
On Sun, Feb 07, 2021 at 11:21:28PM +0100, Thibaut Cuvelier wrote:
> > 2. There was mention of using system xslt and saxon, but I did not see
> > any configure options. Am I correct? BTW: I use autotools.
> >
> 
> I have added the possibility in the script to use non-built-in Saxon or
> XSLT. However, configure.py doesn't look for these: how could I check for
> system Saxon or XSLT in a distribution-independent manner?

We could add configure option --saxon-path and --docbook-xslt-stylesheets-path
so packagers can set non local paths.
I do not know how confiure interacts with pythonic part, JMarc knows most
about the configure stuff I believe.

Pavel
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: DocBook to ePub

2021-02-07 Thread Cor Blom

Op 07-02-2021 om 23:21 schreef Thibaut Cuvelier:


BibTeX doesn't play a role to generate ePub: to generate the relevant 
DocBook tags, I rely on LyX' understanding of the .bib file (which 
typically works very well); the DocBook to ePub conversion seems to 
support references too.


For which documents do you have this problem?


I tested it on one of my own documents, that includes many references 
and they showed up as question marks in the epub. I cannot tell anything 
beyond this at the moment.


Cor
--
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: DocBook to ePub

2021-02-07 Thread Thibaut Cuvelier
On Sun, 7 Feb 2021 at 21:56, Pavel Sanda  wrote:

> On Sun, Feb 07, 2021 at 08:14:29PM +0100, Thibaut Cuvelier wrote:
> > Tables should be supported (unless they contain many strange features).
> > Maybe the ePub viewer doesn't support the full norm? Which documents have
> > this problem? (If it occurs between DocBook and ePub, we can do a bug
> > report.)
>
> It was intro manual and its table 1 one looked garbled in epubreader.
> It might well be it's the epubreader fault...
>

I just tried the generated XHTML files: it's a table, but unstyled. It's
not really nice-looking, but it's "just" a CSS issue. My CSS skills are
quite limited, though…
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: DocBook to ePub

2021-02-07 Thread Thibaut Cuvelier
On Sun, 7 Feb 2021 at 14:09, Cor Blom  wrote:

> Op 29-01-2021 om 18:38 schreef Thibaut Cuvelier:
> > As promised, I started working on ePub output, building upon the new
> > DocBook output.
>
> I have build the latest git master on openSUSE and epub export is
> working fine.
>
> I have two questions:
>
> 1. Bib(la)text references are ignored. Is that not possible, or for
> later, or does it need a configuration?
>

BibTeX doesn't play a role to generate ePub: to generate the relevant
DocBook tags, I rely on LyX' understanding of the .bib file (which
typically works very well); the DocBook to ePub conversion seems to support
references too.

For which documents do you have this problem?


> 2. There was mention of using system xslt and saxon, but I did not see
> any configure options. Am I correct? BTW: I use autotools.
>

I have added the possibility in the script to use non-built-in Saxon or
XSLT. However, configure.py doesn't look for these: how could I check for
system Saxon or XSLT in a distribution-independent manner?


> Thanks for all the work,
>
> Cor
>
> (openSUSE LyX maintainer)
>
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: DocBook to ePub

2021-02-07 Thread Pavel Sanda
On Sun, Feb 07, 2021 at 08:14:29PM +0100, Thibaut Cuvelier wrote:
> Tables should be supported (unless they contain many strange features).
> Maybe the ePub viewer doesn't support the full norm? Which documents have
> this problem? (If it occurs between DocBook and ePub, we can do a bug
> report.)

It was intro manual and its table 1 one looked garbled in epubreader.
It might well be it's the epubreader fault...

Pavel
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: DocBook to ePub

2021-02-07 Thread Thibaut Cuvelier
On Sun, 7 Feb 2021 at 12:47, Stephan Witt  wrote:

> Am 07.02.2021 um 06:36 schrieb Thibaut Cuvelier :
> >
> > On Sat, 6 Feb 2021 at 15:10, Pavel Sanda  wrote:
> > On Sat, Feb 06, 2021 at 02:49:04PM +0100, Pavel Sanda wrote:
> > > Command to execute:
> > > "java" -jar
> "/home/lyx/lyx/devel/lib/scripts/../scripts/saxon6.5.5.jar" Intro.xml
> /home/lyx/lyx/devel/lib/scripts/../docbook/epub3/chunk.xsl
> base.dir=/tmp/tmpnc1DfX
> > > docbook2epub fails
> > > sh: 1: java -jar
> /home/lyx/lyx/devel/lib/scripts/../scripts/saxon6.5.5.jar Intro.xml
> /home/lyx/lyx/devel/lib/scripts/../docbook/epub3/chunk.xsl
> base.dir=/tmp/tmpnc1DfX: not found
> > > Systemcall.cpp (291): Systemcall: 'python
> "/home/lyx/lyx/devel/lib/scripts/docbook2epub.py" "java" "Intro.xml"
> "Intro.epub"' finished with exit code 1
> > > Error: Cannot convert file
> > >
> > > Not sure what went wrong, but going to terminal I do not see
> /tmp/tmpnc1DfX created.
> > > Manually creating and running the java command leads to:
> >
> > The problem is not nonexistent dir, but qoutation for command, that's
> fixed by
> > -if os.system('"' + command + '"') != 0:
> > +if os.system(command) != 0:
> >
> > Now it continues by:
> > Command to execute:
> > "java" -jar "/home/lyx/lyx/devel/lib/scripts/../scripts/saxon6.5.5.jar"
> Intro.xml /home/lyx/lyx/devel/lib/scripts/../docbook/epub3/chunk.xsl
> base.dir=/tmp/tmp31wRYV
> > Generated ePub contents.
> > Writing /tmp/tmp31wRYV/OEBPS/toc.ncx for article
> > Traceback (most recent call last):
> >   File "/home/lyx/lyx/devel/lib/scripts/docbook2epub.py", line 61, in
> 
> > for file in glob.glob(output_dir + '/**/*', recursive=True):
> > TypeError: glob() got an unexpected keyword argument 'recursive'
> > Systemcall.cpp (291): Systemcall: 'python
> "/home/lyx/lyx/devel/lib/scripts/docbook2epub.py" "java" "Intro.xml"
> "Intro.epub"' finished with exit code 1
> > Error: Cannot convert file
> >
> > I am not pythonist, so I leave an unexpected keyword argument
> 'recursive' to someone else.
> >
> > I've just pushed patches for these problems. Quotes are required in some
> edge cases on Windows, so I added a switch based on the OS (a cleaner
> solution would be to use the subprocess module, but its current API was
> added in Python 3.5). The second error is due to an older version of
> Python: I added a work-around that should work on all versions, and at
> least it still works for me.
>
> Yes, it works. I’ve pushed another change (f55efc6951) to ensure all path
> names are quoted. Otherwise it fails for path names with spaces.
>
> IMO it should work on windows too. Please check if it works for you. Thank
> you.
>

It still works on Windows.
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: DocBook to ePub

2021-02-07 Thread Thibaut Cuvelier
On Sun, 7 Feb 2021 at 10:17, Pavel Sanda  wrote:

> On Sun, Feb 07, 2021 at 06:36:17AM +0100, Thibaut Cuvelier wrote:
> > I've just pushed patches for these problems. Quotes are required in some
> > edge cases on Windows, so I added a switch based on the OS (a cleaner
> > solution would be to use the subprocess module, but its current API was
> > added in Python 3.5). The second error is due to an older version of
> > Python: I added a work-around that should work on all versions, and at
> > least it still works for me.
>
> I can confirm that epub export works now (stable debian here).
> The text and structure looks correct, tables are broken (not sure whether
> they are supposed to work at all).
>
> Good job Thibaut,
> Pavel
>

Tables should be supported (unless they contain many strange features).
Maybe the ePub viewer doesn't support the full norm? Which documents have
this problem? (If it occurs between DocBook and ePub, we can do a bug
report.)
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: DocBook to ePub

2021-02-07 Thread Stephan Witt
Am 30.01.2021 um 04:56 schrieb Thibaut Cuvelier :
> 
> On Sat, 30 Jan 2021 at 01:30, Stephan Witt  wrote:
> Am 29.01.2021 um 18:38 schrieb Thibaut Cuvelier :
> > 
> > Dear list, 
> > 
> > As promised, I started working on ePub output, building upon the new 
> > DocBook output. 
> > 
> > Here is a script that performs the complete process of taking a DocBook 
> > file and generating the ePub. It has several dependencies: 
> > 
> > - an XSLT processor:
> >   • not xsltproc (http://xmlsoft.org/xslt/xsltproc2.html): available 
> > for most Linux distributions, I guess it is available by default on macOS, 
> > must be bundled for Windows. I tried several versions for Windows, but an 
> > old bug that should have been fixed in 1.1.24 (roughly 2010) is still 
> > there: 
> >   • I/O error : No such file or directory
> >   • xsltDocumentElem: unable to save to 
> > C:/Users/Thibaut/AppData/Local/Temp/tmp6c2i6a7h/OEBPS/package.opf
> >   • Saxon 6 (available for most Linux distributions, must be bundled 
> > for Windows and macOS, requires Java). It's outdated software (circa 2005), 
> > but newer versions are not 100% backward compatible, so it is still very 
> > widely used. Other DocBook stylesheets would work on newer Saxon, but they 
> > are not as reliable as the old ones (like 
> > https://github.com/docbook/xslTNG).
> >   • not MSXML6 (Windows-only, mostly built-it, but not compatible with 
> > the DocBook stylesheets — it wrongly errors with chunking) or .Net XSLT 
> > engine (nxslt/nxslt2).
> > - the official DocBook XSLT stylesheets. Three parts are required: XHTML, 
> > XHTML5, and ePub. For now, I copied the needed parts in a patch. On some 
> > Linux distributions, this could be replaced by a version installed by the 
> > package manager (Ubuntu 20.04 has a near-up-to-date version, although the 
> > latest one has been released in 2016: 
> > https://github.com/docbook/xslt10-stylesheets/releases/tag/release%2F1.79.2;
> >  Fedora is up-to-date).
> > 
> > The integration into LyX should be complete, minus testing on Linux and 
> > others and packaging issues: the dependencies must be included for Windows 
> > and macOS, not for all Linux distros. 
> 
> On macOS 10.14 (Mojave) I have:
> 
> $ xsltproc -V
> Using libxml 20904, libxslt 10129 and libexslt 817
> xsltproc was compiled against libxml 20904, libxslt 10129 and libexslt 817
> libxslt 10129 was compiled against libxml 20904
> libexslt 817 was compiled against libxml 20904
> 
> Why not?
> 
> I was not able to make xsltproc work on Windows with these stylesheets, it 
> gave many errors when creating new files. What if you try with the following 
> docbook2epub.py script (it goes in lib/scripts)? 
> — 

Now I've tried the xsltproc based conversion (see attached patch) and AFAICS it 
works like a charm on Mac.

IMO this is a real option on Mac. The average user doesn't have java installed.

To prefer xsltproc on Mac something like the attached patch works for me.

Stephan


docbook2epub-xsltproc.patch
Description: Binary data
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: DocBook to ePub

2021-02-07 Thread Cor Blom

Op 07-02-2021 om 14:35 schreef Pavel Sanda:

On Sun, Feb 07, 2021 at 02:09:03PM +0100, Cor Blom wrote:

2. There was mention of using system xslt and saxon, but I did not see any
configure options. Am I correct? BTW: I use autotools.


Not provided yet. What package versions of saxon and docbook xslt stylesheets
are now in suse repositories?

Pavel



Docbook-xsl: 1.79.2 in both supported versions (15.2 and Tumbleweed)
saxon6: 6.5.5, also in both versions.

Cor


--
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: DocBook to ePub

2021-02-07 Thread Pavel Sanda
On Sun, Feb 07, 2021 at 02:09:03PM +0100, Cor Blom wrote:
> 2. There was mention of using system xslt and saxon, but I did not see any
> configure options. Am I correct? BTW: I use autotools.

Not provided yet. What package versions of saxon and docbook xslt stylesheets
are now in suse repositories?

Pavel
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: DocBook to ePub

2021-02-07 Thread Cor Blom

Op 29-01-2021 om 18:38 schreef Thibaut Cuvelier:
As promised, I started working on ePub output, building upon the new 
DocBook output.


I have build the latest git master on openSUSE and epub export is 
working fine.


I have two questions:

1. Bib(la)text references are ignored. Is that not possible, or for 
later, or does it need a configuration?


2. There was mention of using system xslt and saxon, but I did not see 
any configure options. Am I correct? BTW: I use autotools.


Thanks for all the work,

Cor

(openSUSE LyX maintainer)
--
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: DocBook to ePub

2021-02-07 Thread Stephan Witt
Am 07.02.2021 um 06:36 schrieb Thibaut Cuvelier :
> 
> On Sat, 6 Feb 2021 at 15:10, Pavel Sanda  wrote:
> On Sat, Feb 06, 2021 at 02:49:04PM +0100, Pavel Sanda wrote:
> > Command to execute:
> > "java" -jar "/home/lyx/lyx/devel/lib/scripts/../scripts/saxon6.5.5.jar" 
> > Intro.xml /home/lyx/lyx/devel/lib/scripts/../docbook/epub3/chunk.xsl 
> > base.dir=/tmp/tmpnc1DfX
> > docbook2epub fails
> > sh: 1: java -jar /home/lyx/lyx/devel/lib/scripts/../scripts/saxon6.5.5.jar 
> > Intro.xml /home/lyx/lyx/devel/lib/scripts/../docbook/epub3/chunk.xsl 
> > base.dir=/tmp/tmpnc1DfX: not found
> > Systemcall.cpp (291): Systemcall: 'python 
> > "/home/lyx/lyx/devel/lib/scripts/docbook2epub.py" "java" "Intro.xml" 
> > "Intro.epub"' finished with exit code 1
> > Error: Cannot convert file
> > 
> > Not sure what went wrong, but going to terminal I do not see /tmp/tmpnc1DfX 
> > created.
> > Manually creating and running the java command leads to:
> 
> The problem is not nonexistent dir, but qoutation for command, that's fixed by
> -if os.system('"' + command + '"') != 0:
> +if os.system(command) != 0:
> 
> Now it continues by:
> Command to execute:
> "java" -jar "/home/lyx/lyx/devel/lib/scripts/../scripts/saxon6.5.5.jar" 
> Intro.xml /home/lyx/lyx/devel/lib/scripts/../docbook/epub3/chunk.xsl 
> base.dir=/tmp/tmp31wRYV
> Generated ePub contents.
> Writing /tmp/tmp31wRYV/OEBPS/toc.ncx for article
> Traceback (most recent call last):
>   File "/home/lyx/lyx/devel/lib/scripts/docbook2epub.py", line 61, in 
> for file in glob.glob(output_dir + '/**/*', recursive=True):
> TypeError: glob() got an unexpected keyword argument 'recursive'
> Systemcall.cpp (291): Systemcall: 'python 
> "/home/lyx/lyx/devel/lib/scripts/docbook2epub.py" "java" "Intro.xml" 
> "Intro.epub"' finished with exit code 1
> Error: Cannot convert file
> 
> I am not pythonist, so I leave an unexpected keyword argument 'recursive' to 
> someone else. 
> 
> I've just pushed patches for these problems. Quotes are required in some edge 
> cases on Windows, so I added a switch based on the OS (a cleaner solution 
> would be to use the subprocess module, but its current API was added in 
> Python 3.5). The second error is due to an older version of Python: I added a 
> work-around that should work on all versions, and at least it still works for 
> me.

Yes, it works. I’ve pushed another change (f55efc6951) to ensure all path names 
are quoted. Otherwise it fails for path names with spaces.

IMO it should work on windows too. Please check if it works for you. Thank you.

Stephan

-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: DocBook to ePub

2021-02-07 Thread Kornel Benko
Am Sun, 7 Feb 2021 11:45:33 +0100
schrieb Kornel Benko :

> Am Sun, 7 Feb 2021 11:28:04 +0100
> schrieb Kornel Benko :
> 
> > Am Sun, 7 Feb 2021 10:16:41 +0100
> > schrieb Pavel Sanda :
> >   
> > > On Sun, Feb 07, 2021 at 06:36:17AM +0100, Thibaut Cuvelier wrote:
> > > > I've just pushed patches for these problems. Quotes are required in some
> > > > edge cases on Windows, so I added a switch based on the OS (a cleaner
> > > > solution would be to use the subprocess module, but its current API was
> > > > added in Python 3.5). The second error is due to an older version of
> > > > Python: I added a work-around that should work on all versions, and at
> > > > least it still works for me.  
> > > 
> > > I can confirm that epub export works now (stable debian here).
> > > The text and structure looks correct, tables are broken (not sure whether
> > > they are supposed to work at all).
> > > 
> > > Good job Thibaut,
> > > Pavel
> > 
> > How can we check that the resulting epub is valid?
> > E.g. should we use ctest for epub exports (like docbook5) ?
> > 
> > This could result in some additional work for you Thibaut.
> > 
> > Kornel  
> 
> I still cannot successfully export
> Attached log signalls that saxon6.5.5.jar is used from
> /usr/local/share/lyx2.4/scripts/../scripts/saxon6.5.5.jar
> but it is not installed there. OTOH, I don't need it there, because
> the installed version at /usr/share/java/saxon.jar works.
> 
> Also the docbook/epub3/chunk.xsl is not installed,
> that is cmake misses to the .xsl files. I try to correct this.
> 
>   Kornel

OK, I installed what was expected
Export is now working. (Still why have I use saxon6.5.5.jar from lyx?)

commit f7ed7f53

Kornel



pgpL5pKFEatsn.pgp
Description: Digitale Signatur von OpenPGP
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: DocBook to ePub

2021-02-07 Thread Kornel Benko
Am Sun, 7 Feb 2021 11:28:04 +0100
schrieb Kornel Benko :

> Am Sun, 7 Feb 2021 10:16:41 +0100
> schrieb Pavel Sanda :
> 
> > On Sun, Feb 07, 2021 at 06:36:17AM +0100, Thibaut Cuvelier wrote:  
> > > I've just pushed patches for these problems. Quotes are required in some
> > > edge cases on Windows, so I added a switch based on the OS (a cleaner
> > > solution would be to use the subprocess module, but its current API was
> > > added in Python 3.5). The second error is due to an older version of
> > > Python: I added a work-around that should work on all versions, and at
> > > least it still works for me.
> > 
> > I can confirm that epub export works now (stable debian here).
> > The text and structure looks correct, tables are broken (not sure whether
> > they are supposed to work at all).
> > 
> > Good job Thibaut,
> > Pavel  
> 
> How can we check that the resulting epub is valid?
> E.g. should we use ctest for epub exports (like docbook5) ?
> 
> This could result in some additional work for you Thibaut.
> 
>   Kornel

I still cannot successfully export
Attached log signalls that saxon6.5.5.jar is used from
/usr/local/share/lyx2.4/scripts/../scripts/saxon6.5.5.jar
but it is not installed there. OTOH, I don't need it there, because
the installed version at /usr/share/java/saxon.jar works.

Also the docbook/epub3/chunk.xsl is not installed,
that is cmake misses to the .xsl files. I try to correct this.

Kornel


pgpSMdyBVgjEd.pgp
Description: Digitale Signatur von OpenPGP
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: DocBook to ePub

2021-02-07 Thread Kornel Benko
Am Sun, 7 Feb 2021 10:16:41 +0100
schrieb Pavel Sanda :

> On Sun, Feb 07, 2021 at 06:36:17AM +0100, Thibaut Cuvelier wrote:
> > I've just pushed patches for these problems. Quotes are required in some
> > edge cases on Windows, so I added a switch based on the OS (a cleaner
> > solution would be to use the subprocess module, but its current API was
> > added in Python 3.5). The second error is due to an older version of
> > Python: I added a work-around that should work on all versions, and at
> > least it still works for me.  
> 
> I can confirm that epub export works now (stable debian here).
> The text and structure looks correct, tables are broken (not sure whether
> they are supposed to work at all).
> 
> Good job Thibaut,
> Pavel

How can we check that the resulting epub is valid?
E.g. should we use ctest for epub exports (like docbook5) ?

This could result in some additional work for you Thibaut.

Kornel


pgplnyZCyBihm.pgp
Description: Digitale Signatur von OpenPGP
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: DocBook to ePub

2021-02-07 Thread Pavel Sanda
On Sun, Feb 07, 2021 at 06:36:17AM +0100, Thibaut Cuvelier wrote:
> I've just pushed patches for these problems. Quotes are required in some
> edge cases on Windows, so I added a switch based on the OS (a cleaner
> solution would be to use the subprocess module, but its current API was
> added in Python 3.5). The second error is due to an older version of
> Python: I added a work-around that should work on all versions, and at
> least it still works for me.

I can confirm that epub export works now (stable debian here).
The text and structure looks correct, tables are broken (not sure whether
they are supposed to work at all).

Good job Thibaut,
Pavel
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: DocBook to ePub

2021-02-06 Thread Thibaut Cuvelier
On Sat, 6 Feb 2021 at 15:10, Pavel Sanda  wrote:

> On Sat, Feb 06, 2021 at 02:49:04PM +0100, Pavel Sanda wrote:
> > Command to execute:
> > "java" -jar "/home/lyx/lyx/devel/lib/scripts/../scripts/saxon6.5.5.jar"
> Intro.xml /home/lyx/lyx/devel/lib/scripts/../docbook/epub3/chunk.xsl
> base.dir=/tmp/tmpnc1DfX
> > docbook2epub fails
> > sh: 1: java -jar
> /home/lyx/lyx/devel/lib/scripts/../scripts/saxon6.5.5.jar Intro.xml
> /home/lyx/lyx/devel/lib/scripts/../docbook/epub3/chunk.xsl
> base.dir=/tmp/tmpnc1DfX: not found
> > Systemcall.cpp (291): Systemcall: 'python
> "/home/lyx/lyx/devel/lib/scripts/docbook2epub.py" "java" "Intro.xml"
> "Intro.epub"' finished with exit code 1
> > Error: Cannot convert file
> >
> > Not sure what went wrong, but going to terminal I do not see
> /tmp/tmpnc1DfX created.
> > Manually creating and running the java command leads to:
>
> The problem is not nonexistent dir, but qoutation for command, that's
> fixed by
> -if os.system('"' + command + '"') != 0:
> +if os.system(command) != 0:
>
> Now it continues by:
> Command to execute:
> "java" -jar "/home/lyx/lyx/devel/lib/scripts/../scripts/saxon6.5.5.jar"
> Intro.xml /home/lyx/lyx/devel/lib/scripts/../docbook/epub3/chunk.xsl
> base.dir=/tmp/tmp31wRYV
> Generated ePub contents.
> Writing /tmp/tmp31wRYV/OEBPS/toc.ncx for article
> Traceback (most recent call last):
>   File "/home/lyx/lyx/devel/lib/scripts/docbook2epub.py", line 61, in
> 
> for file in glob.glob(output_dir + '/**/*', recursive=True):
> TypeError: glob() got an unexpected keyword argument 'recursive'
> Systemcall.cpp (291): Systemcall: 'python
> "/home/lyx/lyx/devel/lib/scripts/docbook2epub.py" "java" "Intro.xml"
> "Intro.epub"' finished with exit code 1
> Error: Cannot convert file
>
> I am not pythonist, so I leave an unexpected keyword argument 'recursive'
> to someone else.
>

I've just pushed patches for these problems. Quotes are required in some
edge cases on Windows, so I added a switch based on the OS (a cleaner
solution would be to use the subprocess module, but its current API was
added in Python 3.5). The second error is due to an older version of
Python: I added a work-around that should work on all versions, and at
least it still works for me.
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: DocBook to ePub

2021-02-06 Thread Thibaut Cuvelier
On Fri, 5 Feb 2021 at 17:57, Kornel Benko  wrote:

> Am Thu, 4 Feb 2021 23:21:30 +0100
> schrieb Thibaut Cuvelier :
>
> ...
> >
> > If you want to try it outside LyX, first export the document as DocBook 5
> > (say, doc.xml); if Java is available in the PATH, run (with either
> Python 2
> > or 3, although it's only really tested with 3.8):
> >
> > python scripts/docbook2epub.py "java" "doc.xml" "doc.epub"
>
> I get here:
> Traceback (most recent call last):
>   File "/usr2/src/lyx/lyx-git/lib/scripts/docbook2epub.py", line 26, in
> 
> own_path, java_path, input, output = sys.argv
> ValueError: need more than 3 values to unpack
>
> from python 2.7.17 and also from python 3.6.9
>
> > Otherwise, you should have many more details by having a look at the
> > console, if one is attached to the LyX process.
> >
> > Mostly, there are two sources of error: either the transformation into
> HTML
> > or the ZIP-archive creation. Basically, the script is just running the
> > following three commands:
> >
> > mkdir …/tmpfolder
> > java -jar …/saxon6.5.5.jar …/doc.xml …/docbook/epub3/chunk.xsl
> > base.dir=…/tmpfolder
>
> This one works. I get
>
> Writing /fd/OEBPS/bk01-toc.xhtml for book
> Writing /fd/OEBPS/ch01.xhtml for chapter
> Writing /fd/OEBPS/pt01.xhtml for part
> Writing /fd/OEBPS/ch02.xhtml for chapter
> Writing /fd/OEBPS/pt02.xhtml for part
> Writing /fd/OEBPS/index.xhtml for book
> Writing /fd/OEBPS/docbook-epub.css for book
> Generating EPUB package files.
> Generating image list ...
> Writing /fd/OEBPS/package.opf for book
> Writing /fd/OEBPS/../META-INF/container.xml for book
> Writing /fd/OEBPS/../mimetype for book
> Generating NCX file ...
> Writing /fd/OEBPS/toc.ncx for book
> 
>
>
> > zip …/doc.epub …/tmpfolder/*
>

I've just pushed a path for this issue.

(Pavel, I'm having a look at your messages.)
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: DocBook to ePub

2021-02-06 Thread Stephan Witt
Am 06.02.2021 um 15:10 schrieb Pavel Sanda :
> 
> On Sat, Feb 06, 2021 at 02:49:04PM +0100, Pavel Sanda wrote:
>> Command to execute:
>> "java" -jar "/home/lyx/lyx/devel/lib/scripts/../scripts/saxon6.5.5.jar" 
>> Intro.xml /home/lyx/lyx/devel/lib/scripts/../docbook/epub3/chunk.xsl 
>> base.dir=/tmp/tmpnc1DfX
>> docbook2epub fails
>> sh: 1: java -jar /home/lyx/lyx/devel/lib/scripts/../scripts/saxon6.5.5.jar 
>> Intro.xml /home/lyx/lyx/devel/lib/scripts/../docbook/epub3/chunk.xsl 
>> base.dir=/tmp/tmpnc1DfX: not found
>> Systemcall.cpp (291): Systemcall: 'python 
>> "/home/lyx/lyx/devel/lib/scripts/docbook2epub.py" "java" "Intro.xml" 
>> "Intro.epub"' finished with exit code 1
>> Error: Cannot convert file
>> 
>> Not sure what went wrong, but going to terminal I do not see /tmp/tmpnc1DfX 
>> created.
>> Manually creating and running the java command leads to:
> 
> The problem is not nonexistent dir, but qoutation for command, that's fixed by
> -if os.system('"' + command + '"') != 0:
> +if os.system(command) != 0:
> 
> Now it continues by:
> Command to execute:
> "java" -jar "/home/lyx/lyx/devel/lib/scripts/../scripts/saxon6.5.5.jar" 
> Intro.xml /home/lyx/lyx/devel/lib/scripts/../docbook/epub3/chunk.xsl 
> base.dir=/tmp/tmp31wRYV
> Generated ePub contents.
> Writing /tmp/tmp31wRYV/OEBPS/toc.ncx for article
> Traceback (most recent call last):
>  File "/home/lyx/lyx/devel/lib/scripts/docbook2epub.py", line 61, in 
>for file in glob.glob(output_dir + '/**/*', recursive=True):
> TypeError: glob() got an unexpected keyword argument 'recursive'
> Systemcall.cpp (291): Systemcall: 'python 
> "/home/lyx/lyx/devel/lib/scripts/docbook2epub.py" "java" "Intro.xml" 
> "Intro.epub"' finished with exit code 1
> Error: Cannot convert file
> 
> I am not pythonist, so I leave an unexpected keyword argument 'recursive' to 
> someone else. 

Thank you Pavel for exploring the first hurdles. I’m successful with your help 
on Mac with the attached patch. This works with python 2.7.16.

Stephan


docbook2epub.patch
Description: Binary data


Intro.epub
Description: application/epub
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: DocBook to ePub

2021-02-06 Thread Pavel Sanda
On Sat, Feb 06, 2021 at 02:49:04PM +0100, Pavel Sanda wrote:
> Command to execute:
> "java" -jar "/home/lyx/lyx/devel/lib/scripts/../scripts/saxon6.5.5.jar" 
> Intro.xml /home/lyx/lyx/devel/lib/scripts/../docbook/epub3/chunk.xsl 
> base.dir=/tmp/tmpnc1DfX
> docbook2epub fails
> sh: 1: java -jar /home/lyx/lyx/devel/lib/scripts/../scripts/saxon6.5.5.jar 
> Intro.xml /home/lyx/lyx/devel/lib/scripts/../docbook/epub3/chunk.xsl 
> base.dir=/tmp/tmpnc1DfX: not found
> Systemcall.cpp (291): Systemcall: 'python 
> "/home/lyx/lyx/devel/lib/scripts/docbook2epub.py" "java" "Intro.xml" 
> "Intro.epub"' finished with exit code 1
> Error: Cannot convert file
> 
> Not sure what went wrong, but going to terminal I do not see /tmp/tmpnc1DfX 
> created.
> Manually creating and running the java command leads to:

The problem is not nonexistent dir, but qoutation for command, that's fixed by
-if os.system('"' + command + '"') != 0:
+if os.system(command) != 0:

Now it continues by:
Command to execute:
"java" -jar "/home/lyx/lyx/devel/lib/scripts/../scripts/saxon6.5.5.jar" 
Intro.xml /home/lyx/lyx/devel/lib/scripts/../docbook/epub3/chunk.xsl 
base.dir=/tmp/tmp31wRYV
Generated ePub contents.
Writing /tmp/tmp31wRYV/OEBPS/toc.ncx for article
Traceback (most recent call last):
  File "/home/lyx/lyx/devel/lib/scripts/docbook2epub.py", line 61, in 
for file in glob.glob(output_dir + '/**/*', recursive=True):
TypeError: glob() got an unexpected keyword argument 'recursive'
Systemcall.cpp (291): Systemcall: 'python 
"/home/lyx/lyx/devel/lib/scripts/docbook2epub.py" "java" "Intro.xml" 
"Intro.epub"' finished with exit code 1
Error: Cannot convert file

I am not pythonist, so I leave an unexpected keyword argument 'recursive' to 
someone else. 

Pavel

-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: DocBook to ePub

2021-02-06 Thread Pavel Sanda
On Fri, Feb 05, 2021 at 04:16:11PM +0100, Thibaut Cuvelier wrote:
> I've just pushed the relevant commits.

I tried tu run epub export on intro manual, but so far unsuccesfully:

1. docbook2epub.py is rnu with 4 parameters here (e.g.: python script_name java 
Intro.xml Intro.epub)
   Fixed by 
   -if len(sys.argv) != 3:
   +if len(sys.argv) != 4:

2. The next error:
Generating ePub:
/home/lyx/lyx/devel/lib/scripts/docbook2epub.py
Intro.xml
Intro.epub
Temporary output directory:
/tmp/tmpnc1DfX
XSLT style sheet to use:
/home/lyx/lyx/devel/lib/scripts/../docbook/epub3/chunk.xsl
Command to execute:
"java" -jar "/home/lyx/lyx/devel/lib/scripts/../scripts/saxon6.5.5.jar" 
Intro.xml /home/lyx/lyx/devel/lib/scripts/../docbook/epub3/chunk.xsl 
base.dir=/tmp/tmpnc1DfX
docbook2epub fails
sh: 1: java -jar /home/lyx/lyx/devel/lib/scripts/../scripts/saxon6.5.5.jar 
Intro.xml /home/lyx/lyx/devel/lib/scripts/../docbook/epub3/chunk.xsl 
base.dir=/tmp/tmpnc1DfX: not found
Systemcall.cpp (291): Systemcall: 'python 
"/home/lyx/lyx/devel/lib/scripts/docbook2epub.py" "java" "Intro.xml" 
"Intro.epub"' finished with exit code 1
Error: Cannot convert file

Not sure what went wrong, but going to terminal I do not see /tmp/tmpnc1DfX 
created.
Manually creating and running the java command leads to:

Writing /tmp/tmpnc1DfX/OEBPS/ar01-toc.xhtml for article
Writing /tmp/tmpnc1DfX/OEBPS/ar01s02.xhtml for section
Writing /tmp/tmpnc1DfX/OEBPS/ar01s03.xhtml for section(sec.Contrib)
Writing /tmp/tmpnc1DfX/OEBPS/index.xhtml for article
Writing /tmp/tmpnc1DfX/OEBPS/docbook-epub.css for article
Generating EPUB package files.  
Generating image list ...   
Writing /tmp/tmpnc1DfX/OEBPS/package.opf for article
Writing /tmp/tmpnc1DfX/OEBPS/../META-INF/container.xml for article
Writing /tmp/tmpnc1DfX/OEBPS/../mimetype for article
Generating NCX file ... 
Writing /tmp/tmpnc1DfX/OEBPS/toc.ncx for article


No epub is created. When I go to /tmp/tmpnc1DfX I see:
./OEBPS 
./OEBPS/index.xhtml 
./OEBPS/ar01s02.xhtml   
./OEBPS/ar01-toc.xhtml  
./OEBPS/package.opf 
./OEBPS/toc.ncx 
./OEBPS/ar01s03.xhtml
./OEBPS/docbook-epub.css
./META-INF
./META-INF/container.xml
./mimetype


Pavel
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: DocBook to ePub

2021-02-06 Thread Pavel Sanda
On Fri, Feb 05, 2021 at 04:16:11PM +0100, Thibaut Cuvelier wrote:
> > Could you add section about necessary components for epub export into
> > lib/RELEASE-NOTES?
> >
> 
> Done in a new commit. Is this good enough?

Looks good. Pavel
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: DocBook to ePub

2021-02-05 Thread Kornel Benko
Am Thu, 4 Feb 2021 23:21:30 +0100
schrieb Thibaut Cuvelier :

...
> 
> If you want to try it outside LyX, first export the document as DocBook 5
> (say, doc.xml); if Java is available in the PATH, run (with either Python 2
> or 3, although it's only really tested with 3.8):
> 
> python scripts/docbook2epub.py "java" "doc.xml" "doc.epub"

I get here:
Traceback (most recent call last):
  File "/usr2/src/lyx/lyx-git/lib/scripts/docbook2epub.py", line 26, in 
own_path, java_path, input, output = sys.argv
ValueError: need more than 3 values to unpack

from python 2.7.17 and also from python 3.6.9

> Otherwise, you should have many more details by having a look at the
> console, if one is attached to the LyX process.
> 
> Mostly, there are two sources of error: either the transformation into HTML
> or the ZIP-archive creation. Basically, the script is just running the
> following three commands:
> 
> mkdir …/tmpfolder
> java -jar …/saxon6.5.5.jar …/doc.xml …/docbook/epub3/chunk.xsl
> base.dir=…/tmpfolder

This one works. I get

Writing /fd/OEBPS/bk01-toc.xhtml for book
Writing /fd/OEBPS/ch01.xhtml for chapter
Writing /fd/OEBPS/pt01.xhtml for part
Writing /fd/OEBPS/ch02.xhtml for chapter
Writing /fd/OEBPS/pt02.xhtml for part
Writing /fd/OEBPS/index.xhtml for book
Writing /fd/OEBPS/docbook-epub.css for book
Generating EPUB package files.
Generating image list ...
Writing /fd/OEBPS/package.opf for book
Writing /fd/OEBPS/../META-INF/container.xml for book
Writing /fd/OEBPS/../mimetype for book
Generating NCX file ...
Writing /fd/OEBPS/toc.ncx for book



> zip …/doc.epub …/tmpfolder/*

Kornel


pgpfUfWYKWmz8.pgp
Description: Digitale Signatur von OpenPGP
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: DocBook to ePub

2021-02-05 Thread Thibaut Cuvelier
On Fri, 5 Feb 2021 at 12:00, Pavel Sanda  wrote:

> On Fri, Feb 05, 2021 at 12:14:45AM +0100, Thibaut Cuvelier wrote:
> > > Java dependency is sad news. Is there some bug within xsltproc which we
> > > can bump or ask devs to fix it so we don't need to stick with saxon in
> > > long term? I looked at https://gitlab.gnome.org/GNOME/libxslt/
> > > and the project seems to be reasonably alive (If I look on the correct
> > > repo).
> > >
> >
> > That's the right repo, as far as I know. I submitted a bug report:
> > https://gitlab.gnome.org/GNOME/libxslt/-/issues/49. I guess I would
> have to
> > dig deeper into xsltproc to properly debug this???
>
> Thanks, let's see how this evolves.
>
> > > > It's open for comments :)!
> > >
> > > Small technical glitches
> > > - we will need to bundle those files into our tarball so Makefile.am
> entries
> > >   are missing. (I can help with this once in master.)
> > >
> >
> > Indeed, I would like some help on this :).
>
> Please go on and commit, so we do not exchange this large patch, it seems
> generally
> fine.
>

I've just pushed the relevant commits.


> > > - we need to give instructions to packagers why we bundle the
> stylesheets
> > > and libraries (lib/RELEASE-NOTES looks as a good candidate) and make
> clear
> > > which versions are needed to work correctly.
> > >
> >
> > Saxon: either 6.5.4 or 6.5.5 (other versions are known not to work). For
> the
> > stylesheets, at least 1.76.
>
> Could you add section about necessary components for epub export into
> lib/RELEASE-NOTES?
>

Done in a new commit. Is this good enough?
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: DocBook to ePub

2021-02-05 Thread Pavel Sanda
On Fri, Feb 05, 2021 at 12:14:45AM +0100, Thibaut Cuvelier wrote:
> > Java dependency is sad news. Is there some bug within xsltproc which we
> > can bump or ask devs to fix it so we don't need to stick with saxon in
> > long term? I looked at https://gitlab.gnome.org/GNOME/libxslt/
> > and the project seems to be reasonably alive (If I look on the correct
> > repo).
> >
> 
> That's the right repo, as far as I know. I submitted a bug report:
> https://gitlab.gnome.org/GNOME/libxslt/-/issues/49. I guess I would have to
> dig deeper into xsltproc to properly debug this???

Thanks, let's see how this evolves.

> > > It's open for comments :)!
> >
> > Small technical glitches
> > - we will need to bundle those files into our tarball so Makefile.am entries
> >   are missing. (I can help with this once in master.)
> >
> 
> Indeed, I would like some help on this :).

Please go on and commit, so we do not exchange this large patch, it seems 
generally
fine.

> > - I think Saxon & stylesheets belong to 3rdparty directory
> >
> 
> I only see compile-time dependencies in that folder, while both Saxon and
> the stylesheets are run-time dependencies. It's really like /lib/tex,
> actually.

Ok.

> > - we need to give instructions to packagers why we bundle the stylesheets
> > and libraries (lib/RELEASE-NOTES looks as a good candidate) and make clear
> > which versions are needed to work correctly.
> >
> 
> Saxon: either 6.5.4 or 6.5.5 (other versions are known not to work). For the
> stylesheets, at least 1.76.

Could you add section about necessary components for epub export into 
lib/RELEASE-NOTES?

I'll try to test the actual functionality once it lands in master.
Thanks :)
Pavel
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: DocBook to ePub

2021-02-04 Thread Thibaut Cuvelier
On Sun, 31 Jan 2021 at 10:24, Stephan Witt  wrote:

> Am 30.01.2021 um 04:56 schrieb Thibaut Cuvelier :
> >
> > On Sat, 30 Jan 2021 at 01:30, Stephan Witt  wrote:
> > Am 29.01.2021 um 18:38 schrieb Thibaut Cuvelier :
> > >
> > > Dear list,
> > >
> > > As promised, I started working on ePub output, building upon the new
> DocBook output.
> > >
> > > Here is a script that performs the complete process of taking a
> DocBook file and generating the ePub. It has several dependencies:
> > >
> > > - an XSLT processor:
> > >   • not xsltproc (http://xmlsoft.org/xslt/xsltproc2.html):
> available for most Linux distributions, I guess it is available by default
> on macOS, must be bundled for Windows. I tried several versions for
> Windows, but an old bug that should have been fixed in 1.1.24 (roughly
> 2010) is still there:
> > >   • I/O error : No such file or directory
> > >   • xsltDocumentElem: unable to save to
> C:/Users/Thibaut/AppData/Local/Temp/tmp6c2i6a7h/OEBPS/package.opf
> > >   • Saxon 6 (available for most Linux distributions, must be
> bundled for Windows and macOS, requires Java). It's outdated software
> (circa 2005), but newer versions are not 100% backward compatible, so it is
> still very widely used. Other DocBook stylesheets would work on newer
> Saxon, but they are not as reliable as the old ones (like
> https://github.com/docbook/xslTNG).
> > >   • not MSXML6 (Windows-only, mostly built-it, but not compatible
> with the DocBook stylesheets — it wrongly errors with chunking) or .Net
> XSLT engine (nxslt/nxslt2).
> > > - the official DocBook XSLT stylesheets. Three parts are required:
> XHTML, XHTML5, and ePub. For now, I copied the needed parts in a patch. On
> some Linux distributions, this could be replaced by a version installed by
> the package manager (Ubuntu 20.04 has a near-up-to-date version, although
> the latest one has been released in 2016:
> https://github.com/docbook/xslt10-stylesheets/releases/tag/release%2F1.79.2;
> Fedora is up-to-date).
> > >
> > > The integration into LyX should be complete, minus testing on Linux
> and others and packaging issues: the dependencies must be included for
> Windows and macOS, not for all Linux distros.
> >
> > On macOS 10.14 (Mojave) I have:
> >
> > $ xsltproc -V
> > Using libxml 20904, libxslt 10129 and libexslt 817
> > xsltproc was compiled against libxml 20904, libxslt 10129 and libexslt
> 817
> > libxslt 10129 was compiled against libxml 20904
> > libexslt 817 was compiled against libxml 20904
> >
> > Why not?
> >
> > I was not able to make xsltproc work on Windows with these stylesheets,
> it gave many errors when creating new files. What if you try with the
> following docbook2epub.py script (it goes in lib/scripts)?
>
> I’ve applied all (?) your patches and used the LyX made of it to export to
> ePub:
>
> support/Systemcall.cpp (291): Systemcall: 'python scripts/docbook2epub.py
> "java" "Intro.xml" "Intro.epub"' finished with exit code 2
> Error: Die Datei kann nicht konvertiert werden
> 
> Bei der Ausführung von
> python $$s/scripts/docbook2epub.py "java" "Intro.xml" "Intro.epub"
> ist ein Fehler aufgetreten
>
> Can you please be more precise what to try? Ideally I can run some
> commands in terminal to diagnose the ePub export tool chain.
> I don’t like to run them from LyX at first.
>

If you want to try it outside LyX, first export the document as DocBook 5
(say, doc.xml); if Java is available in the PATH, run (with either Python 2
or 3, although it's only really tested with 3.8):

python scripts/docbook2epub.py "java" "doc.xml" "doc.epub"

Otherwise, you should have many more details by having a look at the
console, if one is attached to the LyX process.

Mostly, there are two sources of error: either the transformation into HTML
or the ZIP-archive creation. Basically, the script is just running the
following three commands:

mkdir …/tmpfolder
java -jar …/saxon6.5.5.jar …/doc.xml …/docbook/epub3/chunk.xsl
base.dir=…/tmpfolder
zip …/doc.epub …/tmpfolder/*
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: DocBook to ePub

2021-01-31 Thread Stephan Witt
Am 30.01.2021 um 04:56 schrieb Thibaut Cuvelier :
> 
> On Sat, 30 Jan 2021 at 01:30, Stephan Witt  wrote:
> Am 29.01.2021 um 18:38 schrieb Thibaut Cuvelier :
> > 
> > Dear list, 
> > 
> > As promised, I started working on ePub output, building upon the new 
> > DocBook output. 
> > 
> > Here is a script that performs the complete process of taking a DocBook 
> > file and generating the ePub. It has several dependencies: 
> > 
> > - an XSLT processor:
> >   • not xsltproc (http://xmlsoft.org/xslt/xsltproc2.html): available 
> > for most Linux distributions, I guess it is available by default on macOS, 
> > must be bundled for Windows. I tried several versions for Windows, but an 
> > old bug that should have been fixed in 1.1.24 (roughly 2010) is still 
> > there: 
> >   • I/O error : No such file or directory
> >   • xsltDocumentElem: unable to save to 
> > C:/Users/Thibaut/AppData/Local/Temp/tmp6c2i6a7h/OEBPS/package.opf
> >   • Saxon 6 (available for most Linux distributions, must be bundled 
> > for Windows and macOS, requires Java). It's outdated software (circa 2005), 
> > but newer versions are not 100% backward compatible, so it is still very 
> > widely used. Other DocBook stylesheets would work on newer Saxon, but they 
> > are not as reliable as the old ones (like 
> > https://github.com/docbook/xslTNG).
> >   • not MSXML6 (Windows-only, mostly built-it, but not compatible with 
> > the DocBook stylesheets — it wrongly errors with chunking) or .Net XSLT 
> > engine (nxslt/nxslt2).
> > - the official DocBook XSLT stylesheets. Three parts are required: XHTML, 
> > XHTML5, and ePub. For now, I copied the needed parts in a patch. On some 
> > Linux distributions, this could be replaced by a version installed by the 
> > package manager (Ubuntu 20.04 has a near-up-to-date version, although the 
> > latest one has been released in 2016: 
> > https://github.com/docbook/xslt10-stylesheets/releases/tag/release%2F1.79.2;
> >  Fedora is up-to-date).
> > 
> > The integration into LyX should be complete, minus testing on Linux and 
> > others and packaging issues: the dependencies must be included for Windows 
> > and macOS, not for all Linux distros. 
> 
> On macOS 10.14 (Mojave) I have:
> 
> $ xsltproc -V
> Using libxml 20904, libxslt 10129 and libexslt 817
> xsltproc was compiled against libxml 20904, libxslt 10129 and libexslt 817
> libxslt 10129 was compiled against libxml 20904
> libexslt 817 was compiled against libxml 20904
> 
> Why not?
> 
> I was not able to make xsltproc work on Windows with these stylesheets, it 
> gave many errors when creating new files. What if you try with the following 
> docbook2epub.py script (it goes in lib/scripts)? 

I’ve applied all (?) your patches and used the LyX made of it to export to ePub:

support/Systemcall.cpp (291): Systemcall: 'python scripts/docbook2epub.py 
"java" "Intro.xml" "Intro.epub"' finished with exit code 2
Error: Die Datei kann nicht konvertiert werden

Bei der Ausführung von
python $$s/scripts/docbook2epub.py "java" "Intro.xml" "Intro.epub"
ist ein Fehler aufgetreten

Can you please be more precise what to try? Ideally I can run some commands in 
terminal to diagnose the ePub export tool chain.
I don’t like to run them from LyX at first.

Stephan
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: DocBook to ePub

2021-01-30 Thread Pavel Sanda
On Fri, Jan 29, 2021 at 06:38:30PM +0100, Thibaut Cuvelier wrote:
> As promised, I started working on ePub output, building upon the new
> DocBook output.

Generally looks fine, thanks for the effort!

> Here is a script that performs the complete process of taking a DocBook
> file and generating the ePub. It has several dependencies:
> 
> - an XSLT processor:
> 
>- not xsltproc (http://xmlsoft.org/xslt/xsltproc2.html): available for
>most Linux distributions, I guess it is available by default on macOS, must
>be bundled for Windows. I tried several versions for Windows, but an old
>bug that should have been fixed in 1.1.24 (roughly 2010) is still there:
>- I/O error : No such file or directory
>   - xsltDocumentElem: unable to save to
>   C:/Users/Thibaut/AppData/Local/Temp/tmp6c2i6a7h/OEBPS/package.opf
>- Saxon 6 (available for most Linux distributions, must be bundled for
>Windows and macOS, requires Java). It's outdated software (circa 2005), but
>newer versions are not 100% backward compatible, so it is still very widely
>used. Other DocBook stylesheets would work on newer Saxon, but they are not
>as reliable as the old ones (like https://github.com/docbook/xslTNG).
>- not MSXML6 (Windows-only, mostly built-it, but not compatible with the
>DocBook stylesheets ??? it wrongly errors with chunking) or .Net XSLT 
> engine
>(nxslt/nxslt2).
> 
> - the official DocBook XSLT stylesheets. Three parts are required: XHTML,
> XHTML5, and ePub. For now, I copied the needed parts in a patch. On some
> Linux distributions, this could be replaced by a version installed by the
> package manager (Ubuntu 20.04 has a near-up-to-date version, although the
> latest one has been released in 2016:
> https://github.com/docbook/xslt10-stylesheets/releases/tag/release%2F1.79.2;
> Fedora is up-to-date).

Java dependency is sad news. Is there some bug within xsltproc which we
can bump or ask devs to fix it so we don't need to stick with saxon in
long term? I looked at https://gitlab.gnome.org/GNOME/libxslt/
and the project seems to be reasonably alive (If I look on the correct repo).

> (By the way, these patches have been written on top of the 14 others I just
> submitted to the list: they should apply cleanly, but that's not 100%
> guaranteed.)

As far as I could see the only point of potential conflict are few configure.py
lines of configure.py, we can easily deal with that. I still maintain that it
would be better to postpone nonessential python changes post 2.4.

> It's open for comments :)!

Small technical glitches
- we will need to bundle those files into our tarball so Makefile.am entries
  are missing. (I can help with this once in master.)
- I think Saxon & stylesheets belong to 3rdparty directory
- we need to give instructions to packagers why we bundle the stylesheets and
  libraries (lib/RELEASE-NOTES looks as a good candidate) and make clear which
  versions are needed to work correctly.

Pavel
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: DocBook to ePub

2021-01-29 Thread Thibaut Cuvelier
On Sat, 30 Jan 2021 at 01:30, Stephan Witt  wrote:

> Am 29.01.2021 um 18:38 schrieb Thibaut Cuvelier :
> >
> > Dear list,
> >
> > As promised, I started working on ePub output, building upon the new
> DocBook output.
> >
> > Here is a script that performs the complete process of taking a DocBook
> file and generating the ePub. It has several dependencies:
> >
> > - an XSLT processor:
> >   • not xsltproc (http://xmlsoft.org/xslt/xsltproc2.html):
> available for most Linux distributions, I guess it is available by default
> on macOS, must be bundled for Windows. I tried several versions for
> Windows, but an old bug that should have been fixed in 1.1.24 (roughly
> 2010) is still there:
> >   • I/O error : No such file or directory
> >   • xsltDocumentElem: unable to save to
> C:/Users/Thibaut/AppData/Local/Temp/tmp6c2i6a7h/OEBPS/package.opf
> >   • Saxon 6 (available for most Linux distributions, must be bundled
> for Windows and macOS, requires Java). It's outdated software (circa 2005),
> but newer versions are not 100% backward compatible, so it is still very
> widely used. Other DocBook stylesheets would work on newer Saxon, but they
> are not as reliable as the old ones (like
> https://github.com/docbook/xslTNG).
> >   • not MSXML6 (Windows-only, mostly built-it, but not compatible
> with the DocBook stylesheets — it wrongly errors with chunking) or .Net
> XSLT engine (nxslt/nxslt2).
> > - the official DocBook XSLT stylesheets. Three parts are required:
> XHTML, XHTML5, and ePub. For now, I copied the needed parts in a patch. On
> some Linux distributions, this could be replaced by a version installed by
> the package manager (Ubuntu 20.04 has a near-up-to-date version, although
> the latest one has been released in 2016:
> https://github.com/docbook/xslt10-stylesheets/releases/tag/release%2F1.79.2;
> Fedora is up-to-date).
> >
> > The integration into LyX should be complete, minus testing on Linux and
> others and packaging issues: the dependencies must be included for Windows
> and macOS, not for all Linux distros.
>
> On macOS 10.14 (Mojave) I have:
>
> $ xsltproc -V
> Using libxml 20904, libxslt 10129 and libexslt 817
> xsltproc was compiled against libxml 20904, libxslt 10129 and libexslt 817
> libxslt 10129 was compiled against libxml 20904
> libexslt 817 was compiled against libxml 20904
>
> Why not?
>

I was not able to make xsltproc work on Windows with these stylesheets, it
gave many errors when creating new files. What if you try with the
following docbook2epub.py script (it goes in lib/scripts)?


docbook2epub.py
Description: Binary data
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: DocBook to ePub

2021-01-29 Thread Stephan Witt
Am 29.01.2021 um 18:38 schrieb Thibaut Cuvelier :
> 
> Dear list, 
> 
> As promised, I started working on ePub output, building upon the new DocBook 
> output. 
> 
> Here is a script that performs the complete process of taking a DocBook file 
> and generating the ePub. It has several dependencies: 
> 
> - an XSLT processor:
>   • not xsltproc (http://xmlsoft.org/xslt/xsltproc2.html): available for 
> most Linux distributions, I guess it is available by default on macOS, must 
> be bundled for Windows. I tried several versions for Windows, but an old bug 
> that should have been fixed in 1.1.24 (roughly 2010) is still there: 
>   • I/O error : No such file or directory
>   • xsltDocumentElem: unable to save to 
> C:/Users/Thibaut/AppData/Local/Temp/tmp6c2i6a7h/OEBPS/package.opf
>   • Saxon 6 (available for most Linux distributions, must be bundled for 
> Windows and macOS, requires Java). It's outdated software (circa 2005), but 
> newer versions are not 100% backward compatible, so it is still very widely 
> used. Other DocBook stylesheets would work on newer Saxon, but they are not 
> as reliable as the old ones (like https://github.com/docbook/xslTNG).
>   • not MSXML6 (Windows-only, mostly built-it, but not compatible with 
> the DocBook stylesheets — it wrongly errors with chunking) or .Net XSLT 
> engine (nxslt/nxslt2).
> - the official DocBook XSLT stylesheets. Three parts are required: XHTML, 
> XHTML5, and ePub. For now, I copied the needed parts in a patch. On some 
> Linux distributions, this could be replaced by a version installed by the 
> package manager (Ubuntu 20.04 has a near-up-to-date version, although the 
> latest one has been released in 2016: 
> https://github.com/docbook/xslt10-stylesheets/releases/tag/release%2F1.79.2; 
> Fedora is up-to-date).
> 
> The integration into LyX should be complete, minus testing on Linux and 
> others and packaging issues: the dependencies must be included for Windows 
> and macOS, not for all Linux distros. 

On macOS 10.14 (Mojave) I have:

$ xsltproc -V
Using libxml 20904, libxslt 10129 and libexslt 817
xsltproc was compiled against libxml 20904, libxslt 10129 and libexslt 817
libxslt 10129 was compiled against libxml 20904
libexslt 817 was compiled against libxml 20904

Why not?

Stephan

-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel