summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Master/texmf-dist/doc/context/third/filter/VERSION2
-rw-r--r--Master/texmf-dist/doc/context/third/filter/filter.txt32
-rw-r--r--Master/texmf-dist/tex/context/third/filter/t-filter.mkiv22
-rw-r--r--Master/texmf-dist/tex/context/third/filter/t-module-catcodes.mkii (renamed from Master/texmf-dist/tex/context/third/filter/t-module-catcodes.tex)0
-rw-r--r--Master/texmf-dist/tex/context/third/filter/t-module-catcodes.mkiv89
5 files changed, 134 insertions, 11 deletions
diff --git a/Master/texmf-dist/doc/context/third/filter/VERSION b/Master/texmf-dist/doc/context/third/filter/VERSION
index 6c676b7a0c1..2ccc03a5fa1 100644
--- a/Master/texmf-dist/doc/context/third/filter/VERSION
+++ b/Master/texmf-dist/doc/context/third/filter/VERSION
@@ -1 +1 @@
-2017.07.29
+2018.04.17
diff --git a/Master/texmf-dist/doc/context/third/filter/filter.txt b/Master/texmf-dist/doc/context/third/filter/filter.txt
index 67b94117caf..fd7ccee2255 100644
--- a/Master/texmf-dist/doc/context/third/filter/filter.txt
+++ b/Master/texmf-dist/doc/context/third/filter/filter.txt
@@ -1,5 +1,5 @@
-[![Stories in Ready](https://badge.waffle.io/adityam/filter.png?label=ready&title=Ready)](https://waffle.io/adityam/filter)
-=======
+[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active)
+===
The filter module
=================
@@ -282,6 +282,32 @@ sets `\endlinechar=\minusone`; therefore no space is inserted when the file is
read. `location=text` does not change `\endlinechar`. Therefore a space is
inserted after the file is read.
+Stripping leading whitespace (MkIV only)
+----------------------------------------
+
+By default, the leading whitespace is removed before the content of the filter
+environment are saved to an external file. This is useful because one can then
+indent the TeX code without worring how the leading whitespaces will be
+interpretted by the filter. For example,
+
+ \startitemize
+ \item
+ \startmarkdown
+ This is treated as regular text. If the leading spaces were not
+ stripped, this would be treated as a code block in markdown.
+ \stopmarkdown
+ \stopitemize
+
+If you want to keep the leading whitespace, you can set
+
+ \defineexternalfilter
+ [...]
+ [....
+ strip=no,
+ ...]
+
+(The default value is `yes`).
+
Names of temporary files
------------------------
@@ -975,3 +1001,5 @@ Version History
- Support for `write=no` and `cacheoption=...`.
- **2013.03.31**
- Support for `left` and `right`
+- **2018-04-17**
+ - Support for `strip=yes` (which is now default).
diff --git a/Master/texmf-dist/tex/context/third/filter/t-filter.mkiv b/Master/texmf-dist/tex/context/third/filter/t-filter.mkiv
index 255581f41ea..71ff0d72b64 100644
--- a/Master/texmf-dist/tex/context/third/filter/t-filter.mkiv
+++ b/Master/texmf-dist/tex/context/third/filter/t-filter.mkiv
@@ -1,6 +1,6 @@
%D \module
%D [ file=t-filter,
-%D version=2016.03.02,
+%D version=2018.04.17,
%D title=\CONTEXT\ User Module,
%D subtitle=Filter,
%D author=Aditya Mahajan,
@@ -9,15 +9,12 @@
%D email=adityam <at> ieee <dot> org,
%D license=Simplified BSD License]
-\writestatus{loading}{Filter (ver: 2016.03.02)}
+\writestatus{loading}{Filter (ver: 2018.04.17)}
\startmodule [filter]
\usemodule [module-catcodes]
\unprotect
-% For backward compatibility
-\ifx\grabbufferdata\undefined \let\grabbufferdata \dostartbuffer \fi
-
% \f!temporaryextension was removed from the core in July 2012.
\ifx\f!temporaryextension\undefined \def\f!temporaryextension{tmp} \fi
@@ -65,7 +62,7 @@
{\ifcsname\externalfilter@count\endcsname \else
\expandafter\newcounter\csname\externalfilter@count\endcsname\fi}%
\setuevalue{\e!start\currentexternalfilter}{\externalfilter@start[\currentexternalfilter]}%
- \setuvalue {\e!stop\currentexternalfilter}{\externalfilter@process_filter}%
+ \setuvalue {\e!stop\currentexternalfilter}{}%
\setuevalue{process\currentexternalfilter file}{\externalfilter@process_file[\currentexternalfilter]}%
\setuevalue{process\currentexternalfilter buffer}{\externalfilter@process_buffer[\currentexternalfilter]}%
\setuevalue{inline\currentexternalfilter}{\externalfilter@inline[\currentexternalfilter]}%
@@ -133,9 +130,17 @@
\externalfilter@set_filenames
% Capture the contents of the buffer
- \grabbufferdata[\externalfilter@buffer_name][\e!start#1][\e!stop#1]
+ \edef\p_strip{\getvalue{\externalfilter@id-\c!strip-\externalfilterparameter\c!strip}}
+ \buff_pickup{\externalfilter@buffer_name}{\e!start#1}{\e!stop#1}{}{\externalfilter@process_filter}{\p_strip}
\stoptexdefinition
+\setvalue{\externalfilter@id-\c!strip-}{\zerocount}
+\setvalue{\externalfilter@id-\c!strip-\v!off}{\zerocount}
+\setvalue{\externalfilter@id-\c!strip-\v!on}{\plusone}
+
+\setvalue{\externalfilter@id-\c!strip-\v!no}{\zerocount}
+\setvalue{\externalfilter@id-\c!strip-\v!yes}{\plusone}
+
\unexpanded\def\externalfilter@process_file
{\dodoubleargument\externalfilter@process_file_indeed}
@@ -342,7 +347,7 @@
%D So, we define a macro that is based on `\readfile`.
\def\externalfilter@any_filename#1%
- {\ctxcommand{getreadfilename("any",".","#1")}}
+ {\clf_getreadfilename{any}{.}{#1}}
%D \subsubject {Set file names}
%D
@@ -511,6 +516,7 @@
\c!cache=\externalfilterparameter\c!continue, % for backward compatibility
\c!cache\c!option=,
\c!read=\v!yes,
+ \c!strip=\v!yes,
\c!readcommand=\ReadFile,
\c!directory=,
\c!purge=\v!yes,
diff --git a/Master/texmf-dist/tex/context/third/filter/t-module-catcodes.tex b/Master/texmf-dist/tex/context/third/filter/t-module-catcodes.mkii
index 052c9fca5b3..052c9fca5b3 100644
--- a/Master/texmf-dist/tex/context/third/filter/t-module-catcodes.tex
+++ b/Master/texmf-dist/tex/context/third/filter/t-module-catcodes.mkii
diff --git a/Master/texmf-dist/tex/context/third/filter/t-module-catcodes.mkiv b/Master/texmf-dist/tex/context/third/filter/t-module-catcodes.mkiv
new file mode 100644
index 00000000000..60e25cc05ed
--- /dev/null
+++ b/Master/texmf-dist/tex/context/third/filter/t-module-catcodes.mkiv
@@ -0,0 +1,89 @@
+%D \module
+%D [ file=t-module-catcodes,
+%D version=2018.04.16,
+%D title=\CONTEXT\ User Module,
+%D subtitle=Module Catcodes,
+%D author=Aditya Mahajan,
+%D date=\currentdate,
+%D copyright=Aditya Mahajan,
+%D email=adityam <at> ieee <dot> org,
+%D license=Simplified BSD License]
+%D
+%D MkII and MkIV use different names and values for commonly used catcode
+%D tables. So, I define a private copy of the catcode tables that are needed
+%D by the filter and vim modules.
+
+
+\writestatus{loading}{Module Catcodes (ver: 2018.04.16)}
+
+\startmodule [module-catcodes]
+
+\newcatcodetable \modulecatcodes
+\startcatcodetable \modulecatcodes % same as \prtcatcodes
+ \catcode\tabasciicode \spacecatcode
+ \catcode\endoflineasciicode \endoflinecatcode
+ \catcode\formfeedasciicode \endoflinecatcode
+ \catcode\spaceasciicode \spacecatcode
+ \catcode\endoffileasciicode \ignorecatcode
+ \catcode\circumflexasciicode\superscriptcatcode
+% \catcode\underscoreasciicode\subscriptcatcode
+ \catcode\underscoreasciicode\lettercatcode
+ \catcode\ampersandasciicode \alignmentcatcode
+ \catcode\backslashasciicode \escapecatcode
+ \catcode\leftbraceasciicode \begingroupcatcode
+ \catcode\rightbraceasciicode\endgroupcatcode
+ \catcode\dollarasciicode \mathshiftcatcode
+ \catcode\hashasciicode \parametercatcode
+ \catcode\commentasciicode \commentcatcode
+ \catcode`\@ \lettercatcode
+ \catcode`\! \lettercatcode
+ \catcode`\? \lettercatcode
+ \catcode\tildeasciicode \activecatcode
+ \catcode\barasciicode \activecatcode
+\stopcatcodetable
+
+\def\unprotectmodulecatcodes
+ {\pushcatcodetable
+ \setcatcodetable\modulecatcodes}
+
+\def\protectmodulecatcodes
+ {\popcatcodetable}
+
+\unprotectmodulecatcodes
+
+%D The following catcode tables are used for reading
+%D and writing to files
+
+\newcatcodetable \externalfilter@read_catcodes
+\newcatcodetable \externalfilter@minimal_catcodes
+\newcatcodetable \externalfilter@verb_catcodes
+
+\startcatcodetable \externalfilter@read_catcodes % same as typcatcodesa
+ \catcode\tabasciicode = \othercatcode
+ \catcode\endoflineasciicode = \othercatcode
+ \catcode\formfeedasciicode = \othercatcode
+ \catcode\spaceasciicode = \othercatcode
+ \catcode\endoffileasciicode = \othercatcode
+ \catcode\leftbraceasciicode = \begingroupcatcode
+ \catcode\rightbraceasciicode = \endgroupcatcode
+\stopcatcodetable
+
+\startcatcodetable \externalfilter@minimal_catcodes % for reading t-vim output
+ \catcode\backslashasciicode = \escapecatcode
+ \catcode\leftbraceasciicode = \begingroupcatcode
+ \catcode\rightbraceasciicode = \endgroupcatcode
+ \catcode\endoflineasciicode = \activecatcode
+ \catcode\formfeedasciicode = \othercatcode
+ \catcode\spaceasciicode = \activecatcode
+\stopcatcodetable
+
+\startcatcodetable \externalfilter@verb_catcodes % same as vrbcatcodes
+ \catcode\tabasciicode = \othercatcode
+ \catcode\endoflineasciicode = \othercatcode
+ \catcode\formfeedasciicode = \othercatcode
+ \catcode\spaceasciicode = \othercatcode
+ \catcode\endoffileasciicode = \othercatcode
+\stopcatcodetable
+
+\protectmodulecatcodes
+\stopmodule