Re: [NTG-context] type and typing comments for TeX and Lua

2017-12-27 Thread Christoph Reller
On Wed, 27 Dec 2017 19:53:58 +0100, Pablo Rodriguez  wrote:
> could you enable issues in your Bitbucket repository?

Issues are enabled now.
Cheers,
Christoph
___
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
___

Re: [NTG-context] type and typing comments for TeX and Lua

2017-12-27 Thread Aditya Mahajan

On Tue, 26 Dec 2017, Pablo Rodriguez wrote:


On 12/21/2017 10:53 PM, Aditya Mahajan wrote:

[...]
Can you post a minimal working example. I don't use XML so it is difficult 
for me to understand how these commands are used in practice.


Aditya,

many thanks for your reply and your help.

A minimal sample would be:

 \startbuffer[demo]
 
 b
 
 pa/p
 !--comment--
 
 \stopbuffer

 \startxmlsetups xml:initialize
\xmlsetsetup{#1}{doc|p|code}{xml:*}
 \stopxmlsetups

 \xmlregistersetup{xml:initialize}

 \startxmlsetups xml:doc
\xmlflush{#1}
 \stopxmlsetups

 \startxmlsetups xml:p
\startpar\xmlflush{#1}\stoppar
 \stopxmlsetups

 \startxmlsetups xml:code
   \xmlprettyprinttext{#1}{xml}
 \stopxmlsetups

 \starttext
\xmlprocessbuffer{main}{demo}{}
 \stoptext

But if this is too tricky to you, maybe it isn’t a good idea to extend
the module to XML usage.

There are (at least) two reasons for that:

- I’m the only user who asked for this (too much trouble for a single user).

- Easier alternatives would be to improve the ConTeXt core or the
context-highlight module.


It isn't too difficult to support this. See attached file.

This will clutter your PWD with temp files. To avoid that, create a 
subdirectory called "output" and set


\setupvimtyping[directory=output]

Then all the temp files will be stored in the directory "output".


test.tex
Description: TeX document
___
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
___

Re: [NTG-context] type and typing comments for TeX and Lua

2017-12-27 Thread Pablo Rodriguez
On 12/21/2017 10:16 PM, Christoph Reller wrote:
> 
> My module does not come in standard context. You have to download it
> from https://bitbucket.org/philexander/context-highlight. If general
> interest is high enough I can ask  to
> add it.

Christoph,

could you enable issues in your Bitbucket repository?

Many thanks for your help,

Pablo
-- 
http://www.ousia.tk
___
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
___

Re: [NTG-context] type and typing comments for TeX and Lua

2017-12-27 Thread Pablo Rodriguez
On 12/27/2017 02:14 AM, SteamedFish wrote:
> You can try vim module.
> 
> It supports all the formats that vim is able to support and it is a builtin 
> module.

Aditya suggested this possibility to me in a previous message in this
thread.

But my sources are XML, so the minimal sample is more complex (such as
the one contained in
https://mailman.ntg.nl/pipermail/ntg-context/2017/090479.html).

Many thanks for your reply,

Pablo
-- 
http://www.ousia.tk
___
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
___

Re: [NTG-context] type and typing comments for TeX and Lua

2017-12-26 Thread SteamedFish
You can try vim module.

It supports all the formats that vim is able to support and it is a builtin 
module.




\usemodule[t-vim]

\definevimtyping [TEX] [syntax=context]
\definevimtyping [XML] [syntax=xml]
\definevimtyping [LUA] [syntax=lua]

\starttext
\startTEXpage[offset=2em]

a \TEX\ inline comment: \inlineTEX{ag%befe}

\Lua\ inline comment: \inlineLUA{agb --efe}

\startTEX
This is text. % a comment, not \comment
\stopTEX

\startXML
This is text.
\stopXML

\startLUA
if code=="code" then --this is a comment
\stopLUA
\stopTEXpage
\stoptext



> On 22 Dec 2017, at 4:16 AM, Pablo Rodriguez  wrote:
> 
> On 12/21/2017 05:04 PM, Christoph Reller wrote:
>> Dear Pablo,
>> 
>> At least for XML you could use my module highlight-xml:
>> 
>> \usemodule[highlight-xml]
>> \definetype[xml][option=xml]
>> [...]
>> Note that even partial XML is highlighted correctly.
> Dear Christoph,
> 
> many thanks for your reply.
> 
> Your module is really great fine. It supports both \setuptype and
> \setuptyping options.
> 
> It is really a pity that it lacks TeX, since I’m focused on ConTeXt yet
> (after all, it would be a Spanish introduction to ConTeXt ;-)). XML will
> come later.
> 
> I’m afraid that XML comments are colored the same way with your module
> and with standard ConTeXt.
> 
> Comment marks in are colored as standard tags, I’m afraid. I mean,
> "" are colored in blue as "".
> 
> To show a comment as a whole, setting up both comment text and marks in
> a single and unique color is required.
> 
> This is why I thought that SnippetCommentMark and SnippetCommentText
> would be a fine way to typeset full comments.
> 
> Sorry for insisting. It isn’t perfectionism. My friends and family
> members aren’t computer scientists. I have to explain what a comment is
> from the very beginning. If colors are misleading, they are lost.
> 
> This is why I have to solve this before resuming text composition.
> 
> It would be great that you also offered a highlight-tex (with
> SnippetCommentText and SnippetCommentMark). Or to ease the module
> loading, it would be useful to have a context-highlight (or similar name).
> 
> If your implementation could be latter added (if Hans agrees) to the
> ConTeXt core.
> 
> Many thanks for your help,
> 
> Pablo
> -- 
> http://www.ousia.tk
> ___
> 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
___

Re: [NTG-context] type and typing comments for TeX and Lua

2017-12-26 Thread Pablo Rodriguez
On 12/21/2017 10:53 PM, Aditya Mahajan wrote:
> [...]
> Can you post a minimal working example. I don't use XML so it is difficult 
> for me to understand how these commands are used in practice.

Aditya,

many thanks for your reply and your help.

A minimal sample would be:

  \startbuffer[demo]
  
  b
  
  pa/p
  !--comment--
  
  \stopbuffer

  \startxmlsetups xml:initialize
 \xmlsetsetup{#1}{doc|p|code}{xml:*}
  \stopxmlsetups

  \xmlregistersetup{xml:initialize}

  \startxmlsetups xml:doc
 \xmlflush{#1}
  \stopxmlsetups

  \startxmlsetups xml:p
 \startpar\xmlflush{#1}\stoppar
  \stopxmlsetups

  \startxmlsetups xml:code
\xmlprettyprinttext{#1}{xml}
  \stopxmlsetups

  \starttext
 \xmlprocessbuffer{main}{demo}{}
  \stoptext

But if this is too tricky to you, maybe it isn’t a good idea to extend
the module to XML usage.

There are (at least) two reasons for that:

- I’m the only user who asked for this (too much trouble for a single user).

- Easier alternatives would be to improve the ConTeXt core or the
context-highlight module.

Many thanks for your help again,

Pablo
-- 
http://www.ousia.tk
___
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
___

Re: [NTG-context] type and typing comments for TeX and Lua

2017-12-26 Thread Pablo Rodriguez
On 12/21/2017 10:16 PM, Christoph Reller wrote:
> On Thu, 21 Dec 2017 21:16:45 +0100,  Pablo Rodriguez wrote:
>> [...]
>> It is really a pity that it lacks TeX, since I’m focused on ConTeXt yet
>> (after all, it would be a Spanish introduction to ConTeXt ;-)). XML will
>> come later.
> 
> Maybe, if I find the time, I will add TeX and Lua to my module some time.

Hi Christoph,

sorry for not replying before. I was away for Christmas.

I would love to be able to contribute the TeX highlighting, but this is
far beyond my knowledge :-(.

>> I’m afraid that XML comments are colored the same way with your module
>> and with standard ConTeXt.
> 
> That should not be the case. Could it be, that the highlight-xml
> module fails to load? Please check your log file for a "module not
> found" entry. I have attached the result of my earlier sample.

You are right, I had to download and install the module.

> My module does not come in standard context. You have to download it
> from https://bitbucket.org/philexander/context-highlight. If general
> interest is high enough I can ask  to
> add it.
The module doesn’t come with the ConTeXt Suite, but it seems to be added
to it:
https://modules.contextgarden.net/cgi-bin/module.cgi/action=view/id=82.

Taco, sorry for bothering, but why is this module not distributed with
the ConTeXt Suite?

Many thanks for your help (both Christoph and Taco),

Pablo
-- 
http://www.ousia.tk
___
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
___

Re: [NTG-context] type and typing comments for TeX and Lua

2017-12-21 Thread Aditya Mahajan

On Thu, 21 Dec 2017, Pablo Rodriguez wrote:


On 12/21/2017 08:05 PM, Aditya Mahajan wrote:

On Thu, 21 Dec 2017, Pablo Rodriguez wrote:

[...]
I don’t remember which were the options in t-vim,  but I need the
options from \setuptyping and \setuptype.


Currently vim does not support these primarily because I don't use XML so 
I never thought of this.


Could you send me a minimal example showing how \xmlprettyprinttext is 
used and I can check how to create an interface for t-vim.


Aditya,

many thanks for your help.

The goodie (as per lxml-ini.mkiv) reads as follow:

   \def\xmltempbuffername{xml-temp}

   \unexpanded\def\prettyprintbuffer#1#2% only used here
 {\ifdefined\scitebuffer
\scitebuffer[#2][#1]%
  \else
\typebuffer[#1][\c!option=#2]%
  \fi}

   %~ \unexpanded\def\xmlprettyprint#1#2%
 %~ {\xmltobufferverbose{#1}{.}{\xmltempbuffername}%
  %~ \prettyprintbuffer\xmltempbuffername{#2}}

   \unexpanded\def\xmlprettyprinttext#1#2%
 {\xmltobuffertextonly{#1}{.}{\xmltempbuffername}%
  \prettyprintbuffer\xmltempbuffername{#2}}

   \unexpanded\def\inlineprettyprintbuffer#1#2% only used here
 {\ifdefined\sciteinlinebuffer
\sciteinlinebuffer[#2][#1]%
  \else
\typeinlinebuffer[#1][\c!option=#2]%
  \fi}

   %~ \unexpanded\def\xmlinlineprettyprint#1#2%
 %~ {\xmltobufferverbose{#1}{.}{\xmltempbuffername}%
  %~ \inlineprettyprintbuffer\xmltempbuffername{#2}}

   \unexpanded\def\xmlinlineprettyprinttext#1#2%
 {\xmltobuffertextonly{#1}{.}{\xmltempbuffername}%
  \inlineprettyprintbuffer\xmltempbuffername{#2}}

\xmltobuffertextonly is required to clean HTML hightlighted code, such
as in https://shorturl.at/pS124.

This is why only adapting both \xmlprettyprinttext and
\xmlinlineprettyprint gets the fuctionality for the other two commands.

The commands are invoked in this way:

   \xmlinlineprettyprinttext{#1}{tex}

   \xmlprettyprinttext{#1}{lua}

Maybe adapting \prettyprintbuffer and \inlineprettyprintbuffer to the
t-vim module works fine. (But this code is all Greek to me.)

Many thanks for your help again,


Can you post a minimal working example. I don't use XML so it is difficult 
for me to understand how these commands are used in practice.


Thanks,
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
___

Re: [NTG-context] type and typing comments for TeX and Lua

2017-12-21 Thread Christoph Reller
On Thu, 21 Dec 2017 21:16:45 +0100,  Pablo Rodriguez  wrote:
> On 12/21/2017 05:04 PM, Christoph Reller wrote:
>> Dear Pablo,
>>
>> At least for XML you could use my module highlight-xml:
>>
>> \usemodule[highlight-xml]
>> \definetype[xml][option=xml]
>> [...]
>> Note that even partial XML is highlighted correctly.
>
> It is really a pity that it lacks TeX, since I’m focused on ConTeXt yet
> (after all, it would be a Spanish introduction to ConTeXt ;-)). XML will
> come later.

Maybe, if I find the time, I will add TeX and Lua to my module some time.

> I’m afraid that XML comments are colored the same way with your module
> and with standard ConTeXt.

That should not be the case. Could it be, that the highlight-xml
module fails to load? Please check your log file for a "module not
found" entry. I have attached the result of my earlier sample.

My module does not come in standard context. You have to download it
from https://bitbucket.org/philexander/context-highlight. If general
interest is high enough I can ask  to
add it.

Kind regards,

Christoph
___
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
___

Re: [NTG-context] type and typing comments for TeX and Lua

2017-12-21 Thread Pablo Rodriguez
On 12/21/2017 08:05 PM, Aditya Mahajan wrote:
> On Thu, 21 Dec 2017, Pablo Rodriguez wrote:
>> [...]
>> I don’t remember which were the options in t-vim,  but I need the
>> options from \setuptyping and \setuptype.
> 
> Currently vim does not support these primarily because I don't use XML so 
> I never thought of this.
> 
> Could you send me a minimal example showing how \xmlprettyprinttext is 
> used and I can check how to create an interface for t-vim.

Aditya,

many thanks for your help.

The goodie (as per lxml-ini.mkiv) reads as follow:

\def\xmltempbuffername{xml-temp}

\unexpanded\def\prettyprintbuffer#1#2% only used here
  {\ifdefined\scitebuffer
 \scitebuffer[#2][#1]%
   \else
 \typebuffer[#1][\c!option=#2]%
   \fi}

%~ \unexpanded\def\xmlprettyprint#1#2%
  %~ {\xmltobufferverbose{#1}{.}{\xmltempbuffername}%
   %~ \prettyprintbuffer\xmltempbuffername{#2}}

\unexpanded\def\xmlprettyprinttext#1#2%
  {\xmltobuffertextonly{#1}{.}{\xmltempbuffername}%
   \prettyprintbuffer\xmltempbuffername{#2}}

\unexpanded\def\inlineprettyprintbuffer#1#2% only used here
  {\ifdefined\sciteinlinebuffer
 \sciteinlinebuffer[#2][#1]%
   \else
 \typeinlinebuffer[#1][\c!option=#2]%
   \fi}

%~ \unexpanded\def\xmlinlineprettyprint#1#2%
  %~ {\xmltobufferverbose{#1}{.}{\xmltempbuffername}%
   %~ \inlineprettyprintbuffer\xmltempbuffername{#2}}

\unexpanded\def\xmlinlineprettyprinttext#1#2%
  {\xmltobuffertextonly{#1}{.}{\xmltempbuffername}%
   \inlineprettyprintbuffer\xmltempbuffername{#2}}

\xmltobuffertextonly is required to clean HTML hightlighted code, such
as in https://shorturl.at/pS124.

This is why only adapting both \xmlprettyprinttext and
\xmlinlineprettyprint gets the fuctionality for the other two commands.

The commands are invoked in this way:

\xmlinlineprettyprinttext{#1}{tex}

\xmlprettyprinttext{#1}{lua}

Maybe adapting \prettyprintbuffer and \inlineprettyprintbuffer to the
t-vim module works fine. (But this code is all Greek to me.)

Many thanks for your help again,

Pablo
-- 
http://www.ousia.tk
___
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
___

Re: [NTG-context] type and typing comments for TeX and Lua

2017-12-21 Thread Pablo Rodriguez
On 12/21/2017 05:04 PM, Christoph Reller wrote:
> Dear Pablo,
> 
> At least for XML you could use my module highlight-xml:
> 
> \usemodule[highlight-xml]
> \definetype[xml][option=xml]
> [...]
> Note that even partial XML is highlighted correctly.
Dear Christoph,

many thanks for your reply.

Your module is really great fine. It supports both \setuptype and
\setuptyping options.

It is really a pity that it lacks TeX, since I’m focused on ConTeXt yet
(after all, it would be a Spanish introduction to ConTeXt ;-)). XML will
come later.

I’m afraid that XML comments are colored the same way with your module
and with standard ConTeXt.

Comment marks in are colored as standard tags, I’m afraid. I mean,
"" are colored in blue as "".

To show a comment as a whole, setting up both comment text and marks in
a single and unique color is required.

This is why I thought that SnippetCommentMark and SnippetCommentText
would be a fine way to typeset full comments.

Sorry for insisting. It isn’t perfectionism. My friends and family
members aren’t computer scientists. I have to explain what a comment is
from the very beginning. If colors are misleading, they are lost.

This is why I have to solve this before resuming text composition.

It would be great that you also offered a highlight-tex (with
SnippetCommentText and SnippetCommentMark). Or to ease the module
loading, it would be useful to have a context-highlight (or similar name).

If your implementation could be latter added (if Hans agrees) to the
ConTeXt core.

Many thanks for your help,

Pablo
-- 
http://www.ousia.tk
___
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
___

Re: [NTG-context] type and typing comments for TeX and Lua

2017-12-21 Thread Pablo Rodriguez
On 12/20/2017 10:18 PM, Hans Hagen wrote:
> On 12/20/2017 8:45 PM, Pablo Rodriguez wrote:
>> [...]
>> Would it be possible that there are two SnippetComments for all lexers:
>> SnippetCommentMark and SnippetCommentText?
> > very low priority ... there is some logic behind these that i don't want
> to break

Then I will have to wait for that implementation. Sorry for not being
able to provide the patch myself.

scite is great for coloring, but it lacks the options from \setuptype
and \setuptyping. I don’t need escapes, but many of the other options.

I need both complete comment coloring (otherwise it is really hard for
newbies to see what a comment may be) and \setuptyping (and \setuptype)
options.

BTW, I’m afraid there is a bug with multiline comments in Lua. The first
line break is removed in multiline:

%~ \usemodule[scite] % to check the bug
\starttext
\startTEXpage[offset=2em]
\startLUA
--[[
multiline comment
]]--

---[[
multiline comment
]]---
\stopLUA
\stopTEXpage
\stoptext

Many thanks for your help again,

Pablo
-- 
http://www.ousia.tk
___
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
___

Re: [NTG-context] type and typing comments for TeX and Lua

2017-12-21 Thread Aditya Mahajan

On Thu, 21 Dec 2017, Pablo Rodriguez wrote:


On 12/20/2017 12:20 AM, Aditya Mahajan wrote:

On Tue, 19 Dec 2017, Pablo Rodriguez wrote:

[...]
I checked your t-vim module months ago and I don’t remember which were
the problems, but I had to discard it.


Just try your document with t-vim. It should be as simple as subsituting

\usemodule[vim]


Many thanks for your reply, Aditya.

My scenario is much more complex: I typeset XML (HTML4 or HTML5)
generated from Markdown sources via pandoc.

My commands are \xmlinlineprettyprinttext{#1}{tex} and
\xmlprettyprinttext{#1}{tex}.

I don’t remember which were the options in t-vim,  but I need the
options from \setuptyping and \setuptype.


Currently vim does not support these primarily because I don't use XML so 
I never thought of this.


Could you send me a minimal example showing how \xmlprettyprinttext is 
used and I can check how to create an interface for t-vim.


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
___

Re: [NTG-context] type and typing comments for TeX and Lua

2017-12-21 Thread Pablo Rodriguez
On 12/20/2017 12:20 AM, Aditya Mahajan wrote:
> On Tue, 19 Dec 2017, Pablo Rodriguez wrote:
>> [...]
>> I checked your t-vim module months ago and I don’t remember which were
>> the problems, but I had to discard it.
> 
> Just try your document with t-vim. It should be as simple as subsituting
> 
> \usemodule[vim]

Many thanks for your reply, Aditya.

My scenario is much more complex: I typeset XML (HTML4 or HTML5)
generated from Markdown sources via pandoc.

My commands are \xmlinlineprettyprinttext{#1}{tex} and
\xmlprettyprinttext{#1}{tex}.

I don’t remember which were the options in t-vim,  but I need the
options from \setuptyping and \setuptype.

Many thanks for your help again,

Pablo
-- 
http://www.ousia.tk
___
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
___

Re: [NTG-context] type and typing comments for TeX and Lua

2017-12-21 Thread Christoph Reller
On Tue, Mon, 18 Dec 2017 23:50:09 +0100, Pablo Rodriguez  wrote:
> I have the following sample:
>
> \definetype[context][option=tex]
> \definetype[lua][option=lua]
> \starttext
> \startTEXpage[offset=2em]
>
> a \TEX\ inline comment: \context{ag%befe}
>
> \Lua\ inline comment: \lua{agb --efe}
>
> \startTEX
> This is text. % a comment, not \comment
> \stopTEX
>
> \startXML
> This is text.
> \stopXML
>
> \startLUA
> if code=="code" then --this is a comment
> \stopLUA
> \stopTEXpage
> \stoptext
>
> Would it be possible that all comments in type and typing (at least, for
> Lua, XML and TeX) would have the same formatting for the whole comment
> contents, including the comment signs?

Dear Pablo,

At least for XML you could use my module highlight-xml:

\usemodule[highlight-xml]
\definetype[xml][option=xml]
\starttext
\startTEXpage[offset=2em]
  \xml{attr="value"}\crlf
  \xml{This is text.}
  \startXML
This is text.
  \stopXML
\stopTEXpage
\stoptext

Note that even partial XML is highlighted correctly.

Cheers,

Christoph
___
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
___

Re: [NTG-context] type and typing comments for TeX and Lua

2017-12-20 Thread Hans Hagen

On 12/20/2017 8:45 PM, Pablo Rodriguez wrote:

On 12/20/2017 12:53 PM, Hans Hagen wrote:

On 12/18/2017 11:50 PM, Pablo Rodriguez wrote:

[...]

% Differs per lexer:

\definestartstop
  [XmlSnippetComment]
  [color=,
   style=]


I’m afraid that the scite module isn’t an option for me.


Then you need to configure the highligheters yourself


Many thanks for your reply, Hans.

I don’t mind to set up the highlighters myself, but the problem is the
following.

XmlSnippetComment only contains the text inside the comment, but not the
marks ().

LuaSnippetComment contains the marker (only --), but not the text.

TexSnippetComment contains the marker (%), but not the text.

Would it be possible that there are two SnippetComments for all lexers:
SnippetCommentMark and SnippetCommentText?
very low priority ... there is some logic behind these that i don't want 
to break


Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-
___
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
___

Re: [NTG-context] type and typing comments for TeX and Lua

2017-12-20 Thread Pablo Rodriguez
On 12/20/2017 12:53 PM, Hans Hagen wrote:
> On 12/18/2017 11:50 PM, Pablo Rodriguez wrote:
>> [...]
> % Differs per lexer:
> 
> \definestartstop
>  [XmlSnippetComment]
>  [color=,
>   style=]
> 
>> I’m afraid that the scite module isn’t an option for me.
>
> Then you need to configure the highligheters yourself

Many thanks for your reply, Hans.

I don’t mind to set up the highlighters myself, but the problem is the
following.

XmlSnippetComment only contains the text inside the comment, but not the
marks ().

LuaSnippetComment contains the marker (only --), but not the text.

TexSnippetComment contains the marker (%), but not the text.

Would it be possible that there are two SnippetComments for all lexers:
SnippetCommentMark and SnippetCommentText?

Many thanks for your help,

Pablo
-- 
http://www.ousia.tk
___
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
___

Re: [NTG-context] type and typing comments for TeX and Lua

2017-12-20 Thread Hans Hagen

On 12/18/2017 11:50 PM, Pablo Rodriguez wrote:

Hans,

sorry for insisting, but I really need this.

I have the following sample:

 \definetype[context][option=tex]
 \definetype[lua][option=lua]
 \starttext
 \startTEXpage[offset=2em]

 a \TEX\ inline comment: \context{ag%befe}

 \Lua\ inline comment: \lua{agb --efe}

 \startTEX
 This is text. % a comment, not \comment
 \stopTEX

 \startXML
 This is text.
 \stopXML

 \startLUA
 if code=="code" then --this is a comment
 \stopLUA
 \stopTEXpage
 \stoptext

Would it be possible that all comments in type and typing (at least, for
Lua, XML and TeX) would have the same formatting for the whole comment
contents, including the comment signs?

Sorry, but with the current output, it is hard to see (for total
newbies) what is part of the comment and what not. And the text editor
will display something different.


It depends on the lexer ...

% \usemodule[scite] % use editor logic

% DIffers per lexer:

\definestartstop
[XmlSnippetComment]
[color=,
 style=]


I’m afraid that the scite module isn’t an option for me.

Then you need to configure the highligheters yourself

Hans


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-
___
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
___

Re: [NTG-context] type and typing comments for TeX and Lua

2017-12-19 Thread Aditya Mahajan

On Tue, 19 Dec 2017, Pablo Rodriguez wrote:


On 12/19/2017 08:26 PM, Aditya Mahajan wrote:

On Mon, 18 Dec 2017, Pablo Rodriguez wrote:

[...]
Would it be possible that all comments in type and typing (at least, for
Lua, XML and TeX) would have the same formatting for the whole comment
contents, including the comment signs?

Sorry, but with the current output, it is hard to see (for total
newbies) what is part of the comment and what not. And the text editor
will display something different.

I’m afraid that the scite module isn’t an option for me.


t-vim parses this correctly, but IIRC, you don't want to use the vim 
module either, right?


Aditya,

I checked your t-vim module months ago and I don’t remember which were
the problems, but I had to discard it.


Just try your document with t-vim. It should be as simple as subsituting

\usemodule[vim]
\definevimtyping[context][syntax=context]
\definevimtyping[lua][syntax=lua]

instead of the \setuptyping commands. If you have a lot of code snippets, 
create an subdirectory called output and also set


\setupvimtyping[directory=output]

Let me know if there are any errors and I can look into it (except if the 
error is related to a windows configuration issue. I don't have a windows 
machine to test the module).


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
___

Re: [NTG-context] type and typing comments for TeX and Lua

2017-12-19 Thread Pablo Rodriguez
On 12/19/2017 08:26 PM, Aditya Mahajan wrote:
> On Mon, 18 Dec 2017, Pablo Rodriguez wrote:
>> [...]
>> Would it be possible that all comments in type and typing (at least, for
>> Lua, XML and TeX) would have the same formatting for the whole comment
>> contents, including the comment signs?
>>
>> Sorry, but with the current output, it is hard to see (for total
>> newbies) what is part of the comment and what not. And the text editor
>> will display something different.
>>
>> I’m afraid that the scite module isn’t an option for me.
> 
> t-vim parses this correctly, but IIRC, you don't want to use the vim 
> module either, right?

Aditya,

I checked your t-vim module months ago and I don’t remember which were
the problems, but I had to discard it.

I reported this issue three times before (twice in August and once in
October). What strikes me most is not why it hasn’t been fixed yet, but
which is the rationale behind this behavior.

I was writing an (Spanish) introduction to ConTeXt and I had to stop it
because I couldn’t explain comments having a different color scheme in
text than the display in a text editor (TeXworks to name the most simple
one).

But I hope this can be fixed in the future.

Many thanks for your help,

Pablo
-- 
http://www.ousia.tk
___
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
___

Re: [NTG-context] type and typing comments for TeX and Lua

2017-12-19 Thread Aditya Mahajan

On Mon, 18 Dec 2017, Pablo Rodriguez wrote:


   \definetype[context][option=tex]
   \definetype[lua][option=lua]
   \starttext
   \startTEXpage[offset=2em]

   a \TEX\ inline comment: \context{ag%befe}

   \Lua\ inline comment: \lua{agb --efe}

   \startTEX
   This is text. % a comment, not \comment
   \stopTEX

   \startXML
   This is text.
   \stopXML

   \startLUA
   if code=="code" then --this is a comment
   \stopLUA
   \stopTEXpage
   \stoptext

Would it be possible that all comments in type and typing (at least, for
Lua, XML and TeX) would have the same formatting for the whole comment
contents, including the comment signs?

Sorry, but with the current output, it is hard to see (for total
newbies) what is part of the comment and what not. And the text editor
will display something different.

I’m afraid that the scite module isn’t an option for me.


t-vim parses this correctly, but IIRC, you don't want to use the vim 
module either, right?


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
___

[NTG-context] type and typing comments for TeX and Lua

2017-12-18 Thread Pablo Rodriguez
Hans,

sorry for insisting, but I really need this.

I have the following sample:

\definetype[context][option=tex]
\definetype[lua][option=lua]
\starttext
\startTEXpage[offset=2em]

a \TEX\ inline comment: \context{ag%befe}

\Lua\ inline comment: \lua{agb --efe}

\startTEX
This is text. % a comment, not \comment
\stopTEX

\startXML
This is text.
\stopXML

\startLUA
if code=="code" then --this is a comment
\stopLUA
\stopTEXpage
\stoptext

Would it be possible that all comments in type and typing (at least, for
Lua, XML and TeX) would have the same formatting for the whole comment
contents, including the comment signs?

Sorry, but with the current output, it is hard to see (for total
newbies) what is part of the comment and what not. And the text editor
will display something different.

I’m afraid that the scite module isn’t an option for me.

Many thanks for your help,

Pablo
-- 
http://www.ousia.tk
___
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
___