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
___

[NTG-context] Can I use lua 5.3 with external dynamic libraries?

2017-12-26 Thread Jorge Manuel

Dear Sirs

Recently I moved to High Sierra with lua version 5.3.

I make a dynamic library from GSL and Swig the I call meurandist.so

I do:

swig -lua meurandist.i
gcc -I/usr/include/lua -c meurandist_wrap.c -o meurandist_wrap.o
gcc -c meurandist.c -o meurandist.o
gcc -fpic -bundle -undefined dynamic_lookup -llua -lgsl -lgslcblas -lm -Wall 
-I/usr/local/include -L/usr/local/lib meurandist_wrap.o meurandist.o -o 
meurandist.so

In my old machine all I need to do for call this library are  

"sudo cp randist.so /usr/local/lib/lua/5.2”

And then 

\startluacode
require "meurandist"
ARRAY_SIZE=100
arr=meurandist.new_int(ARRAY_SIZE)
meurandist.rpoisson(arr,ARRAY_SIZE,4)
for i=0,ARRAY_SIZE-1 do
context(" "..meurandist.int_getitem(arr,i)..",")
  end
\stopluacode

Works nicely. 

But now I don’t have lua 5.2 installed. I have copied my dynamic library in the 
lua5.3 tree and that works fine if I call them from the console, but not works 
if all call inside a context document.

Did I need to install lua 5.2? Is it mandatary? Is there a another way to call 
c libraries?

Thanks a lot and have a luck year.

Jorge



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