ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Syntax highlighting using LMTX
@ 2021-12-02  8:45 Thangalin via ntg-context
  2021-12-02 17:07 ` Aditya Mahajan via ntg-context
  0 siblings, 1 reply; 4+ messages in thread
From: Thangalin via ntg-context @ 2021-12-02  8:45 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Thangalin


[-- Attachment #1.1: Type: text/plain, Size: 1834 bytes --]

Hi all,

There are a few technical hurdles with using the t-vim module in LMTX.
First, users need to install the module using externally defined shell
scripts. Second, it's awkward to communicate to users how to install it,
especially for Windows users. Third, it likely requires installing vim, as
a separate step. Fourth, making general-purpose XML setups that optionally
rely on syntax highlighting when it is an optional install is a little
laborious.

If installing a module was as easy as "install.sh --module=t-vim" then that
would leap over most hurdles. Although there'd still be a dependency on
installing vim. Of course, it'd be pretty sweet if ConTeXt itself could
automatically install the necessary module when encountered (or provide a
command-line option to grant permissions to do so), but I understand that
that would be a hefty undertaking.

The following pages discuss creating syntax highlighters:

   - https://wiki.contextgarden.net/Verbatim_text
   - https://wiki.contextgarden.net/Custom_pretty_printer
   - https://tex.stackexchange.com/a/333620/2148

How would you go about creating a syntax highlighter for Java that can work
with LMTX? Specifically, I'd like to know:

   - Where do the files need to be saved? (e.g.,
   tex/texmf-context/tex/context/base/mkiv/)
   - What file name is required? (e.g., buff-imp-java.lua and
   buff-imp-java.mkiv)
   - How is the parser loaded? (e.g., \loadmarkfile{buff-imp-java} or
   \installprettytype[java][java])

Ultimately, this is going to be used with XML snippets along the lines of:

<pre><code class="language-java">public final class Example {
  public static void main( String args[] ) {
  }
}</code></pre>

Having the ability to dynamically define the requisite start/stop
environments based on the class attribute would be rather convenient.

Thank you!

[-- Attachment #1.2: Type: text/html, Size: 2343 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Syntax highlighting using LMTX
  2021-12-02  8:45 Syntax highlighting using LMTX Thangalin via ntg-context
@ 2021-12-02 17:07 ` Aditya Mahajan via ntg-context
  2021-12-02 18:35   ` Henri Menke via ntg-context
  0 siblings, 1 reply; 4+ messages in thread
From: Aditya Mahajan via ntg-context @ 2021-12-02 17:07 UTC (permalink / raw)
  To: Thangalin via ntg-context; +Cc: Aditya Mahajan

On Thu, 2 Dec 2021, Thangalin via ntg-context wrote:

> Hi all,
> 
> There are a few technical hurdles with using the t-vim module in LMTX.
> First, users need to install the module using externally defined shell
> scripts. Second, it's awkward to communicate to users how to install it,
> especially for Windows users. Third, it likely requires installing vim, as
> a separate step. Fourth, making general-purpose XML setups that optionally
> rely on syntax highlighting when it is an optional install is a little
> laborious.
> 
> If installing a module was as easy as "install.sh --module=t-vim" then that
> would leap over most hurdles. 

You can always install manually as follows:

cd $TEXMFHOME
wget https://mirrors.ctan.org/macros/context/contrib/context-{filter,vim}.zip
unzip context-{filter,vim}.zip

> Although there'd still be a dependency on installing vim. 

Yes, that's a trade-off that the vim module makes. But, last time I used Windows (some 10 years ago), installing vim was relatively easy. Download the install from vim's website, and click next a couple of times. 

> How would you go about creating a syntax highlighter for Java that can work
> with LMTX? 

I'll let others answer that. Had I known that, I wouldn't have written a module to do syntax highlighting :-) In the end, it also depends on how refined a syntax highlighter you want. Writing a simple keyword based highlighter is relatively easy. See, for example, scite-context-lexer-cpp.lua in the distribution, which is based on the CPP lexer in scite.

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Syntax highlighting using LMTX
  2021-12-02 17:07 ` Aditya Mahajan via ntg-context
@ 2021-12-02 18:35   ` Henri Menke via ntg-context
  2021-12-15 12:18     ` Christoph Reller via ntg-context
  0 siblings, 1 reply; 4+ messages in thread
From: Henri Menke via ntg-context @ 2021-12-02 18:35 UTC (permalink / raw)
  To: ntg-context; +Cc: Henri Menke

On Thu, 2021-12-02 at 12:07 -0500, Aditya Mahajan via ntg-context
wrote:
> On Thu, 2 Dec 2021, Thangalin via ntg-context wrote:
> 
> > Hi all,
> > 
> > There are a few technical hurdles with using the t-vim module in
> > LMTX.
> > First, users need to install the module using externally defined
> > shell
> > scripts. Second, it's awkward to communicate to users how to install
> > it,
> > especially for Windows users. Third, it likely requires installing
> > vim, as
> > a separate step. Fourth, making general-purpose XML setups that
> > optionally
> > rely on syntax highlighting when it is an optional install is a
> > little
> > laborious.
> > 
> > If installing a module was as easy as "install.sh --module=t-vim"
> > then that
> > would leap over most hurdles. 
> 
> You can always install manually as follows:
> 
> cd $TEXMFHOME
> wget
> https://mirrors.ctan.org/macros/context/contrib/context-{filter,vim}.zip
> unzip context-{filter,vim}.zip
> 
> > Although there'd still be a dependency on installing vim. 
> 
> Yes, that's a trade-off that the vim module makes. But, last time I
> used Windows (some 10 years ago), installing vim was relatively easy.
> Download the install from vim's website, and click next a couple of
> times. 
> 
> > How would you go about creating a syntax highlighter for Java that
> > can work
> > with LMTX? 
> 
> I'll let others answer that. Had I known that, I wouldn't have written
> a module to do syntax highlighting :-) In the end, it also depends on
> how refined a syntax highlighter you want. Writing a simple keyword
> based highlighter is relatively easy. See, for example, scite-context-
> lexer-cpp.lua in the distribution, which is based on the CPP lexer in
> scite.

I wrote an answer here some time ago.
https://tex.stackexchange.com/questions/333508/custom-pretty-printer-in-context

Cheers, Henri

> 
> 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
> _______________________________________________________________________
> ____________

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Syntax highlighting using LMTX
  2021-12-02 18:35   ` Henri Menke via ntg-context
@ 2021-12-15 12:18     ` Christoph Reller via ntg-context
  0 siblings, 0 replies; 4+ messages in thread
From: Christoph Reller via ntg-context @ 2021-12-15 12:18 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Christoph Reller


[-- Attachment #1.1: Type: text/plain, Size: 3291 bytes --]

By the way: there exists a module which is capable of highlighting Java:
https://modules.contextgarden.net/cgi-bin/module.cgi/ruid=12720986/action=view/id=82

Cheers, Christoph

Henri Menke via ntg-context <ntg-context@ntg.nl> schrieb am Do., 2. Dez.
2021, 19:45:

> On Thu, 2021-12-02 at 12:07 -0500, Aditya Mahajan via ntg-context
> wrote:
> > On Thu, 2 Dec 2021, Thangalin via ntg-context wrote:
> >
> > > Hi all,
> > >
> > > There are a few technical hurdles with using the t-vim module in
> > > LMTX.
> > > First, users need to install the module using externally defined
> > > shell
> > > scripts. Second, it's awkward to communicate to users how to install
> > > it,
> > > especially for Windows users. Third, it likely requires installing
> > > vim, as
> > > a separate step. Fourth, making general-purpose XML setups that
> > > optionally
> > > rely on syntax highlighting when it is an optional install is a
> > > little
> > > laborious.
> > >
> > > If installing a module was as easy as "install.sh --module=t-vim"
> > > then that
> > > would leap over most hurdles.
> >
> > You can always install manually as follows:
> >
> > cd $TEXMFHOME
> > wget
> > https://mirrors.ctan.org/macros/context/contrib/context-{filter,vim}.zip
> > unzip context-{filter,vim}.zip
> >
> > > Although there'd still be a dependency on installing vim.
> >
> > Yes, that's a trade-off that the vim module makes. But, last time I
> > used Windows (some 10 years ago), installing vim was relatively easy.
> > Download the install from vim's website, and click next a couple of
> > times.
> >
> > > How would you go about creating a syntax highlighter for Java that
> > > can work
> > > with LMTX?
> >
> > I'll let others answer that. Had I known that, I wouldn't have written
> > a module to do syntax highlighting :-) In the end, it also depends on
> > how refined a syntax highlighter you want. Writing a simple keyword
> > based highlighter is relatively easy. See, for example, scite-context-
> > lexer-cpp.lua in the distribution, which is based on the CPP lexer in
> > scite.
>
> I wrote an answer here some time ago.
>
> https://tex.stackexchange.com/questions/333508/custom-pretty-printer-in-context
>
> Cheers, Henri
>
> >
> > 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
> > _______________________________________________________________________
> > ____________
>
>
> ___________________________________________________________________________________
> 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
>
> ___________________________________________________________________________________
>

[-- Attachment #1.2: Type: text/html, Size: 5577 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-12-15 12:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-02  8:45 Syntax highlighting using LMTX Thangalin via ntg-context
2021-12-02 17:07 ` Aditya Mahajan via ntg-context
2021-12-02 18:35   ` Henri Menke via ntg-context
2021-12-15 12:18     ` Christoph Reller via ntg-context

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).