[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: |
Sun, 12 Jun 2016 19:09:28 +0200 |
Dear Gavin,
Feedback below.
Le 05/06/2016 à 00:29, Gavin Smith a écrit :
> On 4 June 2016 at 22:40, Vincent Belaïche <address@hidden> wrote:
>> These two things also work:
>>
>> --8<----8<----8<----8<----8<-- begin -->8---->8---->8---->8---->8----
>> in_input_funnies=`echo "$in_input" \
>> | $SED -e 's![^}#$%&^_{~]!!g; s!\(.\)!\1\'"
>> "'!g' \
>> | uniq`
>> --8<----8<----8<----8<----8<-- end -->8---->8---->8---->8---->8----
>>
>> --8<----8<----8<----8<----8<-- begin -->8---->8---->8---->8---->8----
>> in_input_funnies=`echo "$in_input" \
>> | $SED -e 's![^}#$%&^_{~]!!g; s!\(.\)!\1\''
>> ''!g' \
>> | uniq`
>> --8<----8<----8<----8<----8<-- end -->8---->8---->8---->8---->8----
>>
>> but I prefer the one with "$newline" to keep the sed command on the same
>> line.
>
> Nice idea to hide it in a variable.
>
> I'd come up with
>
> in_input_funnies=`echo "$in_input" \
> | $SED -e 's![^}#$%&^_{~]!!g; s!\(.\)!\1'\\\\'
> ''!g' \
> | uniq`
>
> which is fairly similar to the two examples above you gave, except
> it's less clear. (Four backslashes because backslash escaped once for
> the shell, and once for the ``-expression.)
Even simpler is the following:
--8<----8<----8<----8<----8<-- begin -->8---->8---->8---->8---->8----
in_input_funnies=`echo "$in_input" \
| $SED -e 's![^}#$%&^_{~]!!g' -e 's!\(.\)!\1\''
!g' | uniq`
--8<----8<----8<----8<----8<-- end -->8---->8---->8---->8---->8----
The trick is simply to add a tailing '' just before the newline, this
does not change the content of the argument passed to sed, but prevents
sh from seeing the sequence \NEWLINE.
Anyway, I had to make another fix: you need to have the filename as an
argument of its own, otherwise MSYS can't do its path name conversion
ticks. After all, the whole thing about catcoding rather than explicit
ecaping (ie replacing for instance '~' by '\string~') is to keep the
filename unchanged.
Attached is a patch with the two changes:
- the passing \NEWLINE to sed stuff
- making input filename an argument of its own.
VBR,
Vincent.
Index: texi2dvi
===================================================================
--- texi2dvi (revision 7219)
+++ texi2dvi (working copy)
@@ -918,12 +918,6 @@
fi
}
-list_funnies ()
-{
- echo "$in_input" \
- | $SED -e 's![^}#$%&^_{~]!!g' -e 's!\(.\)!\1\
-!g' | uniq
-}
# run_tex - Run TeX as "$tex $in_input", taking care of errors and logs.
run_tex ()
@@ -933,7 +927,9 @@
# Check for any unusual characters in the filename.
# However, >, \ and any whitespace characters are not supported
# filenames.
- in_input_funnies=`list_funnies`
+ in_input_funnies=`echo "$in_input" \
+ | $SED -e 's![^}#$%&^_{~]!!g' -e 's!\(.\)!\1\''
+!g' | uniq`
if test -n "$in_input_funnies" ; then
# Make > an end group character, as it's unlikely to appear in
@@ -948,8 +944,7 @@
done
# Set \toks0 to "\input FILENAME\relax"
- tex_cmd="$tex_cmd'${escape}toks0${escape}bgroup"
- tex_cmd="$tex_cmd${escape}input $in_input${escape}relax>"
+ tex_cmd="$tex_cmd '${escape}toks0${escape}bgroup${escape}input'
'$in_input' '${escape}relax>"
# Expand \toks0 after the end of the group
tex_cmd="$tex_cmd${escape}expandafter${escape}egroup"
- Re: Fwd: REVIEW REQUEST - user manual generation, (continued)
- Re: Fwd: REVIEW REQUEST - user manual generation, Andreas Schwab, 2016/06/03
- Re: Fwd: REVIEW REQUEST - user manual generation, Gavin Smith, 2016/06/03
- Re: Fwd: REVIEW REQUEST - user manual generation, Karl Berry, 2016/06/03
- Re: Fwd: REVIEW REQUEST - user manual generation, Vincent Belaïche, 2016/06/04
- Re: Fwd: REVIEW REQUEST - user manual generation, Gavin Smith, 2016/06/04
- Re: Fwd: REVIEW REQUEST - user manual generation, Vincent Belaïche, 2016/06/03
- Re: Fwd: REVIEW REQUEST - user manual generation, Vincent Belaïche, 2016/06/04
- Re: Fwd: REVIEW REQUEST - user manual generation, Vincent Belaïche, 2016/06/04
- Re: Fwd: REVIEW REQUEST - user manual generation, Gavin Smith, 2016/06/04
- Re: Fwd: REVIEW REQUEST - user manual generation, Vincent Belaïche, 2016/06/06
- Re: Fwd: REVIEW REQUEST - user manual generation,
Vincent Belaïche <=
- Re: Fwd: REVIEW REQUEST - user manual generation, Gavin Smith, 2016/06/13