From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/79175 Path: news.gmane.org!not-for-mail From: "yang.zhao" Newsgroups: gmane.comp.tex.context Subject: Re: How to display source in ConTeXt? Date: Tue, 13 Nov 2012 20:43:28 +0800 Message-ID: References: <20121113114215.285b4dc3@homerow> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1484530685==" X-Trace: ger.gmane.org 1352810623 7552 80.91.229.3 (13 Nov 2012 12:43:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 13 Nov 2012 12:43:43 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Tue Nov 13 13:43:54 2012 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TYFqJ-000145-Js for gctc-ntg-context-518@m.gmane.org; Tue, 13 Nov 2012 13:43:51 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id B50CC10255; Tue, 13 Nov 2012 13:43:41 +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 vyAUvJT7w+4a; Tue, 13 Nov 2012 13:43:38 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id 66A861022A; Tue, 13 Nov 2012 13:43:38 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 0892A1022A for ; Tue, 13 Nov 2012 13:43:37 +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 6XXDyo25R0oP for ; Tue, 13 Nov 2012 13:43:31 +0100 (CET) Original-Received: from filter1-ams.mf.surf.net (filter1-ams.mf.surf.net [192.87.102.69]) by balder.ntg.nl (Postfix) with ESMTP id A048C1021E for ; Tue, 13 Nov 2012 13:43:31 +0100 (CET) Original-Received: from mail-wg0-f45.google.com (mail-wg0-f45.google.com [74.125.82.45]) by filter1-ams.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id qADChSlu009105 for ; Tue, 13 Nov 2012 13:43:29 +0100 Original-Received: by mail-wg0-f45.google.com with SMTP id dq12so4036054wgb.2 for ; Tue, 13 Nov 2012 04:43:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=r+f8SoUq2glT9jm53lkVYDtWnKkUP2etjiC2bVSd6es=; b=Ts4E4ruT+NI9nRZuSwD98tW1pA4tHZ1GcylA4S3Tgzkx4O0zOtHyMRCxrOUDzDaWB1 PwGpc/h/pvqsQMPIr+NKzS6tqmyh4f3o98LL0EMoF1g2KNONWWOLLGHE1qoOe9AITLlR PFaUw8lwTd0BJ7839jHZmQYMOoFAXK2/WH1Ogbqmdc9p4CF5PNVWYqSZ44FXOXqQPOj8 V/fsAQojnh+rzKl/xDqBl8vbLRGknTXgEULWXJdVhh1AA9xN5nLLPeZogfqXHcUVB4Re tL6apOwSn003FqwuhfBxr5xpNtWu15MmMON9KVt2sBfYHFY3J7bWmyhj4Zl4+MWI9XKY GXIA== Original-Received: by 10.180.78.161 with SMTP id c1mr20149166wix.4.1352810608516; Tue, 13 Nov 2012 04:43:28 -0800 (PST) Original-Received: by 10.194.43.105 with HTTP; Tue, 13 Nov 2012 04:43:28 -0800 (PST) In-Reply-To: <20121113114215.285b4dc3@homerow> X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=74.125.82.45; country=US; region=CA; city=Mountain View; postalcode=94043; latitude=37.4192; longitude=-122.0574; metrocode=807; areacode=650; http://maps.google.com/maps?q=37.4192,-122.0574&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 0NIn0Htzd - 353789c177f3 - 20121113 X-Scanned-By: CanIt (www . roaringpenguin . com) on 192.87.102.69 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.14 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:79175 Archived-At: --===============1484530685== Content-Type: multipart/alternative; boundary=f46d0435c032c4dee504ce5fc3f9 --f46d0435c032c4dee504ce5fc3f9 Content-Type: text/plain; charset=ISO-8859-1 Thank you, it works. and I could add line number too. Now just the indent problem, but i can control this in the source file.. One more thing, how to change font in the \startDEFINE \stopDEFIN ? I find using ConTeXt as the back-end of WEB system(D E.Knuth, LP) is very well, because ConTeXt deal Chinese very easy and good. 2012/11/13 Marco Patzer > 2012-11-13 yang.zhao: > > > is there a good way to display source(such as C language) in ConTeXt? > > There is the vim module. It uses the editor vim to mark up the > source with syntax highlighting code. However, it does only > highlighting, not indentation. But it might be possible to hook in > an auto-indenter or a formatter like `astyle`. Here's an example: > > \usemodule > [vim] > > \definevimtyping > [C] > [syntax=c, > style=smalltype, > tab=2] > > \starttext > > \startC > void EBI_BankByteLaneEnable(uint32_t banks, bool enable) > { > EFM_ASSERT((banks & ~(EBI_BANK0 | EBI_BANK1 | EBI_BANK2 | EBI_BANK3)) == > 0); > > /* Configure byte lane support for each selected bank */ > if (banks & EBI_BANK0) > { > BITBAND_Peripheral(&(EBI->CTRL), _EBI_CTRL_BL_SHIFT, enable); > } > if (banks & EBI_BANK1) > { > BITBAND_Peripheral(&(EBI->CTRL), _EBI_CTRL_BL1_SHIFT, enable); > } > } > \stopC > > \stoptext > > > Marco > > > ___________________________________________________________________________________ > 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 > > ___________________________________________________________________________________ > -- K.I.S.S. --f46d0435c032c4dee504ce5fc3f9 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Thank you, it works.
and I could add line number too.
Now just the indent problem, but i can control this in the source file..
One more thing, how to change font in the=A0 \startDEFINE \stopDEFIN ?

I fi= nd using ConTeXt as the back-end of WEB s= ystem(D E.Knuth, LP) is very well,
because ConTeXt deal Chinese very easy an= d good.



2012/11/13 Ma= rco Patzer <homerow@lavabit.com>
2012-11-13 yang.zhao:

> is there a good way to display source(such as C language) =A0in ConTeX= t?

There is the vim module. It uses the editor vim to mark up the
source with syntax highlighting code. However, it does only
highlighting, not indentation. But it might be possible to hook in
an auto-indenter or a formatter like `astyle`. Here's an example:

\usemodule
=A0 [vim]

\definevimtyping
=A0 [C]
=A0 [syntax=3Dc,
=A0 =A0style=3Dsmalltype,
=A0 =A0tab=3D2]

\starttext

\startC
void EBI_BankByteLaneEnable(uint32_t banks, bool enable)
{
=A0 EFM_ASSERT((banks & ~(EBI_BANK0 | EBI_BANK1 | EBI_BANK2 | EBI_BANK3= )) =3D=3D 0);

=A0 /* Configure byte lane support for each selected bank */
=A0 if (banks & EBI_BANK0)
=A0 {
=A0 =A0 BITBAND_Peripheral(&(EBI->CTRL), _EBI_CTRL_BL_SHIFT, enable)= ;
=A0 }
=A0 if (banks & EBI_BANK1)
=A0 {
=A0 =A0 BITBAND_Peripheral(&(EBI->CTRL), _EBI_CTRL_BL1_SHIFT, enable= );
=A0 }
}
\stopC

\stoptext


Marco

___________________________________________________________________________= ________
If your question is of interest to others as well, please add an entry to t= he Wiki!

maillist : ntg-context@ntg.nl / <= a href=3D"http://www.ntg.nl/mailman/listinfo/ntg-context" target=3D"_blank"= >http://www.ntg.nl/mailman/listinfo/ntg-context
webpage =A0: http://= www.pragma-ade.nl / http://tex.aanhet.net
archive =A0: http://foundry.supelec.fr/projects/contextrev/
wiki =A0 =A0 : http:= //contextgarden.net
___________________________________________________________________________= ________



--
K.I.S.S.
--f46d0435c032c4dee504ce5fc3f9-- --===============1484530685== 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 ___________________________________________________________________________________ --===============1484530685==--