[tex4ht] [bug #486] Strange error with minted

2020-10-17 Thread Michal Hoftich
Follow-up Comment #4, bug #486 (project tex4ht):

Ok, so I've introduced a new configuration for early package patches. As
testing for file existence is too slow, it will need to be declared in
usepackage.4ht. So it isn't as flexible as the way I tried with the
-sty-hooks.4ht file, but it is  faster and easier to write than
the old way. 

To introduce the early package hooks, you can now write the following code in
tex4ht-4ht.tex:

\<<<
\Configure{PackageHooks}{packagename.sty}{packagename-hooks.4ht}
>>>

\<<<
% code that fixes the package loading
>>> \AddFile{9}{packagename-hooks}


___

Reply to this item at:

  

___
  Message sent via/by Puszcza
  http://puszcza.gnu.org.ua/



[tex4ht] [bug #486] Strange error with minted

2020-10-16 Thread Michal Hoftich
Follow-up Comment #3, bug #486 (project tex4ht):

Yes, but TeX4ht tries to include "\jobname.4ht, which comes from
"\jobname.w18" that is added to \@filelist by Catchfile. TeX4ht tries to
process the \@filelist and to load corresponding .4ht file for each file that
is specified in it. And here it happens that it removes .w18" from the
filename and tries to load "\jobname.4ht, which results in the error. 

I've found where to insert the fix. It is in tex4ht-cond4ht.tex. It contains
the code that process the files in \@filelist and that loads the .4ht files
for them. This code is reused in .4ht files for output formats (html4.4ht,
tei.4ht, ...), so it is necessary to remove all .4ht files using "make clean"
to force their rebuild.

I've also found that the new code for package fixes that I introduced earlier
slows down the package processing significantly, due the check for file
existence. I will need to fix this as well.

___

Reply to this item at:

  

___
  Message sent via/by Puszcza
  http://puszcza.gnu.org.ua/



[tex4ht] [bug #486] Strange error with minted

2020-10-14 Thread Karl Berry
Follow-up Comment #2, bug #486 (project tex4ht):

The unbalanced quote message is not coming fromtex4ht. As far as I can tell,
it comes from l3file.dtx (texmf-dist/source/latex/l3kernel), around line 2486
(at the moment):

\cs_new:Npn \__kernel_file_name_strip_quotes:nnn #1#2#3
  {
\int_if_even:nT {#2}
  {
\__kernel_msg_expandable_error:nnn
  { kernel } { unbalanced-quote-in-filename } {#1}

l3kernel is included in the LaTeX(2e).fmt files now.

By the way, even if LaTeX didn't check, the binaries would report the error
(web2c/lib/texmfmp.c, function normalize_quotes). Quotes have to be balanced
in filenames for security reasons, otherwise the quoting of special characters
(so filenames like "|`rm -rf /`" don't actually run anything) might get
defeated.


___

Reply to this item at:

  

___
  Message sent via/by Puszcza
  http://puszcza.gnu.org.ua/



Re: [tex4ht] [bug #486] Strange error with minted

2020-10-11 Thread Michal Hoftich

Dear Ulrike,


Hm. yes. I can change it in catchfile and use your fix instead. But
why are the quotes a problem? \@filelist can currently contains file
names with quotes also in other cases -- not really probable but
possible.


It would be best if we were able to support quotes in \@filelist file 
names. I just didn't find how. This is just one of TeX4ht internals that 
I still don't really understand what is going on. I even couldn't find 
the place where the error actually happens. 


Best regards,
Michal


Re: [tex4ht] [bug #486] Strange error with minted

2020-10-09 Thread Ulrike Fischer
Guten Tag, Michal Hoftich,

am Donnerstag, 8. Oktober 2020 um 21:22 schrieben Sie:

>>
>>> I've found that the issue was caused by the Catchfile package. It added 
>>> quoted
>>> file to the list of used files. I've added fix for that.
>>
>>Is there a problem in the catchfile package itself?
>>At a first glance I didn't see a place where it would add quotes.
>>

> It uses the following macro:

> \def\CatchFile@CheckFileExists#1{%
>\IfFileExists{#1}{%
>  \expandafter\CatchFile@DefFile\@filef@und\@nil
>  \begingroup\expandafter\expandafter\expandafter\endgroup
>  \expandafter\ifx\csname @addtofilelist\endcsname\relax
>  \else
>\@addtofilelist\CatchFile@File
>  \fi
>}{%
>  \let\CatchFile@File\relax
>}%
> }%

> The quotes are added in \filef@und, which is set by \IfFileExists.

Hm. yes. I can change it in catchfile and use your fix instead. But
why are the quotes a problem? \@filelist can currently contains file
names with quotes also in other cases -- not really probable but
possible.


-- 
Mit freundlichen Grüßen
Ulrike Fischer





Re: [tex4ht] [bug #486] Strange error with minted

2020-10-08 Thread Michal Hoftich



I've found that the issue was caused by the Catchfile package. It added quoted
file to the list of used files. I've added fix for that.


Is there a problem in the catchfile package itself?
At a first glance I didn't see a place where it would add quotes.



It uses the following macro:

\def\CatchFile@CheckFileExists#1{%
  \IfFileExists{#1}{%
\expandafter\CatchFile@DefFile\@filef@und\@nil
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname @addtofilelist\endcsname\relax
\else
  \@addtofilelist\CatchFile@File
\fi
  }{%
\let\CatchFile@File\relax
  }%
}%

The quotes are added in \filef@und, which is set by \IfFileExists.

Best regards,
Michal





Re: [tex4ht] [bug #486] Strange error with minted

2020-10-08 Thread Ulrike Fischer


> I've found that the issue was caused by the Catchfile package. It added quoted
> file to the list of used files. I've added fix for that.

Is there a problem in the catchfile package itself?
At a first glance I didn't see a place where it would add quotes.



-- 
Mit freundlichen Grüßen
Ulrike Fischer




[tex4ht] [bug #486] Strange error with minted

2020-10-08 Thread Michal Hoftich
Update of bug #486 (project tex4ht):

 Open/Closed:Open => Closed 

___

Follow-up Comment #1:

I've found that the issue was caused by the Catchfile package. It added quoted
file to the list of used files. I've added fix for that.

In the process, I've added a new mechanism for early package redefinitions.
Instead of usepackage.4ht, it is possible to create file
-sty-hooks.4ht. It looks like this for the Catchfile package:

% catchfile-sty-hook.4ht, generated from tex4ht-4ht.tex
% ... more copyright lines

\AddToHook{package/after/catchfile}{
  \def\CatchFile@CheckFileExists#1{%
\IfFileExists{#1}{%
  \expandafter\CatchFile@DefFile\@filef@und\@nil
  \begingroup\expandafter\expandafter\expandafter\endgroup
  \expandafter\ifx\csname @addtofilelist\endcsname\relax
  \else
  \@addtofilelist{#1}
  \fi
}{%
  \let\CatchFile@File\relax
}%
  }%
}

It uses the new LaTeX hook mechanism to insert code after the package is
processed.

___

Reply to this item at:

  

___
  Message sent via/by Puszcza
  http://puszcza.gnu.org.ua/



Re: [tex4ht] [bug #486] Strange error with minted

2020-10-07 Thread Karl Berry
>Unbalanced quotes in file name '"filename.4ht'.

Well, there is indeed an unbalanced double quote (") there. Maybe it is
something that latex just never checked for before.


Re: [tex4ht] [bug #486] Strange error with minted

2020-10-07 Thread Nasser M. Abbasi

On 10/7/2020 4:04 PM, Michal Hoftich wrote:

Details:

I've got a strange error after recent LaTeX update. TeX4ht produces errors
when the Minted package is used:

\documentclass{article}
\usepackage{minted}
\begin{document}
hello world
\end{document}

You can compile this document using:

make4ht -sm draft filename.tex

It produces the following errors:

[ERROR]   htlatex: ./tex4ht.sty 4603 Undefined control sequence.
[ERROR]   htlatex: ./tex4ht.sty 4603 Undefined control sequence.
[ERROR]   htlatex: ./tex4ht.sty 4603 Undefined control sequence.
[ERROR]   htlatex:
/usr/local/texlive/2020/texmf-dist/tex/latex/xcolor/xcolor.sty   1455
Missing number, treated as zero.
[ERROR]   htlatex:
/usr/local/texlive/2020/texmf-dist/tex/latex/xcolor/xcolor.sty   1455
LaTeX Error: Missing \begin{document} in `'.

When I compile it in the debug mode, I get some more info:

 LaTeX3 error:
   Unbalanced quotes in file name '"filename.4ht'.

I guess that it is somehow related to the LaTeX kernel update :(




Yes. I did not update TL yet. your latex file compiled ok on my end:

make4ht --shell-escape -a debug foo4.tex

No errors.

make4ht -v
make4ht version v0.3e

latex -v

pdfTeX 3.14159265-2.6-1.40.21 (TeX Live 2020)
kpathsea version 6.3.2
Copyright 2020 Han The Thanh (pdfTeX) et al.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Han The Thanh (pdfTeX) et al.
Compiled with libpng 1.6.37; using libpng 1.6.37
Compiled with zlib 1.2.11; using zlib 1.2.11
Compiled with xpdf version 4.02


--Nasser


[tex4ht] [bug #486] Strange error with minted

2020-10-07 Thread Michal Hoftich
URL:
  

 Summary: Strange error with minted
 Project: tex4ht
Submitted by: michal_h21
Submitted on: Thu 08 Oct 2020 12:04:37 AM EEST
Category: None
Priority: 5 - Normal
Severity: 5 - Normal
  Status: None
 Privacy: Public
 Assigned to: None
Originator Email: 
 Open/Closed: Open
 Discussion Lock: Any

___

Details:

I've got a strange error after recent LaTeX update. TeX4ht produces errors
when the Minted package is used:

\documentclass{article}
\usepackage{minted}
\begin{document}
hello world
\end{document}

You can compile this document using:

make4ht -sm draft filename.tex

It produces the following errors:

[ERROR]   htlatex: ./tex4ht.sty 4603 Undefined control sequence.
[ERROR]   htlatex: ./tex4ht.sty 4603 Undefined control sequence.
[ERROR]   htlatex: ./tex4ht.sty 4603 Undefined control sequence.
[ERROR]   htlatex:
/usr/local/texlive/2020/texmf-dist/tex/latex/xcolor/xcolor.sty   1455
Missing number, treated as zero.
[ERROR]   htlatex:
/usr/local/texlive/2020/texmf-dist/tex/latex/xcolor/xcolor.sty   1455
LaTeX Error: Missing \begin{document} in `'.

When I compile it in the debug mode, I get some more info:

 LaTeX3 error: 
  Unbalanced quotes in file name '"filename.4ht'.

I guess that it is somehow related to the LaTeX kernel update :(





___

Reply to this item at:

  

___
  Message sent via/by Puszcza
  http://puszcza.gnu.org.ua/