From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/45113 Path: news.gmane.org!not-for-mail From: Johannes Graumann Newsgroups: gmane.comp.tex.context Subject: Re: XML Date: Sun, 26 Oct 2008 15:05:27 +0100 Message-ID: References: <200810072214.52895.johannes_graumann@web.de> <115224fb0810090050x4b827f8ej9c75bcc724222a7b@mail.gmail.com> <115224fb0810140024o1b1d1365ld7604568be1e4ddd@mail.gmail.com> <115224fb0810212350m697afcf6m730992a71374de21@mail.gmail.com> <48FF9B5C.3070909@wxs.nl> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart2984182.svmdZRcrHA" X-Trace: ger.gmane.org 1225030036 7306 80.91.229.12 (26 Oct 2008 14:07:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 26 Oct 2008 14:07:16 +0000 (UTC) To: ntg-context@ntg.nl Original-X-From: ntg-context-bounces@ntg.nl Sun Oct 26 15:08:17 2008 connect(): Connection refused 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 lo.gmane.org with esmtp (Exim 4.50) id 1Ku6Hw-0008NF-J6 for gctc-ntg-context-518@m.gmane.org; Sun, 26 Oct 2008 15:08:16 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id DF6E01FC1B; Sun, 26 Oct 2008 15:07:08 +0100 (CET) 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 22603-03-2; Sun, 26 Oct 2008 15:06:13 +0100 (CET) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 43E921FB1D; Sun, 26 Oct 2008 15:06:13 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 923991FB14 for ; Sun, 26 Oct 2008 15:06:11 +0100 (CET) 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 23251-01-5 for ; Sun, 26 Oct 2008 15:05:38 +0100 (CET) Original-Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by ronja.ntg.nl (Postfix) with ESMTP id 1A0221FB1D for ; Sun, 26 Oct 2008 15:05:38 +0100 (CET) Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1Ku6FM-0004zm-Hm for ntg-context@ntg.nl; Sun, 26 Oct 2008 14:05:36 +0000 Original-Received: from e181088185.adsl.alicedsl.de ([85.181.88.185]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 26 Oct 2008 14:05:36 +0000 Original-Received: from johannes_graumann by e181088185.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 26 Oct 2008 14:05:36 +0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Followup-To: gmane.comp.tex.context Original-Lines: 63 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: e181088185.adsl.alicedsl.de User-Agent: KNode/0.99.01 X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.9 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:45113 Archived-At: --nextPart2984182.svmdZRcrHA Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit This is sending me down the right paths (at least showing me the sign post ;0) - I know I'm a pain in the neck, but the attached minimal (mirroring your proposal with the "colored" snippet fixed) compiles to to "black" "test"s ... What's wrong? Thanks, Joh Hans Hagen wrote: > \starttext > > \startluacode > document.commands = document.commands or { } > function document.commands.somehexcolor(str) > local r, g, b = str:match("#(..)(..)(..)") > r, g, b = tonumber(r,16) or 0, tonumber(g,16) or 0, > tonumber(b,16) or 0 > > tex.sprint(string.format("\\colored[r=%s,g=%s,b=%s]",r/255,g/255,b/255)) > end > \stopluacode > > \setupcolors[state=start] > > \def\WhatAMess#1{\ctxlua{document.commands.somehexcolor("#1")}} > > {test \WhatAMess{\letterhash FF3344} test} > > \stoptext > --nextPart2984182.svmdZRcrHA Content-Type: text/x-tex; name="versuch.tex" Content-Disposition: attachment; filename="versuch.tex" Content-Transfer-Encoding: quoted-printable \starttext \startluacode document.commands =3D document.commands or { } function document.commands.somehexcolor(str) local r, g, b =3D str:match("#(..)(..)(..)") r, g, b =3D tonumber(r,16) or 0, tonumber(g,16) or 0, tonumber(b= ,16) or 0 tex.sprint(string.format("\\color[r=3D%s,g=3D%s,b=3D%s]",r/255,g/255,b= /255)) end \stopluacode \setupcolors[state=3Dstart] \def\WhatAMess#1{\ctxlua{document.commands.somehexcolor("#1")}} {test \WhatAMess{\letterhash FF3344} test} \stoptext --nextPart2984182.svmdZRcrHA Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ --nextPart2984182.svmdZRcrHA--