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: [LyX/master] Assure correct spacing of colored items in mathed

2021-02-06 Thread Scott Kostyshak
On Sun, Aug 02, 2020 at 06:38:06PM +0200, Enrico Forestieri wrote:
> commit 7441172d4d9a26eb4824bb8bee003f457ef34f1c
> Author: Enrico Forestieri 
> Date:   Sun Aug 2 18:58:40 2020 +0200
> 
> Assure correct spacing of colored items in mathed
> 
> When coloring a non-ordinary math atom, explicitly apply its
> math class, so that to leave unchanged the spacing around it.
> Fixes #11827.
> ---

I see an assertion on master that I think started happening with this commit.

Here's the assertion:
ASSERTION false VIOLATED IN 
/home/scott/lyxbuilds/master/repo/src/mathed/MathClass.cpp:59

The assertion happens when I just open the attached file.

Can you reproduce?

Scott


mwe.23.lyx
Description: application/lyx


signature.asc
Description: PGP signature
-- 
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


Assertion failed when loading a file, returned temporary path wrong

2021-02-06 Thread Thibaut Cuvelier
Dear list,

I recently rebuilt LyX from master (roughly alpha 2), and I now get this
output when configuring LyX (actually, once configure.py has finished):

+checking list of textclasses...
done
+generating default list of packages...
done
LyX: Done!
support\filetools.cpp (521): LyX could not create temporary directory in
C:/Windows'
RunCommand: could not start child process

Moreover, when loading a file, I get an assertion error:

TextClass.cpp (94): Conversion of layout with layout2layout.py has failed.
TextClass.cpp (363): Unable to convert
D:/Thibaut/LyX/lib/layouts/article.layout to format 92
Error reading `[layouts/article.layout]'
(Check `article')
Check your installation and try Tools/Reconfigure...
Error: Could not load class

Due to some error in it, the layout file:
article
could not be loaded. A default textclass with default
layouts will be used. LyX will not be able to produce
correct output.
RunCommand: could not start child process
TextClass.cpp (94): Conversion of layout with layout2layout.py has failed.
TextClass.cpp (363): Unable to convert
D:/Thibaut/LyX/lib/layouts/article.layout to format 92
Error reading `[layouts/article.layout]'
(Check `article')
Check your installation and try Tools/Reconfigure...
RunCommand: could not start child process
TextClass.cpp (94): Conversion of layout with layout2layout.py has failed.
TextClass.cpp (363): Unable to convert
D:/Thibaut/LyX/lib/layouts/article.layout to format 92
Error reading `[layouts/article.layout]'
(Check `article')
Check your installation and try Tools/Reconfigure...
support\lassert.cpp (52): ASSERTION false VIOLATED IN
D:\Thibaut\LyX\src\LayoutFile.cpp:253
Assertion triggered in void __cdecl lyx::doAssertWithCallstack(bool) by
failing check "false" in file D:\Thibaut\LyX\src
\support\lassert.cpp:45

Process finished with exit code 3

I suspect that the root cause of this is Package::system_temp_dir() returns
C:\Windows, which is not a writeable directory (only system files belong
there).

The cause of this is that I overwrote some parameters when starting my
built LyX, so that the environment variables were no more set. This caused
the Win32 call GetTempPath to return C:\Windows, because the first
tentatives (based on environment variables) failed. See
https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-gettemppatha
for the details.

In LyX, maybe there should be an explicit check in createTmpDir
(filetools.cpp) whether the temporary directory is writeable, and have an
error box in the GUI if it is not? Currently, if someone falls into the
same trap as I did, there is no explicit error message, even though this
creates an assertion error later on and probably other failures if
assertions are disabled.
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: LyX 2.4 Alpha 2

2021-02-06 Thread Yu Jin
Am Sa., 6. Feb. 2021 um 12:20 Uhr schrieb Pavel Sanda :

> On Sat, Feb 06, 2021 at 08:36:14AM +0100, Jürgen Spitzmüller wrote:
> > Am Freitag, dem 05.02.2021 um 17:24 -0500 schrieb Richard Kimberly
> > Heck:
> > > Hi, all,
> > >
> > > I've put tarballs for Alpha 2, built from f4003593, here:
> > >
> > > http://ftp.lyx.org/ftp/pub/lyx/devel/lyx-2.4/
> > >
> > > This includes the latest epub export stuff.
> >
> > If I didn't miss it, though, these new docbook files have not been
> > added to the Makefile, so this won't work with autotools.
>
> Yes, I am working on this right now. P
>

Uploaded the Windows Installers as usual. Everything worked out perfectly,
no files missing.
-- 
Eugene
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Problems with KableExtra

2021-02-06 Thread tkpmep
I'm not sure if anyone has seen this problem, but either LyX and / or
kableExtra seems to have a bug, as I described in my StackOverflow post
(https://stackoverflow.com/questions/66039065/lyx-kableextra-problem-perhaps
-a-bug-in-column-spec). The attached minimal example generates a small table
using kableExtra with and without the use of column_spec to control column
width. If I don't use column_spec, it works just fine, but if I do use
column_spec, I get an incomprehensible error message (just look at the Stack
Overflow post), and the table goes awry. I have attached the LyX file and
the pdf output, and would be appreciative if someone can determine whether
the problem lies within LyX on kableExtra, and how it might be fixed. We
have also reached out to the kableExtra developer, but have not heard back
from him.

Apologies if this is the wrong group to post to, but it's the only one that
I'm a member of.

Thomas Philips


Kable Explorations.lyx
Description: application/lyx


Kable_Explorations.pdf
Description: Adobe PDF document
-- 
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: LyX 2.4 Alpha 2

2021-02-06 Thread Pavel Sanda
On Sat, Feb 06, 2021 at 08:36:14AM +0100, Jürgen Spitzmüller wrote:
> Am Freitag, dem 05.02.2021 um 17:24 -0500 schrieb Richard Kimberly
> Heck:
> > Hi, all,
> > 
> > I've put tarballs for Alpha 2, built from f4003593, here:
> > 
> > http://ftp.lyx.org/ftp/pub/lyx/devel/lyx-2.4/
> > 
> > This includes the latest epub export stuff.
> 
> If I didn't miss it, though, these new docbook files have not been
> added to the Makefile, so this won't work with autotools.

Yes, I am working on this right now. P
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel