texlive[47530] Master/texmf-dist: context-filter (18apr18)

commits+karl at tug.org commits+karl at tug.org
Tue May 1 19:33:41 CEST 2018


Revision: 47530
          http://tug.org/svn/texlive?view=revision&revision=47530
Author:   karl
Date:     2018-05-01 19:33:40 +0200 (Tue, 01 May 2018)
Log Message:
-----------
context-filter (18apr18)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/context/third/filter/VERSION
    trunk/Master/texmf-dist/doc/context/third/filter/filter.txt
    trunk/Master/texmf-dist/tex/context/third/filter/t-filter.mkiv

Added Paths:
-----------
    trunk/Master/texmf-dist/tex/context/third/filter/t-module-catcodes.mkii
    trunk/Master/texmf-dist/tex/context/third/filter/t-module-catcodes.mkiv

Removed Paths:
-------------
    trunk/Master/texmf-dist/tex/context/third/filter/t-module-catcodes.tex

Modified: trunk/Master/texmf-dist/doc/context/third/filter/VERSION
===================================================================
--- trunk/Master/texmf-dist/doc/context/third/filter/VERSION	2018-05-01 00:23:24 UTC (rev 47529)
+++ trunk/Master/texmf-dist/doc/context/third/filter/VERSION	2018-05-01 17:33:40 UTC (rev 47530)
@@ -1 +1 @@
-2017.07.29
+2018.04.17

Modified: trunk/Master/texmf-dist/doc/context/third/filter/filter.txt
===================================================================
--- trunk/Master/texmf-dist/doc/context/third/filter/filter.txt	2018-05-01 00:23:24 UTC (rev 47529)
+++ trunk/Master/texmf-dist/doc/context/third/filter/filter.txt	2018-05-01 17:33:40 UTC (rev 47530)
@@ -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 @@
 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 @@
     - 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). 

Modified: trunk/Master/texmf-dist/tex/context/third/filter/t-filter.mkiv
===================================================================
--- trunk/Master/texmf-dist/tex/context/third/filter/t-filter.mkiv	2018-05-01 00:23:24 UTC (rev 47529)
+++ trunk/Master/texmf-dist/tex/context/third/filter/t-filter.mkiv	2018-05-01 17:33:40 UTC (rev 47530)
@@ -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 at count\endcsname \else
           \expandafter\newcounter\csname\externalfilter at count\endcsname\fi}%
     \setuevalue{\e!start\currentexternalfilter}{\externalfilter at start[\currentexternalfilter]}%
-    \setuvalue {\e!stop\currentexternalfilter}{\externalfilter at process_filter}%
+    \setuvalue {\e!stop\currentexternalfilter}{}%
     \setuevalue{process\currentexternalfilter file}{\externalfilter at process_file[\currentexternalfilter]}%
     \setuevalue{process\currentexternalfilter buffer}{\externalfilter at process_buffer[\currentexternalfilter]}%
     \setuevalue{inline\currentexternalfilter}{\externalfilter at inline[\currentexternalfilter]}%
@@ -133,9 +130,17 @@
     \externalfilter at set_filenames
 
     % Capture the contents of the buffer
-    \grabbufferdata[\externalfilter at buffer_name][\e!start#1][\e!stop#1]
+    \edef\p_strip{\getvalue{\externalfilter at id-\c!strip-\externalfilterparameter\c!strip}}
+    \buff_pickup{\externalfilter at buffer_name}{\e!start#1}{\e!stop#1}{}{\externalfilter at process_filter}{\p_strip}
 \stoptexdefinition
 
+\setvalue{\externalfilter at id-\c!strip-}{\zerocount}
+\setvalue{\externalfilter at id-\c!strip-\v!off}{\zerocount}
+\setvalue{\externalfilter at id-\c!strip-\v!on}{\plusone}
+
+\setvalue{\externalfilter at id-\c!strip-\v!no}{\zerocount}
+\setvalue{\externalfilter at id-\c!strip-\v!yes}{\plusone}
+
 \unexpanded\def\externalfilter at process_file
     {\dodoubleargument\externalfilter at process_file_indeed}
 
@@ -342,7 +347,7 @@
 %D So, we define a macro that is based on `\readfile`.
 
 \def\externalfilter at 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,

Added: trunk/Master/texmf-dist/tex/context/third/filter/t-module-catcodes.mkii
===================================================================
--- trunk/Master/texmf-dist/tex/context/third/filter/t-module-catcodes.mkii	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/context/third/filter/t-module-catcodes.mkii	2018-05-01 17:33:40 UTC (rev 47530)
@@ -0,0 +1,101 @@
+%D \module
+%D   [     file=t-module-catcodes,
+%D      version=2011.12.17,
+%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: 2011.12.17)}
+
+\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 at read_catcodes
+\newcatcodetable \externalfilter at minimal_catcodes
+\newcatcodetable \externalfilter at verb_catcodes
+
+\startcatcodetable \externalfilter at 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 at minimal_catcodes % for reading t-vim output
+    \catcode\backslashasciicode  = \escapecatcode
+    \catcode\leftbraceasciicode  = \begingroupcatcode  
+    \catcode\rightbraceasciicode = \endgroupcatcode
+    \catcode\endoflineasciicode  = \activecatcode
+    \catcode\formfeedasciicode   = \activecatcode
+    \catcode\spaceasciicode      = \activecatcode
+\stopcatcodetable 
+
+\startcatcodetable \externalfilter at verb_catcodes % same as vrbcatcodes
+    \catcode\tabasciicode       = \othercatcode
+    \catcode\endoflineasciicode = \othercatcode
+    \catcode\formfeedasciicode  = \othercatcode
+    \catcode\spaceasciicode     = \othercatcode
+    \catcode\endoffileasciicode = \othercatcode
+\stopcatcodetable
+
+
+
+\ifdefined \activeendoflinetoken \else
+    % from catc-ini.mkiv
+    \bgroup
+        \catcode \tabasciicode       \activecatcode  \gdef\activetabtoken      {^^I}
+                                                     \gdef\outputnewlinechar   {^^J}
+        \catcode \formfeedasciicode  \activecatcode  \gdef\activeformfeedtoken {^^L}
+        \catcode \endoflineasciicode \activecatcode  \gdef\activeendoflinetoken{^^M}
+    \egroup
+\fi
+
+\protectmodulecatcodes
+\stopmodule

Added: trunk/Master/texmf-dist/tex/context/third/filter/t-module-catcodes.mkiv
===================================================================
--- trunk/Master/texmf-dist/tex/context/third/filter/t-module-catcodes.mkiv	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/context/third/filter/t-module-catcodes.mkiv	2018-05-01 17:33:40 UTC (rev 47530)
@@ -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 at read_catcodes
+\newcatcodetable \externalfilter at minimal_catcodes
+\newcatcodetable \externalfilter at verb_catcodes
+
+\startcatcodetable \externalfilter at 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 at 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 at verb_catcodes % same as vrbcatcodes
+    \catcode\tabasciicode       = \othercatcode
+    \catcode\endoflineasciicode = \othercatcode
+    \catcode\formfeedasciicode  = \othercatcode
+    \catcode\spaceasciicode     = \othercatcode
+    \catcode\endoffileasciicode = \othercatcode
+\stopcatcodetable
+
+\protectmodulecatcodes
+\stopmodule

Deleted: trunk/Master/texmf-dist/tex/context/third/filter/t-module-catcodes.tex
===================================================================
--- trunk/Master/texmf-dist/tex/context/third/filter/t-module-catcodes.tex	2018-05-01 00:23:24 UTC (rev 47529)
+++ trunk/Master/texmf-dist/tex/context/third/filter/t-module-catcodes.tex	2018-05-01 17:33:40 UTC (rev 47530)
@@ -1,101 +0,0 @@
-%D \module
-%D   [     file=t-module-catcodes,
-%D      version=2011.12.17,
-%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: 2011.12.17)}
-
-\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 at read_catcodes
-\newcatcodetable \externalfilter at minimal_catcodes
-\newcatcodetable \externalfilter at verb_catcodes
-
-\startcatcodetable \externalfilter at 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 at minimal_catcodes % for reading t-vim output
-    \catcode\backslashasciicode  = \escapecatcode
-    \catcode\leftbraceasciicode  = \begingroupcatcode  
-    \catcode\rightbraceasciicode = \endgroupcatcode
-    \catcode\endoflineasciicode  = \activecatcode
-    \catcode\formfeedasciicode   = \activecatcode
-    \catcode\spaceasciicode      = \activecatcode
-\stopcatcodetable 
-
-\startcatcodetable \externalfilter at verb_catcodes % same as vrbcatcodes
-    \catcode\tabasciicode       = \othercatcode
-    \catcode\endoflineasciicode = \othercatcode
-    \catcode\formfeedasciicode  = \othercatcode
-    \catcode\spaceasciicode     = \othercatcode
-    \catcode\endoffileasciicode = \othercatcode
-\stopcatcodetable
-
-
-
-\ifdefined \activeendoflinetoken \else
-    % from catc-ini.mkiv
-    \bgroup
-        \catcode \tabasciicode       \activecatcode  \gdef\activetabtoken      {^^I}
-                                                     \gdef\outputnewlinechar   {^^J}
-        \catcode \formfeedasciicode  \activecatcode  \gdef\activeformfeedtoken {^^L}
-        \catcode \endoflineasciicode \activecatcode  \gdef\activeendoflinetoken{^^M}
-    \egroup
-\fi
-
-\protectmodulecatcodes
-\stopmodule



More information about the tex-live-commits mailing list