From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/27628 Path: news.gmane.org!not-for-mail From: Johannes Graumann Newsgroups: gmane.comp.tex.context Subject: Re: Synonyms and XML - HOWTO? Date: Wed, 03 May 2006 16:02:36 -0700 Organization: Die Guten Message-ID: References: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1146697481 22908 80.91.229.2 (3 May 2006 23:04:41 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 3 May 2006 23:04:41 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Thu May 04 01:04:38 2006 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by ciao.gmane.org with esmtp (Exim 4.43) id 1FbQOV-0004Bt-RB for gctc-ntg-context-518@m.gmane.org; Thu, 04 May 2006 01:04:31 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 4808D127B3; Thu, 4 May 2006 01:04:31 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 05729-03; Thu, 4 May 2006 01:04:24 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id B58461278B; Thu, 4 May 2006 01:04:23 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 9C5781278B for ; Thu, 4 May 2006 01:04:20 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 07085-02 for ; Thu, 4 May 2006 01:04:16 +0200 (CEST) Original-Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by ronja.ntg.nl (Postfix) with SMTP id C06F9126F8 for ; Thu, 4 May 2006 01:04:16 +0200 (CEST) Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1FbQO9-00048i-24 for ntg-context@ntg.nl; Thu, 04 May 2006 01:04:09 +0200 Original-Received: from iluvatar.caltech.edu ([131.215.35.27]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 04 May 2006 01:04:09 +0200 Original-Received: from johannes_graumann by iluvatar.caltech.edu with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 04 May 2006 01:04:09 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-To: ntg-context@ntg.nl Original-Lines: 60 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: iluvatar.caltech.edu User-Agent: KNode/0.10.2 X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.7 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:27628 Archived-At: Rather than doing this dirtily and on the fly (as implied by the quoted code, I'd like to use synonyms in a more cleaner fashion: separate calling and definition. I have come up with the following code, but have two problems: 1) '' just gives me '[key]' after defining 'shortkeyslightly longer key'. 2) The '\XMLop{key}' should really be the result of that preceeded by a '\' to make the short version callable as a command. How to do that? Thanks for any help, Joh % setup 'synonymes' list called 'abbreviations' \definesynonyms[abbreviation][abbreviations][\infull] % give all out in the list \setupsynonyms[abbreviation][criterium=all] % calls the completelist as a 'chapter' \defineXMLargument [abbreviations] {\completelistofabbreviations} % abbreviations are defined as follows \defineXMLenvironment [abbreviation] [key=] { \defineXMLsave[short] \defineXMLsave[full] } {\expanded{\abbreviation[\XMLop{key}]{\XMLflush{short}}{\XMLflush{full}}}} % abbreviations are recalled like this (short version is the default) \defineXMLargument [abb] [key=,opt=short] { \doifelse{\XMLop{opt}}{full} {\expanded{\infull{\XMLop{key}}}} {\XMLop{key}} } Johannes Graumann wrote: > \definesynonyms[abbreviation][abbreviations][\infull] > > \defineXMLargument > [abbrev] > [short=,full=] > {\expanded{\abbreviation{\XMLop{short}}{\XMLop{full}}}} > > \defineXMLargument [abbreviations] {\completelistofabbreviations} > > \starttext > \startXMLdata > > Blabla short. > \stopXMLdata > \stoptext