From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/64389 Path: news.gmane.org!not-for-mail From: Hans Hagen Newsgroups: gmane.comp.tex.context Subject: Re: Redefine symbols for new command \morse{.-..} Date: Fri, 10 Dec 2010 13:09:57 +0100 Message-ID: <4D021895.7070100@wxs.nl> References: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------000003040004080408090406" X-Trace: dough.gmane.org 1291983022 21451 80.91.229.12 (10 Dec 2010 12:10:22 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 10 Dec 2010 12:10:22 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Fri Dec 10 13:10:18 2010 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PR1nm-0005e3-36 for gctc-ntg-context-518@m.gmane.org; Fri, 10 Dec 2010 13:10:18 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id A69FCCA8AE; Fri, 10 Dec 2010 13:10:16 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 3fkH1vIQotet; Fri, 10 Dec 2010 13:10:13 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 84210CA82B; Fri, 10 Dec 2010 13:10:13 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 6978DCA82B for ; Fri, 10 Dec 2010 13:10:11 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id crnVa6w5eIXm for ; Fri, 10 Dec 2010 13:10:08 +0100 (CET) Original-Received: from filter3-ams.mf.surf.net (filter3-ams.mf.surf.net [192.87.102.71]) by balder.ntg.nl (Postfix) with ESMTP id 85254C9E8B for ; Fri, 10 Dec 2010 13:10:08 +0100 (CET) Original-Received: from smtp.ziggozakelijk.nl (D57D1DA2.static.ziggozakelijk.nl [213.125.29.162]) by filter3-ams.mf.surf.net (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id oBACA7Z8026406 for ; Fri, 10 Dec 2010 13:10:08 +0100 X-Default-Received-SPF: pass (skip=loggedin (res=PASS)) x-ip-name=10.100.1.100; Original-Received: from [10.100.1.100] (unverified [10.100.1.100]) by pragma-net.nl (SurgeMail 4.3g4) with ESMTP id 19203-1713362 for ; Fri, 10 Dec 2010 13:05:14 +0100 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.12) Gecko/20101027 Lightning/1.0b2 Thunderbird/3.1.6 ThunderBrowse/3.3.4 In-Reply-To: X-Authenticated-User: hagen@controller-9 X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=213.125.29.162; country=NL; region=11; city=Den Haag; latitude=52.0833; longitude=4.3000; http://maps.google.com/maps?q=52.0833,4.3000&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 0cDFoa7g4 - 81c4301bbad4 - 20101210 X-Scanned-By: CanIt (www . roaringpenguin . com) on 192.87.102.71 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.12 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 Xref: news.gmane.org gmane.comp.tex.context:64389 Archived-At: This is a multi-part message in MIME format. --------------000003040004080408090406 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 10-12-2010 11:17, Jonas Stein wrote: > \define[]\short{\dontleavehmode \blackrule[width=0.4em]\ } > \define[]\long {\dontleavehmode \blackrule[width=1.4em]\ } > \define[1] \morse {MAGIC} > > \morse{.-..} up to you to complete the tables ... after that I'll clean up the code a bit ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl ----------------------------------------------------------------- --------------000003040004080408090406 Content-Type: text/x-matlab; name="m-morse.mkiv" Content-Disposition: attachment; filename="m-morse.mkiv" Content-Transfer-Encoding: quoted-printable \startluacode moduledata.morse =3D moduledata.morse or { } local morsecodes =3D { ["A"] =3D "=C2=B7=E2=80=94", ["B"] =3D "=E2=80=94=C2=B7=C2=B7=C2=B7", ["C"] =3D "=E2=80=94=C2=B7=E2=80=94=C2=B7", ["D"] =3D "=E2=80=94=C2=B7=C2=B7", ["E"] =3D "=C2=B7", ["F"] =3D "=C2=B7=C2=B7=E2=80=94=C2=B7", ["G"] =3D "=E2=80=94=E2=80=94=C2=B7", ["H"] =3D "=C2=B7=C2=B7=C2=B7=C2=B7", ["I"] =3D "=C2=B7=C2=B7", ["J"] =3D "=C2=B7=E2=80=94=E2=80=94=E2=80=94", ["K"] =3D "=E2=80=94=C2=B7=E2=80=94", ["L"] =3D "=C2=B7=E2=80=94=C2=B7=C2=B7", ["M"] =3D "=E2=80=94=E2=80=94", ["N"] =3D "=E2=80=94=C2=B7", ["O"] =3D "=E2=80=94=E2=80=94=E2=80=94", ["P"] =3D "=C2=B7=E2=80=94=E2=80=94=C2=B7", ["Q"] =3D "=E2=80=94=E2=80=94=C2=B7=E2=80=94", ["R"] =3D "=C2=B7=E2=80=94=C2=B7", ["S"] =3D "=C2=B7=C2=B7=C2=B7", ["T"] =3D "=E2=80=94", ["U"] =3D "=C2=B7=C2=B7=E2=80=94", ["V"] =3D "=C2=B7=C2=B7=C2=B7=E2=80=94", ["W"] =3D "=C2=B7=E2=80=94=E2=80=94", ["X"] =3D "=E2=80=94=C2=B7=C2=B7=E2=80=94", ["Y"] =3D "=E2=80=94=C2=B7=E2=80=94=E2=80=94", ["Z"] =3D "=E2=80=94=E2=80=94=C2=B7=C2=B7", ["0"] =3D "=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94", ["1"] =3D "=C2=B7=E2=80=94=E2=80=94=E2=80=94=E2=80=94", ["2"] =3D "=C2=B7=C2=B7=E2=80=94=E2=80=94=E2=80=94", ["3"] =3D "=C2=B7=C2=B7=C2=B7=E2=80=94=E2=80=94", ["4"] =3D "=C2=B7=C2=B7=C2=B7=C2=B7=E2=80=94", ["5"] =3D "=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7", ["6"] =3D "=E2=80=94=C2=B7=C2=B7=C2=B7=C2=B7", ["7"] =3D "=E2=80=94=E2=80=94=C2=B7=C2=B7=C2=B7", ["8"] =3D "=E2=80=94=E2=80=94=E2=80=94=C2=B7=C2=B7", ["9"] =3D "=E2=80=94=E2=80=94=E2=80=94=E2=80=94=C2=B7", ["."] =3D "=C2=B7=E2=80=94=C2=B7=E2=80=94=C2=B7=E2=80=94", [","] =3D "=E2=80=94=E2=80=94=C2=B7=C2=B7=E2=80=94=E2=80=94", ["?"] =3D "=C2=B7=C2=B7=E2=80=94=E2=80=94=C2=B7=C2=B7", ["-"] =3D "=E2=80=94=C2=B7=C2=B7=C2=B7=C2=B7=E2=80=94", ["/"] =3D "=E2=80=94=C2=B7=C2=B7=E2=80=94=C2=B7 ", [":"] =3D "=E2=80=94=E2=80=94=E2=80=94=C2=B7=C2=B7=C2=B7", ["'"] =3D "=C2=B7=E2=80=94=E2=80=94=E2=80=94=E2=80=94=C2=B7", ["-"] =3D "=E2=80=94=C2=B7=C2=B7=C2=B7=C2=B7=E2=80=94", [")"] =3D "=E2=80=94=C2=B7=E2=80=94=E2=80=94=C2=B7=E2=80=94", [";"] =3D "=E2=80=94=C2=B7=E2=80=94=C2=B7=E2=80=94 ", ["("] =3D "=E2=80=94=C2=B7=E2=80=94=E2=80=94=C2=B7", ["=3D"] =3D "=E2=80=94=C2=B7=C2=B7=C2=B7=E2=80=94", ["@"] =3D "=C2=B7=E2=80=94=E2=80=94=C2=B7=E2=80=94=C2=B7", } local simplecodes =3D { ["."] =3D "=C2=B7", ["-"] =3D "=E2=80=94", } function moduledata.morse.tomorse(str,translate) if translate then str =3D utf.gsub(string.upper(str),".",morsecodes) else str =3D utf.gsub(str,".",simplecodes) end context.ignorespaces() for s in string.utfcharacters(str) do if s =3D=3D "=C2=B7" then context.MorseShort() elseif s =3D=3D "=E2=80=94" then context.MorseLong() elseif s =3D=3D "\n" or s =3D=3D " " then context.MorseSpace() else context.MorseUnknown(s) end end context.removeunwantedspaces() end function moduledata.morse.filetomorse(name,translate) moduledata.morse.tomorse(resolvers.loadtexfile(name),translate) end \stopluacode \unprotect \def\MorseShort {\dontleavehmode\blackrule[\c!width=3D0.4em]\space} \def\MorseLong {\dontleavehmode\blackrule[\c!width=3D1.4em]\space} \def\MorseSpace {\emspace} \def\MorseUnknown#1{\emspace} \def\MorseCode #1{\ctxlua{moduledata.morse.tomorse("#1")}} \def\Morse #1{\ctxlua{moduledata.morse.tomorse("#1",true)}} \def\MorseFile #1{\ctxlua{moduledata.morse.filetomorse("#1",true)}} \unprotect \starttext \MorseCode{.-..} \Morse{CONTEXT} \MorseFile{tufte} \stoptext --------------000003040004080408090406 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ --------------000003040004080408090406--