[NTG-context] Re: Anyone working on a treesitter grammar?

2024-07-20 Thread Paul Mazaitis
On 4 Jul 2024, at 15:22, juh+ntg-context--- via ntg-context wrote:

> Dear all,
>
> no mention here https://tree-sitter.github.io/tree-sitter/ and searching for 
> treesitter on the Wiki gives no match?

A ha! You are correct; it turns out all the references are under "tree-sitter" 
(hyphen included).

(I'm not familiar enough with the wiki to know if there's a way to include tags 
with pages so that searches can more easily find things? Frex, adding 
"treesitter" and "tree sitter" to the tree-sitter pages? We can always add a 
keywords stanza or something to the body text of the page...)

> Many texteditors have treesitter support builtin so having a ConTeXt grammar 
> would be nice.

In an attempt to make it easier to find, I've put references to the grammar I 
came up with on the Text Editors wiki page as well as on specific wiki pages 
for editors where I've been able to get support working.

(I'm taking a look at adding ConTeXt support to Zed, but all I'm getting for my 
troubles right now is a massive memory leak.)

> TIA
> juh

-Paul
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: ConTeXt support for Nova text editor (MacOS)

2023-12-08 Thread Paul Mazaitis
On 16 Nov 2023, at 13:02, Alexandre Christe wrote:

> Hi Paul,
>
> Actually in the assets on Github it’s indicating a Typst extensions, not a 
> ConTeXt one...

Oof, my apologies; the release binary on GitHub has been fixed!

> BR.

-Paul
-Off to be mortified, now...

> A. Christe
> Le 11 nov. 2023 à 18:49 +0100, Paul Mazaitis , a écrit :
>>
>> Hello, list!
>>
>> I'm working on a ConTeXt language extension for the Nova editor by Panic 
>> software (https://nova.app/).
>>
>> The extension is here:
>>
>> https://github.com/pmazaitis/nova-context/releases/tag/0.6.0
>>
>> ...currently in beta, but fairly functional.
>>
>> This version of the extension supports:
>>
>> * Syntax Highlighting
>> * Folding for (most) environments
>> * Navigating by Symbols (headings: chapter, section, etc.)
>> * Spell-checking of body text and section titles
>> * Managing builds with Nova's tasks system
>>
>> (As an aside, this extension uses an updated version of the ConTeXt 
>> tree-sitter parser [https://github.com/pmazaitis/tree-sitter-context] that 
>> can now recognize (most) environments and use them to parse out the document 
>> hierarchy.)
>>
>> Limitations at the moment: not all environments are supported (only those 
>> with \start and \stop commands right now), and the extension only supports 
>> English.
>>
>> Happy for any bug reports, etc.,
>>
>> -Paul
>> ___
>> If your question is of interest to others as well, please add an entry to 
>> the Wiki!
>>
>> maillist : ntg-context@ntg.nl / 
>> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
>> webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
>> archive : https://github.com/contextgarden/context
>> wiki : https://wiki.contextgarden.net
>> ___

> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
>
> maillist : ntg-context@ntg.nl / 
> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive  : https://github.com/contextgarden/context
> wiki : https://wiki.contextgarden.net
> ___
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: ConTeXt support for Nova text editor (MacOS)

2023-11-11 Thread Paul Mazaitis
On 11 Nov 2023, at 14:52, Aditya Mahajan wrote:

> Last time I checked tree-sitter on neovim, there were no good tree-sitters 
> for context. I'd be interested in testing this out.

Happy to have feedback!

> Does the parser detect nested metapost and luatex environments?

The parser recognizes chunks of metapost and latex code and marks them in the 
syntax tree, but does nothing else: I figured the best approach here was to let 
applications call out to various tree-sitter parsers as needed.

I don't know of a tree-sitter parser for either metapost or latex. The next one 
I am going to try to build a parser for is metapost (following the reference 
material in the back of the manual) but I haven't sat down to that task yet.

(Plus, that one's going to need a _lot_ of testing by people other than I; I 
only use metapost for very simple things, and my understanding is surface level 
at best.)

> Aditya

-Paul
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] ConTeXt support for Nova text editor (MacOS)

2023-11-11 Thread Paul Mazaitis


Hello, list!

I'm working on a ConTeXt language extension for the Nova editor by Panic 
software (https://nova.app/).

The extension is here:

https://github.com/pmazaitis/nova-context/releases/tag/0.6.0

...currently in beta, but fairly functional.

This version of the extension supports:

* Syntax Highlighting
* Folding for (most) environments
* Navigating by Symbols (headings: chapter, section, etc.)
* Spell-checking of body text and section titles
* Managing builds with Nova's tasks system

(As an aside, this extension uses an updated version of the ConTeXt tree-sitter 
parser [https://github.com/pmazaitis/tree-sitter-context] that can now 
recognize (most) environments and use them to parse out the document hierarchy.)

Limitations at the moment: not all environments are supported (only those with 
\start and \stop commands right now), and the extension only supports English.

Happy for any bug reports, etc.,

-Paul
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


Re: [NTG-context] [m-database] How to properly add module arguments?

2023-03-04 Thread Paul Mazaitis via ntg-context
On 26 Feb 2023, at 5:36, Max Chernoff via ntg-context wrote:

> I'd recommend completely ignoring the interface i-*.xml files. They
> don't do anything particularly useful for a third-party module.

It's good to know there's no dependency there (but I do like to keep things 
updated :) ).

> This line is your issue. Inside \unprotect...\protect, "!" is treated as
> a letter, so you're trying to expand the value of the macro
> "\c!skipheader". The problem is that that macro isn't defined anywhere.

A ha! Many thanks; I've gotten it working, along with this hint:

>   skipheader=\v!no, % <-- HERE

...so I think I'm okay.

(I don't mind doing the translations, but that's probably outside the scope of 
this project.)

> Backing up a little further, the \c!... commands are all string
> *C*onstants. If you see a command with a name like \c!blah, it almost
> certain expands to exactly the string "blah". Why is this useful? Well,
> if you run ConTeXt in another language, then the \c!... commands will
> instead contain that string but in the other language. So something like
> \c!left would be "left" in English, "gauche" in French, "links" in
> German, "vlevo" in Czech, etc.

This, too, was useful - as per the Scratch Variables page in the System Macros 
section of the garden 
(https://wiki.contextgarden.net/System_Macros/Scratch_Variables) I've updated 
my tree-sitter parser (https://github.com/pmazaitis/tree-sitter-context_en) to 
put these in the parse tree; I don't know how useful that is, but it seems to 
me that being able to call these out might help.

> As a more general suggestion, it is usually a really bad idea to modify the
> standard ConTeXt files since any changes will be overwritten on updates.
> Probably the best solution is to make a new file called "t-xdatabase.mkiv"
> stored in your texmf-local/, start the file with "\usemodule[database]"
> then add any changes after that. Or, just copy and paste the original file
> into your new file. (Maybe you were doing this already though)

Oh! Indeed: my working ConTeXt environment is under version control;  
experimental nonsense like this gets safely tucked away in a branch (my 
thinking is that I want to try to change as few new variables as possible - 
still learning!).

> Hope this helps,

Absolutely; many thanks!

> -- Max

-Paul

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


[NTG-context] [m-database] How to properly add module arguments?

2023-02-25 Thread Paul Mazaitis via ntg-context
Dear list,

## The Incredibly Short Version

I am trying to extend m-database, and I want to add a flag to control behavior. 
I can get it to work, but I am having trouble understanding how to do it 
properly.

## The Short Version

I have a project where I wish to incorporate many CSV files as Natural Tables.

I want to keep the headers in the CSV files so they're useful in other contexts.

The `m-database` module doesn't have a feature to suppress the header row, from 
what I can see.

(I know `handlecsv` can do this, but I'm having troubles with that; if the 
`m-database` line of inquiry doesn't work out, I'll go back it, but I figure 
I'll focus on this solution for now.)

Looking at the module sources, I can implement the functionality I need in the 
Lua part of the module, but:

I seem to only be able to bodge in additional arguments for the commands in the 
module.

On first try, I got the error: `tex error   > tex error on line 30 in file 
/Users/pmazaitis/Opt/context/tex/texmf-context/tex/context/modules/mkiv/m-databaseplus.mkiv:
 ! Undefined control sequence`

And then: `The control sequence at the end of the top line of your error 
message was never
\def'ed.`

Looking at the docs points me to a solution using  `\def`, but it's not clear 
to me how that's working in the case of the database module (the database 
module seems to be initializing these values someplace else?).

If I \def the settings variable in m-database.mkiv,  I can get it to work, but 
I don't think that's the correct way to go about this.

Question: how do I properly define new module arguments for the database module?

## The Long Version, With MWE

### Files Associated With the MWE

Apologies for all of the file inclusions, but I want to be complete.


Here's the .csv file I'm using for the MWE:

--- begin database-mwe.csv ---

Ref. No.,Part No.,Description,Remarks
,RD14C82E000J,Carbon 000흮 ±5% 1/4W,

---  end database-mwe.csv  ---

Some notes on database-mwe.csv:

I'd like to keep the header row in place to make this file useful for other 
tools.

These are lists of electronic parts, so I'd like to include uppercase omega, 
lower case mu, and percent sign characters in the CSV file.


Here's the .tex file I'm using for the MWE:

--- begin database-mwe.tex ---

\usemodule[database]

\setupdatabase[quotechar={"},separator={,}]

\defineseparatedlist
  [PartsTable]
  [separator=comma,left=\bTD,right=\eTD,first=\bTR,last=\eTR,before={
\bTABLE[split=repeat,option=stretch]
  \bTABLEhead
  \bTR
\bTH Ref. No. \eTH \bTH Part No. \eTH \bTH Description \eTH \bTH Remarks 
\eTH
  \eTR
  \eTABLEhead
  \bTABLEbody
   },
   after={
  \eTABLEbody
  \eTABLE
   }]

\starttext

test

\startasciimode
\processdatabasefile[PartsTable][parts_list-test.csv]
\stopasciimode

\stoptext

---  end database-mwe.tex  ---

Some notes on database-mwe.tex:

This actually works pretty well with the distributed m-database module!

Some of these lists are quite long, so I want to use a TABLEhead to replicate 
the headings at the top of a new page. I don't think there's a way to automate 
this with `m-database`, so I'm okay with hard-coding the headers. This does 
mean I get a double header row at the top of the table. I want to suppress the 
header row; I'd like to implement this behavior in the module behind a switch.

(I'm using the `asciimode` environment to dodge problems with unescaped `%` 
characters and Greek letters. I tried adding the startasciimode/stopasciimode 
commands to various keys in the \defineseparatedlist command, but I didn't get 
anywhere with it - I got errors. A problem for another time...)

I think I've got a good handle on how to do this in Lua, but I'm struggling 
with what to add to the switch appropriately.

In attempting to add a switch, I tried the following.

Based off of https://wiki.contextgarden.net/Modules#Modules_writing_guidelines,
I added a stanza to the appropriate interface file:

--- begin stanza added to i-database.xml ---






---  end stanza added to i-database.xml  ---

I modeled that after the stanza for the argument `strip`. I think that's the 
only thing I need to do in the interface file.

Changing the i-database.xml file does not break the build.

However, as soon as I add the skipheader argument to the m-database.mkiv file:

--- begin definition in m-database.mkiv ---

\setupdatabase
  [\c!separator={,},
   \c!quotechar=,
   \c!commentchar=,
   \c!strip=\v!no,
   \c!skipheader=\v!no, % <- Added, following the pattern with strip
   \c!before=,
   \c!after=,
   \c!first=,
   \c!last=,
   \c!left=,
   \c!right=]

---  end definition in m-database.mkiv  ---


...the build fails (with the error from the Short Version section).

If I then add the following \def to m-database.mkiv before the \setupdatabase 
command:

\def\c!skipheader {skipheader}

...the build succeeds! I can now pass that settings value to m-database.lua and 
use it 

[NTG-context] New Tool: tree-sitter-context_en Parser

2022-04-22 Thread Paul Mazaitis via ntg-context

Hi, everyone!

I've been working on an updated tree-sitter parser for the ConTeXt file format.

The parser has pretty good support for parsing a ConTeXt .tex file and 
producing a syntax tree for that file (and, optionally, highlighting).

The parser also has support for using appropriate parsers for areas of the 
document that embed other languages or formats. For example: a tree-sitter 
parser for Lua code already exists, and this parser can call out to that parser 
to handle any properly demarcated Lua code (\startluacode ... \stopluacode) 
present in a ConTeXt document. A full list of supported inclusions (with or 
without available parsers), along with additional notes, are in the Garden:

https://wiki.contextgarden.net/pm39_tree_sitter_parser

...and the repo for the tree-sitter-context_en parser itself is here:

https://github.com/pmazaitis/tree-sitter-context_en

Tree-sitter parsers support lots of language bindings with which to build 
tools; I've put together a very badly engineered format-aware spellchecker as a 
demo (may have trouble with Windows EOL encoding):

https://github.com/pmazaitis/contextpyspell-demo

Please, please do not use this demo in production. :)

A massive caveat regarding OS support:

So far this has been all developed and tested under MacOS, and seems to work 
pretty well in that environment. I've also tested running the parser on Linux 
(Ubuntu), and that was also fairly straight forward. In either case, Rust and a 
C compiler are required for directly using the parser  (and you'll also need 
node/npm to rebuild the grammar itself, if you want to make any changes).

I have a Windows 10 machine, and the development environment on it is a 
complete puzzle to me. I am learning, but: running this parser under Windows 
isn't something I've been able to get working. If you have Windows development 
experience, I'd be happy for any advice on how to support this software on that 
platform.

A second, massive caveat for Windows support: this parser should be agnostic 
about how line endings are encoded, and I've done minimal testing, but it 
should have a lot more.

Looking forward:

- This parser is...lightly tested. (More testing of more domains would be 
helpful!)
- This tooling should be useful for small utilities: a linter, a formatter, a 
better spellchecker?
- This tooling should be useful for LSP support?

Onward!

-Paul
___
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] Widgets: Any good examples for developing JS-enabled PDFs that calculate?

2019-11-19 Thread Paul Mazaitis

On 18 Nov 2019, at 3:48, Hans Hagen wrote:


Here's something to play with ... note the Number conversion!


A ha! Many thanks (for some reason I didn't get this email until just 
now); I'll try to tackle it this way and see what I can make work.



\usemodule[fields]

\starttext

[...]

\stoptext


-Paul

___
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] Widgets: Any good examples for developing JS-enabled PDFs that calculate?

2019-11-19 Thread Paul Mazaitis


Some further progress!

On 18 Nov 2019, at 13:56, Hans Hagen wrote:
the problem with calculate is that there are also settings related to 
it (plus some built-in addition stuff, at least that's what i see in 
the viewer preferences and such, which is likely to interfere)


From what I've been able to gather, there are three ways to get 
JavaScript into a PDF using Acrobat (or other software that uses the 
Acrobat way of doing things):


 - Predefined Calculations (use a UI to build a simple recipe)

 - Calculations built with Simplified Field Notation (operators and 
field names - I don't understand this one too well)


 - Custom Calculation Script (Acrobat JavaScript)

I _think_ these are relatively exclusive: I don't believe there's 
anything about the first two systems that interferes with the third (and 
I'm not sure how the UI would work for the first two in an LMTX context, 
anyway?).



(and calculate doens't seem to be called at all)


After digging around in the spec and comparing output, it looks like 
adding the CO (Calculation Order, PDF Spec 12.7.2) key and an array:


  /CO [15 0 R]

...to the AcroForm object is enough for the indicated field(s) to react 
to the internal calculation event.


The way I tested this is I inserted the above stanza (with the 
appropriate object ID) into the uncompressed LMTX PDF, and that was all 
it took for the calculate JS to start working for the total field.


(I likely wrecked the xref table in the process, but the PDF was still 
functional...)


I then built a form with a chained calculation (a second field that 
doubled the total field) and ended up with a CO entry like this:


/CO [13 0 R 19 0 R]

...and I believe that the order of the objects in this array is how the 
calculation precedence is determined.


So! This is bigger than just adding the CO array to enable calculations; 
there needs to be enough of an interface to also indicate calculation 
order somehow in the .tex file.


I'd love to have this as a feature, but I will cheerfully defer if this 
has become ridiculous...


-Paul





___
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] Widgets: Any good examples for developing JS-enabled PDFs that calculate?

2019-11-17 Thread Paul Mazaitis


Hi everyone,

First: apologies for the long email; this got a little complicated.

Summary: there may be a bug in setting up calculate field for widgets?

Parts:

 - calculator.tex
 - A M(N)WE
 - The MWE Only Sort of Works

# calculator.tex

On 13 Nov 2019, at 10:26, Pablo Rodriguez wrote:


Hi Paul,



I wonder whether
tex/texmf-context/doc/context/examples/calculator/calculator.tex from
the ConTeXt Suite might be what you look for.

Just in case it helps,


It does (and is quite something!); it's not quite what I need, though. 
I'd like to take advantage of the internal _calculate_ event when a 
field updates - the calculator.tex PDF appears to be entirely 
programmatically event driven?


(Which could certainly work for my application, but I want to try to 
keep this as simple for the user as possible.)



Pablo


# A M(N)WE

Here's a Minimal Working Example, with some caveats:

--- begin MWE ---

\usemodule[fields]

\starttext

\setupinteraction [state=start]

\startJScode{tallyUp}
  var a_fld = this.getField("A");
  var b_fld = this.getField("B");
  event.value = a_fld.value + b_fld.value;
\stopJScode

\setupfield[numField][reset,horizontal]
[height=2pc,rulethickness=1pt,framecolor=lightgrey]

\setupfield[totalField][reset,horizontal]
[
height=2pc,
rulethickness=1pt,
framecolor=lightgrey,
option=readonly,
calculate=JS(tallyUp),
]

\definefield[A][line][numField][]
\definefield[B][line][numField][]

\definefield[Total][line][totalField][]

A: \field[A]

B: \field[B]

\blank[big]

Total: \field[Total]

\stoptext

---  end MWE  ---

The idea here is that the resulting PDF will have three fields: A, B, 
and Total. Whenever a value is placed in A and/or B, on blur the value 
in Total will get updated automatically.


# The MWE Only Sort of Works

Things that are working:

 - I can put values in A and B
 - I can't directly manipulate Total (read-only seems to be working 
fine)


Thing that doesn't work:

 - Total does not get automatically updated (for _any_ of the 
JS-enabled/tolerant PDF viewers I have.)



Upon closer inspection of the resulting PDF with PDF Studio 2019 (I 
don't have Acrobat Pro at the moment), I can confirm some things:


 - The appropriate JavaScript is placed in the form, as a custom 
calculation script for the Total field.


	(This leads me to believe that the calculate= key in \setupfield is 
working.)


 - If I try to check the calculation order of the PDF, PDF Studio 2019 
gives me the warning: "There are no fields with calculations."


(So maybe there's a magic bit that needs to get flipped somewhere?)

 - If I use PDF Studio 2019 to change the calculate attribute on the 
field Total to something else, save, and then revert the calculate 
attribute _back_ to the custom script as supplied from the .tex file and 
save, the Total field starts working as expected, and I can see the 
field in the calculation ordering.


If I can get the PDF to work in PDF Studio 2019, I can confirm that it 
also works in all of the other JS-enabled/tolerant PDF viewers I have.


# Summary

It looks like the appropriate JavaScript script is getting attached to 
the field for a calculate event, but is not being run? Or something?



Anyway, that's as far as I've gotten. Any insight or assistance is 
appreciated; I'll see if I can make more progress.


Thanks!

-Paul

___
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] [Widgets] Any good examples for developing JS-enabled PDFs that calculate?

2019-11-07 Thread Paul Mazaitis


Hi everyone,

My goal is to have a PDF that

 - allows users to input numeric information in various fields,
 - makes calculations on the data in those fields,
 - ...and reports that information somewhere in the PDF.

It seems that the widget support could handle this, but I'm struggling 
to understand how the pieces go together; does anyone have an example of 
this use case I could puzzle over?


Many thanks!

-Paul
___
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] Head sections automatically marked for conditional text

2017-08-31 Thread Paul Mazaitis


The short version:

I'd like to set up a context document with multiple user-defined heads, 
such that they can be conditionally compiled and/or altered. It seems 
that modes are what I want, but I'm having trouble figuring out how to 
automatically set up a particular section to be wrapped in a particular 
mode (if that makes any sense at all).


Is this possible?

The long version:

What I think I want is something like:

--- begin foo.tex ---

\startenvironment foo

\definemode[showexamples][keep]

% Can I add some magic here in the following setup to automagically
% wrap these sections with commands to start and stop a particular mode?
\definehead[example][subject][style=\bfc]

---  end foo.tex  ---

--- begin bar.tex ---

\environment foo

\enablemode[showexamples]

\starttext

\startexample[title={I'd like to be able to use modes to enable or 
disable this section}]


I'd like to have a mode to conditionally show all of the {\tt example} 
sections (without affecting other content, etc.).


\stopexample

\stoptext

---  end bar.tex  ---

The added difficulty here is that I need three kinds of modes (A, B, And 
C) with the need to support changing the layout, etc. based on what 
modes are enabled.


I've gotten this to work by including \startmode[example] and \stopmode 
commands in the document, but I'd love to find a way to have this happen 
automatically by some clever setups for user defined heads, as above. (I 
tried playing around with before= and after=, with disastrous 
results...)


I've worked through the discussion about using blocks against 
enumerations, found here:


http://www.mail-archive.com/ntg-context@ntg.nl/msg83818.html

...but I'm hoping that there's a simpler solution (without the external 
file, etc.)


Is there a way to do this within the current framework, or should I be 
wrapping all of this in new commands? Or something else entirely?


Thanks!

 -Paul
___
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] [Tools] v1.1 of ConTeXt BBLM for BBEdit

2015-07-21 Thread Paul Mazaitis


I've released a version of the ConTeXt BBLM that better manages files 
referenced by environment or project structure commands.


The language module populates the BBEdit Includes Menu with files 
referenced by:


\environment
\project
\product
\component

The language module begins looking for any file matches in the parent 
directory, and then searches recursively downward in the file system for 
any matching files.


Available here:

https://github.com/pmazaitis/ConTeXtBBLM/releases/tag/v1.1.0

Thanks!

-Paul
___
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

[NTG-context] [Tools] ConTeXt Language Module for BBEdit, v1.0

2015-07-11 Thread Paul Mazaitis


Hello list!

I am pleased to announce v1.0 of ConTeXtBBLM, a BBEdit Language Module 
to support ConTeXt. This language module is built for BBEdit v11, and 
supports MkIV-style sectioning for navigation. A brief list of features:


 * Navigation by heading titles (including titles from user-defined 
heads).

 * Navigation by callouts (TODO:, FIXME:, etc.) in comments.
 * Navigation to files referenced by the \environment command.
 * Folding text within balanced \start and \stop commands.
 * Syntax coloring of text, comments, commands, command parameters, and 
command options.

 * Keyword support.
 * Command completion.

More information and sources can be found at: 
https://github.com/pmazaitis/ConTeXtBBLM.


...and the release is available here: 
https://github.com/pmazaitis/ConTeXtBBLM/releases/tag/v1.0


...or here: http://paul.mazaitis.org/assets/ConTeXt-bblm-v1.0.zip

Some notes:

This language module could (always!) use more testing. Bug reports 
cheerfully welcome!


The language module tries to be clever about recovering from mis-matched 
/startcommand and /stopcommand pairs when generating folds. This will 
likely cause surprising behavior if the offending mis-match involves a 
user-defined head command.


For keyword support, the module loads the keyword set from the file 
context-keywords.txt in the Resources directory of the language module 
plugin. At the moment, this file is empty, and can be customized as 
needed (plain text, one keyword per line).


For command completion, the language module loads a command set from the 
text file context-commands-en.txt in the Resources directory of the 
language module plugin. I'd like to use the output of:


mtxrun -script interface --text

...as a drop-in for this text file, but it appears the command list this 
script generates is incomplete.


Hans or Taco (or anyone?): are there plans to update mtxrun to generate 
the current complete interface when using this script?


Thanks!

-Paul

___
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

[NTG-context] BBEdit Language Module for ConTeXt

2015-06-16 Thread Paul Mazaitis


Hello, list!

I've been working on a BBEdit language module to support editing ConTeXt 
files:


https://github.com/pmazaitis/ConTeXtBBLM

...with binary releases here:

https://github.com/pmazaitis/ConTeXtBBLM/releases

If there are other BBEdit users here with interest, I'd appreciate 
feedback. Notes on feature gaps (math?), outright bugs, improvements, 
and/or fiddly details are all welcome.


Thanks!

-Paul
___
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

[NTG-context] Updated XML interface file?

2015-06-01 Thread Paul Mazaitis


Hello, list!

At one point, it looks like there was an (automatically?) generated XML 
file of the ConTeXt user interface; the most recent version of this that 
I can find is from 2006, and appears (the English version, anyway) to be 
out of date.


Is there a more recent version of this available? And, if not: could 
there be?


Thanks!

-Paul
___
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] Updated XML interface file?

2015-06-01 Thread Paul Mazaitis


Hi Pablo,

On 1 Jun 2015, at 11:46, Pablo Rodriguez wrote:


Hi Paul,



do you mean http://www.pragma-ade.com/general/qrcs/setup-en.pdf?


The PDF command reference is good, but I'm looking for something that's 
easier to parse with software.



If this is not what you want, could you provide a link to the newest
version of the document you are searching?


The particular file I'm using at the moment is included as part of the 
standalone distribution:


distribution root/tex/texmf-context/tex/context/interface/cont-en.xml

(I'd be interested in an updated keys-en.xml as well, if that's a 
possible thing.)


Thanks!


Pablo


-Paul



--
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___