From: Hans Hagen <pragma@wxs.nl>
Subject: Re: An idea
Date: Sun, 04 Dec 2005 19:59:36 +0100 [thread overview]
Message-ID: <43933C98.20107@wxs.nl> (raw)
In-Reply-To: <20051203194557.GA8903@puritan.petwork>
Nikolai Weibull wrote:
>Nikolai Weibull wrote:
>
>
>
>>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’ll write
>>something this weekend. I’m catching a could though, so I might not
>>:-(.
>>
>>
>
>A splitting headache notwithstanding, here’s a syntax/2context.vim 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’t know how well this will work on the
>TeX side. It may also contain special characters like {, #, &, and so
>on. Suggestions?
>
>
don't use \type, just escape the characters \{ \} etc or use symbolic
names and use \tttf (or \tt for tje whole code fragment; \type is
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,
spacing etc)
[it's what i did with the scite exporter -- i output highligting in a
compact XML where even spaces are tagged]
Hans
Hans
Hans
next prev parent reply other threads:[~2005-12-04 18:59 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-12-01 16:29 Zeljko Vrba
2005-12-02 14:14 ` Hans Hagen
2005-12-02 17:43 ` Zeljko Vrba
2005-12-02 16:56 ` Nikolai Weibull
2005-12-02 17:04 ` Taco Hoekwater
2005-12-02 19:15 ` Re[2]: " Giuseppe Bilotta
2005-12-02 17:46 ` Zeljko Vrba
2005-12-02 18:43 ` Nikolai Weibull
2005-12-03 19:45 ` Nikolai Weibull
2005-12-03 22:48 ` Christopher Creutzig
2005-12-04 17:57 ` Nikolai Weibull
2005-12-04 19:00 ` Hans Hagen
2005-12-11 21:17 ` Christopher Creutzig
2005-12-04 18:59 ` Hans Hagen [this message]
2005-12-04 19:14 ` Nikolai Weibull
2005-12-04 20:38 ` Hans Hagen
2005-12-05 20:48 ` Nikolai Weibull
2005-12-06 9:11 ` Hans Hagen
2005-12-05 19:27 ` Mojca Miklavec
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=43933C98.20107@wxs.nl \
--to=pragma@wxs.nl \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).