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
_______________________________________________
ntg-context mailing list
[email protected]
http://www.ntg.nl/mailman/listinfo/ntg-context