From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/24099 Path: news.gmane.org!not-for-mail From: Hans Hagen Newsgroups: gmane.comp.tex.context Subject: Re: An idea Date: Sun, 04 Dec 2005 19:59:36 +0100 Message-ID: <43933C98.20107@wxs.nl> References: <20051201162914.GA14497@fly.srk.fer.hr> <20051202165636.GA8858@puritan.petwork> <20051202174653.GB3376@fly.srk.fer.hr> <20051202184337.GB8858@puritan.petwork> <20051203194557.GA8903@puritan.petwork> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1133722888 11933 80.91.229.2 (4 Dec 2005 19:01:28 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 4 Dec 2005 19:01:28 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Sun Dec 04 20:01:23 2005 Return-path: 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 1Eiz5Q-0003LT-ES for gctc-ntg-context-518@m.gmane.org; Sun, 04 Dec 2005 19:59:48 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id ECE63127D7; Sun, 4 Dec 2005 19:59:47 +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 30411-01; Sun, 4 Dec 2005 19:59:44 +0100 (CET) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 55689127C4; Sun, 4 Dec 2005 19:59:44 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 0D42B127C4 for ; Sun, 4 Dec 2005 19:59:43 +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 30223-06 for ; Sun, 4 Dec 2005 19:59:42 +0100 (CET) Original-Received: from controller-1 (dsl-212-84-128-085.solcon.nl [212.84.128.85]) by ronja.ntg.nl (Postfix) with ESMTP id EDF0D12795 for ; Sun, 4 Dec 2005 19:59:41 +0100 (CET) Original-Received: from [10.100.1.102] (unverified [10.100.1.102]) by controller-1 (SurgeMail 3.5b3) with ESMTP id 6325 for ; Sun, 04 Dec 2005 20:05:12 +0300 User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en Original-To: mailing list for ConTeXt users In-Reply-To: <20051203194557.GA8903@puritan.petwork> X-Server: High Performance Mail Server - http://surgemail.com r=-274017400 X-Authenticated-User: hagen@controller-1 X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.5 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:24099 Archived-At: Nikolai Weibull wrote: >Nikolai Weibull wrote: > > =20 > >>It would require very little programming. syntax/2html.vim, which >>converts the buffer to a HTML document with syntax highlighting, is 526 >>lines in the current CVS incarnation. A syntax/2context.vim would be >>even shorter, perhaps 150 to 200 lines. If I find the time I=E2=80=99l= l write >>something this weekend. I=E2=80=99m catching a could though, so I migh= t not >>:-(. >> =20 >> > >A splitting headache notwithstanding, here=E2=80=99s a syntax/2context.v= im that >weighs in at 170 lines. There are still things to do, like figuring out >how to complement this on the ConTeXt side (i.e., defining \highlight) >and things will depend on how this is done. Some sort of \type >environment would be nice, as it is better to not do escaping of special >characters on the Vim side. Someone with better knowledge of how to do >this than I have is welcome to finish it. The \highlight command should >be defined something like this (pseudo-tex-code): > >\pdef\highlight[#1]{#2}% > {\bgroup > \setupcolorforgroup[#1]% > \type{#2}% > \egroup} > >#1 is a group name, such as Statement, Operator, or Comment. #2 may >contain multiple lines, and I don=E2=80=99t know how well this will work= on the >TeX side. It may also contain special characters like {, #, &, and so >on. Suggestions? > =20 > don't use \type, just escape the characters \{ \} etc or use symbolic=20 names and use \tttf (or \tt for tje whole code fragment; \type is=20 overkill here an dmy do more hard than good so you get something \startVIMhightlighting \vhl[#1]{....} \stopVIMhighlighting with \def\startVIMhightlighting {\startlines \tt} \def\stopVIMhighlighting {\stoplines} \def\vhl[#1]#2% {\color[#1]{#2}} % maybe even local colors when speed is needed Even better, be more verbose: \startVIMhightlighting \vline{\vword[#1]{....}} \stopVIMhighlighting or even: \startVIMparagraph \startVIMline\VIMword[#1]{....} ... \stopVIMline \stopVIMparagraph in that case you have way more control (line numbering/treatment,=20 spacing etc) [it's what i did with the scite exporter -- i output highligting in a=20 compact XML where even spaces are tagged] Hans Hans Hans