From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/79171 Path: news.gmane.org!not-for-mail From: Marco Patzer Newsgroups: gmane.comp.tex.context Subject: Re: How to display source in ConTeXt? Date: Tue, 13 Nov 2012 11:42:15 +0100 Message-ID: <20121113114215.285b4dc3@homerow> References: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1352803351 9121 80.91.229.3 (13 Nov 2012 10:42:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 13 Nov 2012 10:42:31 +0000 (UTC) To: ntg-context@ntg.nl Original-X-From: ntg-context-bounces@ntg.nl Tue Nov 13 11:42:39 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 1TYDwx-0005Qb-Cu for gctc-ntg-context-518@m.gmane.org; Tue, 13 Nov 2012 11:42:35 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 8C07410209; Tue, 13 Nov 2012 11:42:25 +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 tqw1vTn-PRTe; Tue, 13 Nov 2012 11:42:23 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id C4ECE10219; Tue, 13 Nov 2012 11:42:23 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id F2F5E10219 for ; Tue, 13 Nov 2012 11:42:22 +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 c25jeqh9EgtX for ; Tue, 13 Nov 2012 11:42:22 +0100 (CET) Original-Received: from filter4-til.mf.surf.net (filter4-til.mf.surf.net [194.171.167.220]) by balder.ntg.nl (Postfix) with ESMTP id 038DC10209 for ; Tue, 13 Nov 2012 11:42:21 +0100 (CET) Original-Received: from karen.lavabit.com (karen.lavabit.com [72.249.41.33]) by filter4-til.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id qADAgIYG024242 for ; Tue, 13 Nov 2012 11:42:20 +0100 Original-Received: from c.earth.lavabit.com (c.earth.lavabit.com [192.168.111.12]) by karen.lavabit.com (Postfix) with ESMTP id 230A418F3B6 for ; Tue, 13 Nov 2012 04:42:18 -0600 (CST) Original-Received: from homerow (miun105-136.dynamic.miun.se [193.10.105.136]) by lavabit.com with ESMTP id 0HA70VGIHBGF for ; Tue, 13 Nov 2012 04:42:18 -0600 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=lavabit; d=lavabit.com; b=Hr5RsnEmv9Eti5lSuVHyNYrrjzhmD+YWIoVmQu+dm6qUUaI7pTN4Wr1Ax9f5iQAmJTxkiQN/oMrE2/sW29dkj1o26QdZspIgfTDNLo8xQ0PC3YUvEamgQ9X1fOSqZCq7pV5/WC5115SziBPxrlAcNqbsuJYMNZegkh84DtEMGko=; h=Date:From:To:Subject:Message-ID:In-Reply-To:References:X-Mailer:Mime-Version:Content-Type:Content-Transfer-Encoding; In-Reply-To: X-Mailer: Claws Mail 3.8.1 (GTK+ 2.24.10; x86_64-pc-linux-gnu) X-Bayes-Prob: 0.9999 (Score 4.7, tokens from: @@RPTN) X-CanIt-Geo: ip=72.249.41.33; country=US; region=TX; city=Dallas; postalcode=75206; latitude=32.8339; longitude=-96.7715; metrocode=623; areacode=214; http://maps.google.com/maps?q=32.8339,-96.7715&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 0VImWGjpw - 441eadff9850 - 20121113 X-Scanned-By: CanIt (www . roaringpenguin . com) on 194.171.167.220 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:79171 Archived-At: 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 ___________________________________________________________________________________