ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Aditya Mahajan <adityam@umich.edu>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Custom color schemes in t-vim
Date: Sat, 16 May 2020 20:42:43 -0400 (EDT)	[thread overview]
Message-ID: <nycvar.YAK.7.77.849.2005162033430.225319@nqv-guvaxcnq> (raw)
In-Reply-To: <r9pel2$354a$2@ciao.gmane.io>

On Sat, 16 May 2020, Nicola wrote:

> On 2020-05-16, Aditya Mahajan <adityam@umich.edu> wrote:
>> On Sat, 16 May 2020, Aditya Mahajan wrote:
>
>> Moreover, if you comment line line 126 of `2context.vim`
>>
>>      "let s:id      = synIDtrans (s:id)
>>
>> [If you make a local copy of 2context.vim, then you need to run the
>> file with `--mode=dev-vim` to ensure that the local copy is used]
>>
>> Then the ruby example generates the following file:
>>
>> \SYNBOL{}\SYN[rubyComment]{# Ruby program listing}\SYNEOL{}
>> \SYNBOL{}\SYN[rubyDefine]{def}\SYN[rubyMethodBlock]{ }\SYN[rubyMethodName]{foobar}\SYNEOL{}
>> \SYNBOL{}\SYN[rubyMethodBlock]{  print(}\SYN[rubyStringDelimiter]{"}\SYN[rubyString]{Hello World}\SYN[rubyStringDelimiter]{"}\SYN[rubyMethodBlock]{)}\SYNEOL{}
>> \SYNBOL{}\SYN[rubyDefine]{end}\SYNEOL{}
>>
>> So, if you are willing to define wrappers for all ruby syntax blocks,
>> then I can provide a configuration option so that `2context` does not
>> apply that line.

> That might provide a finer control over the highlighting, but the main
> issue here seems to be that the generated file has Identifier instead of
> Function, Special instead of Delimiter and Constant instead of String.
> Looking at 2context.vim, AFAICS s:id_name seems computed correctly.
> Maybe, the script does not set the appropriate filetype?

filetype is set correctly (since we get `ruby....` options), but something weird is happening even with 2html.vim. Here is a minimal example:

```test.rb
# Ruby program listing
def foobar
   print("Hello World")
end
```

Run:

vim -u NONE -c "syntax manual" -c "set syntax=ruby" -c "source /usr/share/nvim/runtime/syntax/2html.vim" -c "wqa" test.rb

gives

```test.rb.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
...
</head>
<body>
<pre id='vimCodeElement'>
<span class="Comment"># Ruby program listing</span>
<span class="PreProc">def</span> <span class="Identifier">foobar</span>
   print(<span class="Special">&quot;</span><span class="Constant">Hello World</span><span class="Special">&quot;</span>)
<span class="PreProc">end</span>

</pre>
</body>
</html>
<!-- vim: set foldmethod=manual : -->
```

which is similar to what 2context.vim gets. If I source tohtml.vim or 2context.vim from an existing vim session, then the tags are correct. I have not been able to figure out why this is happening.

Aditya
___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2020-05-17  0:42 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-14 10:42 Nicola
2020-05-14 15:44 ` Aditya Mahajan
2020-05-16 11:34   ` Nicola
2020-05-16 14:46     ` Aditya Mahajan
2020-05-16 15:03       ` Aditya Mahajan
2020-05-16 19:24         ` Nicola
2020-05-17  0:42           ` Aditya Mahajan [this message]
2020-05-17  6:36             ` Aditya Mahajan
2020-05-17  7:41               ` Aditya Mahajan
2020-05-17  8:34                 ` Nicola
2020-05-17 10:27                   ` Nicola
2020-05-17 15:21                   ` Aditya Mahajan
2020-05-18  5:30                   ` Aditya Mahajan

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=nycvar.YAK.7.77.849.2005162033430.225319@nqv-guvaxcnq \
    --to=adityam@umich.edu \
    --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).