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

Re: [RFC] Slices within slices



On Fri, 14 May 1999, Stefan `Sec` Zehl wrote:

[...]
> I think
> [LANG_DE: Text [LANG_DE:more:] [LANG_EN:text_en:] :]             
> when processed with '(ALL-LANG_*)uLANG_DE:-'
> 
> Should expand to "Text more" and drop text_en.
> 
> And when processing 
> [LANG_EN: Text [LANG_DE:more:] [LANG_EN:text_en:] :]             
> with the same options
> to expand to "" (i.e. nothing)

No, the latter should expand to "more".
I'm not a computer scientist, so my explanations may be wrong.

What happens with the '(ALL-LANG_*)uLANG_DE:-' option?
First, the (ALL-LANG_*) text is computed. In our case, it expands to
an empty string (i don't consider newlines as characters).
Then you add the slice LANG_DE and it expands to "more".

What you want is (ALL-LANG_*)+(LANG_DE-(all other LANG_??)).
Unfortunately, it's not yet possible.

Solution: generate on-the-fly slice output, e.g. with pass2.

#use wml::std::lang
<lang:new id=en short>
<lang:new id=de short>

%!slice \
<foreach __i __languages>\
    <set-var __others="">\
    <foreach __j __languages>\
        <ifneq <get-var __i> <get-var __j> \
            <set-var __others=<concat <get-var __others> "-LANG_" \
                     <upcase <get-var __j>>>>>\
    </foreach>\
    -o (ALL-LANG_*)+LANG_<upcase <get-var __i>><get-var __others>:\
    $(WML_SRC_BASENAME).<get-var __i>.html \
</foreach>
[LANG_EN: Text [LANG_DE:more:] [LANG_EN:text_en:] :]
[LANG_DE: Text [LANG_DE:more:] [LANG_EN:text_en:] :]

############# End of file ####################

But it doesn't work with wml-1.6.8 or wml-SNAP.
If you're in a hurry and have a recent wml-SNAP, suppress these 5
lines in .../lib/wml/include/std/lang.wml:
 #
 #   Default value
 #
 <lang:star:slice:>
 <array-append "<__lang:slices>" __page-sys-bot>

With the next wml-SNAP (at 1800pm) this sample should work

Denis

______________________________________________________________________
Website META Language (WML)                www.engelschall.com/sw/wml/
Official Support Mailing List                   sw-wml@engelschall.com
Automated List Manager                       majordomo@engelschall.com