adityam / filter

ConTeXt module to process contents of a start-stop environment through an external program
47 stars 10 forks source link

First attempt to get BTEX .. ETEX working #33

Closed adityam closed 4 years ago

adityam commented 4 years ago

This is inspired from pull request #30 and #32 by @hernot, which was a follow up to #29.

Request #30 and #32 scan for \startline, \stopline and \someline in the comments and pass them unchanged to context.

I think that instead of writing such code for specific macros, it is better to implement the general purpose escape mechanism of /BTEX ... /ETEX, which is the standard mechanism for most typing environments in ConTeXt.

This pull request implements a simpler version of /BTEX ... /ETEX mechanism. We first scan the file for /BTEX ... /ETEX, and store the content of in a dictionary. Then, we remove all the /BTEX .. /ETEX from the file (so that they do not effect syntax highlighting), run the 2context.vim script and reinsert the content of /BTEX .. /ETEX at the end of the original lines.

Note that we do not attempt to reinsert the contents of /BTEX .. /ETEX at the correct column. It should be possible to keep track of the column with a little more book-keeping.

adityam commented 4 years ago

The pull request #32 has a better implementation.