ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* XML command synonyms
@ 2003-09-25 12:57 Pawel Jackowski na Onet
  2003-09-25 14:41 ` Willi Egger
  2003-09-25 19:13 ` Simon Pepping
  0 siblings, 2 replies; 11+ messages in thread
From: Pawel Jackowski na Onet @ 2003-09-25 12:57 UTC (permalink / raw)


Hi all!

Is there any way to define XML command synonyms? Assume that one defined

    \deifneXMLenvirnment[subsubsubsubsection]    {.......}    {.......}

How to define 'SSSS' as a synonym of 'subsubsubsubsection' without wrtiting
the same code twice?



Thanks, Pawe/l

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: XML command synonyms
  2003-09-25 12:57 XML command synonyms Pawel Jackowski na Onet
@ 2003-09-25 14:41 ` Willi Egger
  2003-09-25 15:18   ` Willi Egger
  2003-09-25 19:13 ` Simon Pepping
  1 sibling, 1 reply; 11+ messages in thread
From: Willi Egger @ 2003-09-25 14:41 UTC (permalink / raw)


Hi Pawel
>
> Is there any way to define XML command synonyms? Assume that one defined
>
>     \deifneXMLenvirnment[subsubsubsubsection]    {.......}    {.......}
>
> How to define 'SSSS' as a synonym of 'subsubsubsubsection' without
wrtiting
> the same code twice?

Though the following does not yet really work the solution must be looked
for in the following instructions to Context:

\definesection[SSSS]
\setupsection[SSSS][subsubsubsubsection]  %the section SSSS inherits the
settings of subsubsubsubsection

\definehead[Pawel][section=SSSS]

Willi

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: XML command synonyms
  2003-09-25 14:41 ` Willi Egger
@ 2003-09-25 15:18   ` Willi Egger
  0 siblings, 0 replies; 11+ messages in thread
From: Willi Egger @ 2003-09-25 15:18 UTC (permalink / raw)


Sorry, apparently I missed part of the message while thinking of a solution.

Willi
----- Original Message ----- 
From: "Willi Egger" <w.egger@boede.nl>
To: <ntg-context@ntg.nl>
Sent: Thursday, September 25, 2003 4:41 PM
Subject: Re: [NTG-context] XML command synonyms


> Hi Pawel
> >
> > Is there any way to define XML command synonyms? Assume that one defined
> >
> >     \deifneXMLenvirnment[subsubsubsubsection]    {.......}    {.......}
> >
> > How to define 'SSSS' as a synonym of 'subsubsubsubsection' without
> wrtiting
> > the same code twice?
>
> Though the following does not yet really work the solution must be looked
> for in the following instructions to Context:
>
> \definesection[SSSS]
> \setupsection[SSSS][subsubsubsubsection]  %the section SSSS inherits the
> settings of subsubsubsubsection
>
> \definehead[Pawel][section=SSSS]
>
> Willi
>
> _______________________________________________
> ntg-context mailing list
> ntg-context@ntg.nl
> http://www.ntg.nl/mailman/listinfo/ntg-context
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: XML command synonyms
  2003-09-25 12:57 XML command synonyms Pawel Jackowski na Onet
  2003-09-25 14:41 ` Willi Egger
@ 2003-09-25 19:13 ` Simon Pepping
  2003-09-27  5:41   ` Pawel Jackowski na Onet
  1 sibling, 1 reply; 11+ messages in thread
From: Simon Pepping @ 2003-09-25 19:13 UTC (permalink / raw)


On Thu, Sep 25, 2003 at 02:57:17PM +0200, Pawel Jackowski na Onet wrote:
> Hi all!
> 
> Is there any way to define XML command synonyms? Assume that one defined
> 
>     \deifneXMLenvirnment[subsubsubsubsection]    {.......}    {.......}
> 
> How to define 'SSSS' as a synonym of 'subsubsubsubsection' without wrtiting
> the same code twice?

From DocbookInContext:

%D A \type{\let} for XML environments
\def\letXMLenvironment#1#2%
  {\letvaluevalue{\@@XMLelement:#1/}{\@@XMLelement:#2/}%
   \letvaluevalue{\@@XMLelement:#1}{\@@XMLelement:#2}%
   \letvaluevalue{\@@XMLelement:/#1}{\@@XMLelement:/#2}}%

Works for XMLenvironment.

Regards, Simon

-- 
Simon Pepping
email: spepping@scaprea.hobby.nl
home page: http://scaprea.hobby.nl

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: XML command synonyms
  2003-09-25 19:13 ` Simon Pepping
@ 2003-09-27  5:41   ` Pawel Jackowski na Onet
  2003-09-27 10:18     ` Hans Hagen
  0 siblings, 1 reply; 11+ messages in thread
From: Pawel Jackowski na Onet @ 2003-09-27  5:41 UTC (permalink / raw)



From: "Simon Pepping" <spepping@scaprea.hobby.nl>

> >P: How to define 'SSSS' as a synonym of 'subsubsubsubsection' without
wrtiting
> >P:  the same code twice?
>
> From DocbookInContext:
>
> %D A \type{\let} for XML environments
> \def\letXMLenvironment#1#2%
>   {\letvaluevalue{\@@XMLelement:#1/}{\@@XMLelement:#2/}%
>    \letvaluevalue{\@@XMLelement:#1}{\@@XMLelement:#2}%
>    \letvaluevalue{\@@XMLelement:/#1}{\@@XMLelement:/#2}}%
>
> Works for XMLenvironment.
>
> Regards, Simon

Thanks a lot, but I'm afraid that doesn't work. TeX complains about
undefined control sequence:


    ConTeXt  ver: 2002.5.24  fmt: 2003.9.3  int: english  mes: english

    ....

    ! Undefined control sequence.
    \letXMLenvironment #1#2->\letvaluevalue

{\@@XMLelement:#1/}{\@@XMLelement:#2...
    l.15 \letXMLenvironment{chapter}{X}

    ?
    ! Emergency stop.
    \letXMLenvironment #1#2->\letvaluevalue

{\@@XMLelement:#1/}{\@@XMLelement:#2...
    l.15 \letXMLenvironment{chapter}{X}

    End of file on the terminal!


Is my ConTeXt to old?

Pawe/l

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: XML command synonyms
  2003-09-27  5:41   ` Pawel Jackowski na Onet
@ 2003-09-27 10:18     ` Hans Hagen
  2003-09-27 22:28       ` Pawel Jackowski na Onet
  2003-09-29 18:30       ` Simon Pepping
  0 siblings, 2 replies; 11+ messages in thread
From: Hans Hagen @ 2003-09-27 10:18 UTC (permalink / raw)


At 07:41 27/09/2003 +0200, you wrote:

>From: "Simon Pepping" <spepping@scaprea.hobby.nl>
>
> > >P: How to define 'SSSS' as a synonym of 'subsubsubsubsection' without
>wrtiting
> > >P:  the same code twice?
> >
> > From DocbookInContext:
> >
> > %D A \type{\let} for XML environments
> > \def\letXMLenvironment#1#2%
> >   {\letvaluevalue{\@@XMLelement:#1/}{\@@XMLelement:#2/}%
> >    \letvaluevalue{\@@XMLelement:#1}{\@@XMLelement:#2}%
> >    \letvaluevalue{\@@XMLelement:/#1}{\@@XMLelement:/#2}}%


      \letcsnamecsname\csname\@@XMLelement:#1\endcsname\csname\@@XMLelement:#2\endcsname

etc, but before you enter that track, what exactly do you want?

Hans
-------------------------------------------------------------------------
                                   Hans Hagen | PRAGMA ADE | pragma@wxs.nl
                       Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------
                        information: http://www.pragma-ade.com/roadmap.pdf
                     documentation: http://www.pragma-ade.com/showcase.pdf
-------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: XML command synonyms
  2003-09-27 10:18     ` Hans Hagen
@ 2003-09-27 22:28       ` Pawel Jackowski na Onet
  2003-09-29 18:30       ` Simon Pepping
  1 sibling, 0 replies; 11+ messages in thread
From: Pawel Jackowski na Onet @ 2003-09-27 22:28 UTC (permalink / raw)


Hello!

From: "Hans Hagen" <pragma@wxs.nl>


 >
\letcsnamecsname\csname\@@XMLelement:#1\endcsname\csname\@@XMLelement:#2\end
csname
>
> etc, but before you enter that track, what exactly do you want?

In example; assume that 'subsubsubsubsection' is already defined part of a
document

    \defineXMLenvironment
     [subsubsubsubsection]
     {\subsubsubsubsection}
     {\relax}

Now I would like to define some abbreviations like 'SSSS' (or 'ssss' or even
'S4') in the way that


    <SSSS> ... </SSSS>

will work as well as

    <subsubsubsubsection> ... </subsubsubsubsection>

Of course I can rewrie environment definitions for each needed abbreviation,
but it doesn't seems to be clever way...

Another simple example;

    defineXMLargument
     [center]
     {\midaligned}

How  defne 'mid' tag as a synonym of 'center' without rewriting

    defineXMLargument
     [mid]
     {\midaligned}


So the <bf>question</bf> is how to define <b>synonyms</b> for XML elements,
singular commands, entities...



Regards, Pawe/l

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: XML command synonyms
  2003-09-27 10:18     ` Hans Hagen
  2003-09-27 22:28       ` Pawel Jackowski na Onet
@ 2003-09-29 18:30       ` Simon Pepping
  2003-09-30  8:04         ` Hans Hagen
  1 sibling, 1 reply; 11+ messages in thread
From: Simon Pepping @ 2003-09-29 18:30 UTC (permalink / raw)


On Sat, Sep 27, 2003 at 12:18:21PM +0200, Hans Hagen wrote:
> At 07:41 27/09/2003 +0200, you wrote:
> 
> >From: "Simon Pepping" <spepping@scaprea.hobby.nl>
> >
> >> >P: How to define 'SSSS' as a synonym of 'subsubsubsubsection' without
> >wrtiting
> >> >P:  the same code twice?
> >>
> >> From DocbookInContext:
> >>
> >> %D A \type{\let} for XML environments
> >> \def\letXMLenvironment#1#2%
> >>   {\letvaluevalue{\@@XMLelement:#1/}{\@@XMLelement:#2/}%
> >>    \letvaluevalue{\@@XMLelement:#1}{\@@XMLelement:#2}%
> >>    \letvaluevalue{\@@XMLelement:/#1}{\@@XMLelement:/#2}}%
> 
> 
>      \letcsnamecsname\csname\@@XMLelement:#1\endcsname\csname\@@XMLelement:#2\endcsname
> 
> etc, but before you enter that track, what exactly do you want?

I use it in the same way as let, but for XML environments. For
example,

store the current value
\letXMLenvironment{origindexterm}{indexterm}%
redefine XML environment indexterm,
do some work,
restore the old value
\letXMLenvironment{indexterm}{origindexterm}}

Regards, Simon

-- 
Simon Pepping
email: spepping@scaprea.hobby.nl
home page: http://scaprea.hobby.nl

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: XML command synonyms
  2003-09-29 18:30       ` Simon Pepping
@ 2003-09-30  8:04         ` Hans Hagen
  2003-09-30 19:06           ` pushmacro Simon Pepping
  0 siblings, 1 reply; 11+ messages in thread
From: Hans Hagen @ 2003-09-30  8:04 UTC (permalink / raw)


At 20:30 29/09/2003 +0200, you wrote:
>On Sat, Sep 27, 2003 at 12:18:21PM +0200, Hans Hagen wrote:
> > At 07:41 27/09/2003 +0200, you wrote:
> >
> > >From: "Simon Pepping" <spepping@scaprea.hobby.nl>
> > >
> > >> >P: How to define 'SSSS' as a synonym of 'subsubsubsubsection' without
> > >wrtiting
> > >> >P:  the same code twice?
> > >>
> > >> From DocbookInContext:
> > >>
> > >> %D A \type{\let} for XML environments
> > >> \def\letXMLenvironment#1#2%
> > >>   {\letvaluevalue{\@@XMLelement:#1/}{\@@XMLelement:#2/}%
> > >>    \letvaluevalue{\@@XMLelement:#1}{\@@XMLelement:#2}%
> > >>    \letvaluevalue{\@@XMLelement:/#1}{\@@XMLelement:/#2}}%
> >
> >
> > 
> \letcsnamecsname\csname\@@XMLelement:#1\endcsname\csname\@@XMLelement:#2\endcsname
> >
> > etc, but before you enter that track, what exactly do you want?
>
>I use it in the same way as let, but for XML environments. For
>example,
>
>store the current value
>\letXMLenvironment{origindexterm}{indexterm}%
>redefine XML environment indexterm,
>do some work,
>restore the old value
>\letXMLenvironment{indexterm}{origindexterm}}

in that case:

\expandafter\pushmacro\csname...\endcsname
\expandafter\popmacro\csname ...\endcsname

is nicer since it works nested as well

wo maybe we should have: \pushXMLmeaning \popXMLmeaning

\def\pushXMLmeaning#1%
   {\@EA\pushmacro\csname\@@XMLelement:#1/\endcsname
    \@EA\pushmacro\csname\@@XMLelement:#1\endcsname
    \@EA\pushmacro\csname\@@XMLelement:/#1\endcsname}

\def\popXMLmeaning#1%
   {\@EA\popmacro\csname\@@XMLelement:#1/\endcsname
    \@EA\popmacro\csname\@@XMLelement:#1\endcsname
    \@EA\popmacro\csname\@@XMLelement:/#1\endcsname}

Does that suit your needs?

Hans


-------------------------------------------------------------------------
                                   Hans Hagen | PRAGMA ADE | pragma@wxs.nl
                       Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------
                        information: http://www.pragma-ade.com/roadmap.pdf
                     documentation: http://www.pragma-ade.com/showcase.pdf
-------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: pushmacro
  2003-09-30  8:04         ` Hans Hagen
@ 2003-09-30 19:06           ` Simon Pepping
  0 siblings, 0 replies; 11+ messages in thread
From: Simon Pepping @ 2003-09-30 19:06 UTC (permalink / raw)


On Tue, Sep 30, 2003 at 10:04:11AM +0200, Hans Hagen wrote:
> At 20:30 29/09/2003 +0200, you wrote:
> >I use it in the same way as let, but for XML environments. For
> >example,
> >
> >store the current value
> >\letXMLenvironment{origindexterm}{indexterm}%
> >redefine XML environment indexterm,
> >do some work,
> >restore the old value
> >\letXMLenvironment{indexterm}{origindexterm}}
> 
> in that case:
> 
> \expandafter\pushmacro\csname...\endcsname
> \expandafter\popmacro\csname ...\endcsname
> 
> is nicer since it works nested as well
> 
> wo maybe we should have: \pushXMLmeaning \popXMLmeaning
> 
> \def\pushXMLmeaning#1%
>   {\@EA\pushmacro\csname\@@XMLelement:#1/\endcsname
>    \@EA\pushmacro\csname\@@XMLelement:#1\endcsname
>    \@EA\pushmacro\csname\@@XMLelement:/#1\endcsname}
> 
> \def\popXMLmeaning#1%
>   {\@EA\popmacro\csname\@@XMLelement:#1/\endcsname
>    \@EA\popmacro\csname\@@XMLelement:#1\endcsname
>    \@EA\popmacro\csname\@@XMLelement:/#1\endcsname}
> 
> Does that suit your needs?

I have never used \pushmacro, but if I see it right, it pushes the
macro on a stack for later restore. That would suit the example I have
given. But it would not always satisfy me. For example, when I want to
use a predefined value as the new value:

store the current value
\pushXMLmeaning{indexterm}%
redefine XML environment indexterm,
  e.g. as \letXMLenvironment{indexterm}{specialindexterm}
do some work,
restore the old value
\popXMLmeaning{indexterm}

Regards, Simon

-- 
Simon Pepping
email: spepping@scaprea.hobby.nl
home page: http://scaprea.hobby.nl

^ permalink raw reply	[flat|nested] 11+ messages in thread

* XML command synonyms
@ 2003-09-30 19:47 Pawel Jackowski na Onet
  0 siblings, 0 replies; 11+ messages in thread
From: Pawel Jackowski na Onet @ 2003-09-30 19:47 UTC (permalink / raw)


Hi Hans, hi Simon!

First of all THANKS a lot for both of you for helpful hints and sugestions.
After many tests and experiments I decided to use
construction:

\def\XMLsynonym#1#2{%

\letcsnamecsname\csname\@@XMLelement:#1/\endcsname\csname\@@XMLelement:#2/\e
ndcsname

\letcsnamecsname\csname\@@XMLelement:#1\endcsname\csname\@@XMLelement:#2\end
csname

\letcsnamecsname\csname\@@XMLelement:/#1\endcsname\csname\@@XMLelement:/#2\e
ndcsname}

It works ok and suits me best since I (almost) understand HOW it works :)
Using constructions which I don't understand makes me a little bit
frustrated.
I'll do my best to understand other constructions as well.



Thanks a lot, Pawe/l

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2003-09-30 19:47 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-25 12:57 XML command synonyms Pawel Jackowski na Onet
2003-09-25 14:41 ` Willi Egger
2003-09-25 15:18   ` Willi Egger
2003-09-25 19:13 ` Simon Pepping
2003-09-27  5:41   ` Pawel Jackowski na Onet
2003-09-27 10:18     ` Hans Hagen
2003-09-27 22:28       ` Pawel Jackowski na Onet
2003-09-29 18:30       ` Simon Pepping
2003-09-30  8:04         ` Hans Hagen
2003-09-30 19:06           ` pushmacro Simon Pepping
2003-09-30 19:47 XML command synonyms Pawel Jackowski na Onet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).