bug-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fwd: REVIEW REQUEST - user manual generation


From: Vincent Belaïche
Subject: Re: Fwd: REVIEW REQUEST - user manual generation
Date: Fri, 03 Jun 2016 13:51:47 +0200

Hello Gavin,

Le 01/06/2016 à 22:40, Gavin Smith a écrit :
> On 10 May 2016 at 10:13, Vincent Belaïche <address@hidden> wrote:
>> Hello Gavin,
>>
>> Answering to myself: I had been a bit too hasty, patch #7 sent
>> preivously was working properly, but the naming of variable
>> _run_tex_in_input_funnies was not corresponding any longer to its
>> content, so I have slightly modified the code for it to have the same
>> meaning as before (as in patch #6).
>
> I've committed something along these lines, but much simpler: notably,
>> is always used as an end-group character, because it's simpler, and
> also the shell feature to extract substrings from a variable isn't
> portable, I think.

Extracting substring could be easilly done with a sed one-liner (not
tested):

--8<----8<----8<----8<----8<-- begin -->8---->8---->8---->8---->8----
mystring=%37
my_string_head=`echo $mystring | $SED -e 's!^\(.\).*!\1!1'`
my_string_tail=`echo $mystring | $SED -e 's!^.\(.*\)!\1!1'`
--8<----8<----8<----8<----8<--  end  -->8---->8---->8---->8---->8----

It seemed safer to me to use the character code rather than the
character x itself with the `\x construct, that is why I had this
substring stuff. I can't remember exactly now why I had done that, I
think that initially I had considered space as one of the potential
funnies, and doing

--8<----8<----8<----8<----8<-- begin -->8---->8---->8---->8---->8----
    for w in $in_input_funnies ; do
--8<----8<----8<----8<----8<--  end  -->8---->8---->8---->8---->8----

was not working if space is one of the member of $in_input_funnies ---
well, you would need to play with the IFS for it to work, that might
have been a better solution than this substringing stuff.

Anyway, current tex engines do not accept space, even with recatcoding
it to 12. So including space into the funnies would be only to be
futureproof wrt non existing tex engines...

I tested your correction and it did not work:
 
--8<----8<----8<----8<----8<-- begin -->8---->8---->8---->8---->8----
$ texi2dvi -V 'toto$#{}~_^&^^20.texi'
/bin/texi2dvi: Processing toto$#{}~_^&^^20.texi ...
/bin/texi2dvi: Checking TeX \openout in log support...
/bin/texi2dvi: /bin/texi2dvi: running etex </dev/null '\nonstopmode' '\input' 
./openout.tex ...
/bin/texi2dvi: Checking TeX \openout in log support... no
/bin/texi2dvi: Checking TeX recorder support...
/bin/texi2dvi: /bin/texi2dvi: running etex -recorder </dev/null '\nonstopmode' 
'\input' ./openout.tex ...
/bin/texi2dvi: Checking TeX recorder support... yes
/bin/texi2dvi: BIBINPUTS='/tmp/efrench/with space:/tmp/efrench/with space/.:'
/bin/texi2dvi: BSTINPUTS='/tmp/efrench/with space:/tmp/efrench/with space/.:'
/bin/texi2dvi: DVIPSHEADERS='/tmp/efrench/with space:/tmp/efrench/with space/.:'
/bin/texi2dvi: INDEXSTYLE='/tmp/efrench/with space:/tmp/efrench/with space/.:'
/bin/texi2dvi: MFINPUTS='/tmp/efrench/with space:/tmp/efrench/with space/.:'
/bin/texi2dvi: MPINPUTS='/tmp/efrench/with space:/tmp/efrench/with space/.:'
/bin/texi2dvi: TEXINPUTS='/tmp/efrench/with space:/tmp/efrench/with space/.:'
/bin/texi2dvi: TFMFONTS='/tmp/efrench/with space:/tmp/efrench/with space/.:'
/bin/texi2dvi: texinfo.tex preloaded as `', version is `20160323' ...
/bin/texi2dvi: Backing up xref files: toto$#{}~_^&^^20.toc
toto$#{}~_^&^^20.aux
toto$#{}~_^&^^20.cp
/bin/texi2dvi: Cycle 1 for ./toto$#{}~_^&^^20.texi
/bin/texi2dvi: /bin/texi2dvi: Running etex -recorder 
'\bgroup\catcode62=2\relax' 
'\catcode`\$n#n{n}n~n_n^n&n^n^n=12\relax''\toks0\bgroup\input 
./toto$#{}~_^&^^20.texi\relax>\expandafter\egroup\the\toks0\relax' ...
This is pdfTeX, Version 3.14159265-2.6-1.40.16 (MiKTeX 2.9 64-bit)
entering extended mode
! Missing number, treated as zero.
<to be read again> 
                   n
<*> \bgroup\catcode62=2\relax \catcode`\$n
                                          #n{n}n~n_n^n&n^n^n=12\relax\toks0\...

--8<----8<----8<----8<----8<--  end  -->8---->8---->8---->8---->8----


The problem is that my MSYS sed was version 3.02, and it did not
recognise \n in the replacement string when you want to make each funny
character on one line. I made some test with my git bash --- which has
sed version 4.2.1 --- and recognising \n is OK

Ok, one sh only solution would be to do this :

--8<----8<----8<----8<----8<-- begin -->8---->8---->8---->8---->8----
  in_input_funnies=`echo "$in_input" \
    | $SED -e 's![^}#$%&^_{~]!!g' \
    | { while IFS= read -r -n1 -d '' c; do printf '%s\n' "$c"; done } \
    | uniq`
--8<----8<----8<----8<----8<--  end  -->8---->8---->8---->8---->8----

Hopefully this is portable code ;-) ...

Another solution would be to make some test like this

--8<----8<----8<----8<----8<-- begin -->8---->8---->8---->8---->8----
if test `echo ab | $SED -e 's!\(.\)!\1\n!g'` == 'anbn'; then
  echo "SED it too old, please update"
  exit -1
fi
--8<----8<----8<----8<----8<--  end  -->8---->8---->8---->8---->8----

> I don't think it matters that > isn't supported in
> filenames.

Anyway, I agree that forbidding > in filenames is OK (it is forbidden
under MSW, and one is supposed to write portable TeX code, so not to use
it anyway). You were the one who suggested to seek an unused character,
that is why I did it so.

>
> Extract from output of:
>
>  ../texi2dvi toto\$#\{\}~_\^%\&\^\^20.texi -V
>
> follows:
>
> ../texi2dvi: Backing up xref files: toto$#{}~_^%&^^20.toc
> toto$#{}~_^%&^^20.cp
> ../texi2dvi: Cycle 1 for ./toto$#{}~_^%&^^20.texi
> ../texi2dvi: ../texi2dvi: Running etex --file-line-error
> '\bgroup\catcode62=2\relax' '\catcode`\$=12\relax'
> '\catcode`\#=12\relax' '\catcode`\{=12\relax' '\catcode`\}=12\relax'
> '\catcode`\~=12\relax' '\catcode`\_=12\relax' '\catcode`\^=12\relax'
> '\catcode`\%=12\relax' '\catcode`\&=12\relax'
> '\catcode`\^=12\relax''\toks0\bgroup\input
> ./toto$#{}~_^%&^^20.texi\relax>\expandafter\egroup\the\toks0\relax'
> ...

VBR,
        Vincent.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]