CTAN Comprehensive TeX Archive Network

Directory support/npp-for-context

README.md

Notepad++ for Cont: Lexer and Macro Utilities for editing Cont Documents Version 0.98

This package includes

I. A plugin for Notepad++ that implements, for the Cont document processing system, i) a language lexer for semantic highlighting of , Lua, and Cont commands; ii) autocompletion of commands with full support for calltips (set in columns); iii) tagging and insertion of markup and templates, with support for mnemonic keys.

II. A color scheme and two complementary Notepad++ themes: Silver Twilight Hi and Silver Twilight Lo.

Notepad++ for Cont is available here:

https://github.com/luigiScarso/context-npp https://github.com/luigiScarso/context-npp/blob/master/install/Npp-for-C ont.zip

The complete Notepad++ for Cont manual and its sources may be found in the following directory of Npp-for-Cont.zip:

/Npp-for-Cont/doc/npp-context-manual.pdf

It may also be downloaded here: https://github.com/luigiScarso/context-npp/tree/master/doc

Completion of C++ plugin and lexer development was done by the current maintainer, Luigi Scarso (Cont Development Team). Original C++ plugin and lexer development was done by Dr. Jason Wu (Colorado State University). Project vision and development planning (as well as the two themes and color scheme) are by Professor Idris Samawi Hamid (Colorado State University).

The Notepad++ for Cont lexer is strongly influence by the plugin WebEdit by Alexander Iljin: https://sourceforge.net/projects/npp-plugins/files/WebEdit/

This plugin aims to support the editing of Cont documents in a number of ways. This includes some integration with the standalone distribution of Cont.

(For more information on Cont see

http://wiki.contextgarden.net/MainPage http://www.pragma-ade.nl/index.htm .)

This plugin includes a language lexer for semantic highlighting of Cont commands; it also includes a system for tagging and inserting of markup and templates, with support for mnemonic keys.

In its first phase of development, the plugin borrowed some ideas and implementations from other plugins (notably WebEdit); and, from the experience of Professor Hamid, several macros and customizations. In the second phase, a significant part of development was devoted to translating the xml documentation files of Cont (= the English interface files that list and classify commands, see below) into the relevant xml configuration files of Notepad++, and to look for an efficient way to edit a document while minimizing the need to access the documentation. One outcome of this effort is the current autocompletion calltip mechanism, which provides columnar representation of the documentation for each autocompleted command, and equivalent to that provided by setup-en.pdf ("Cont commands EN").

(In a Cont distribution it lies at the end of this path: /tex/texmf-context/doc/context/documents/general/qrcs/setup-en.pdf)

One of the fundamental differences between Cont and traditional programming languages is the huge quantity of keywords (=commands, macros) and parameters (= command arguments) in Cont. Fortunately, nearly all of them are described in the interface files of the standalone distribution, under

tex/texmf-context/tex/context/interface/mkiv.

Here one finds the file context-en.xml, which is constituted by the concatenation of all of the the other interface files.

The build.cmd script, under the /scripts folder of Npp-for-Cont.zip, reads context-en.xml and results in two files, i) /Program Files (x86)/Notepad++/plugins/Config/Cont.xml, which is used by the Cont lexer for Notepad++, and ii) /Program Files (x86)/Notepad++/plugins/APIs/context.xml, which is used by the autocompletion and calltips mechanism. The build.cmd script is a batch script that has to be executed outside Notepad++; under the hood it runs the Python2.7 script commandprimitivesapi.py with the correct command line options; if xmllint.exe is installed it checks to make sure that the files saved are well-formed.

The Npp-for-Cont.zip ships with versions of Config/Cont.xml and APIs/context.xml that take as reference the official Cont that is shipped with the Live 2018 distribution (see https://www.tug.org/texlive/). So the build.cmd script is useful if the user has a different (possibly updated) standalone distribution.

The switches at command line of commandprimitivesapi.py are

usage: commandprimitivesapinew.py -h -i IFCFILE -c CMDFILE -d CHARDEF

optional arguments: -h, –help show this help message and exit -m MTXCMD, –mtxcmd MTXCMD Cont mtxrun program -i IFCFILE, –ifcfile IFCFILE Cont XML interface file -u IFCUFILE, –ifcufile IFCUFILE Cont XML interface user file -c CMDFILE, –cmdfile CMDFILE Cont XML command file -p PRIMFILE, –primfile PRIMFILE Cont primitives.lua script -d CHARDEF, –chardef CHARDEF Cont char-def.lua file -r MACROCHARDEFFILE, –macrochardeffile MACROCHARDEFFILE Cont macro-chardef.lua script

and the build.cmd sets the following

-m mtxrun.exe ^ -c %CTXDIR%textexmf-contexttexcontextbasemkivmult-prm.lua ^ -i %CTXDIR%textexmf-contexttexcontextinterfacemkivcontext-en.xml ^ -d %CTXDIR%textexmf-contexttexcontextbasemkivchar-def.lua

The above assumes that the user sets the correct standalone in %CTXDIR%. It's important to note that this is the standalone also used by the Cont plugin. Usually there is no need to pass –primfile PRIMFILE and –macrochardeffile MACROCHARDEFFILE, because they should be generated by the python script. The option –ifcufile IFCUFILE is useful if the user wants to add the documentation of a set of private macros: in this case it's necessary to know the syntax of that documentation, where the Cont XML command files are taken as reference.

Another component introduced in the plugin is the user's macro window, enabled with Ctrl+'-'. The idea is to offer to the user a way to quickly insert one's most used macros, set and saved under the section entitled Markup in

/Roaming/Notepad++/plugins/config/Cont.ini

The body of the macro to insert must contain a single '|', which is a placeholder for the selected text; the macro can be selected with the mouse or by hitting the Return key. It may also be selected by typing a shortcut key. The Esc key closes the window. For example, if the user needs to insert a macro 'framed', as in

framedframe=on{...}

(where '...' signifies some text to be operated upon by the command), and with a single key 'f' as shortcut, the text to set in Cont.ini is

(f)framedframe=on{|}

Note the full parenthesis that enclose the key shortcut - '(f)' in this case. The user's macros stored in Cont.ini can be edited from Plugin->Cont->Edit Config; once saved it has to be re-loaded with Plugin->Cont->Load Config (no need to restart Notepad++). For the sake of readability, the string '%n' in the body of the text is translated into a newline. The shortcut can be a sequence of A-Za-z0-9 characters, i.e. (d0) and (sst) are valid shortcuts. But for longer keys or keys which require pressing Shift for input, perhaps one will need to set a specific delay: This can be done under the CommandsSetups section of Cont.ini via, e.g.,

usermacro:elapse=500 and or usermacro:elapseshift=600

The time is in milliseconds.

A second mechanism (also adopted from the WebEdit plugin) are tempaltes. Under the section of Cont.ini entitled Templates, there is a list of text strings and their replacements: In the edit field of Notepad++ the user types <text> and Alt-''; <text> is replaced by <replacement>. The rules are the same as for those of the user's macros set under Markup.

Finally, the standard Notepad++ right-click mechanism offers the usual insert text menu. Use

Plugins - Cont - Update Right-click menu

to add one's markup macros.

These ways of inserting markup tags are independent, so it's possible to have several ways to insert the same text. However, it's likely that in a future release this will be simplified or streamlined.

Download the contents of this package in one zip archive (2.4M).

npp-for-context – Cont plugin for Notepad++

This package provides

  1. A plugin for Notepad++ that implements, for the Cont document processing system,
    1. a language lexer for semantic highlighting of , Lua, and Cont commands;
    2. autocompletion of commands with full support for calltips (set in columns);
    3. tagging and insertion of markup and templates, with support for mnemonic keys.
  2. A color scheme and two complementary Notepad++ themes: “Silver Twilight Hi” and “Silver Twilight Lo”.

Packagenpp-for-context
Repositoryhttps://github.com/luigiScarso/context-npp
Version0.98
MaintainerIdris Samawi Hamid
Luigi Scarso
TopicsEditor extensions
...
Guest Book Sitemap Contact Contact Author