summaryrefslogtreecommitdiff
path: root/tex/context/base/strc-flt.mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/strc-flt.mkiv')
-rw-r--r--tex/context/base/strc-flt.mkiv47
1 files changed, 46 insertions, 1 deletions
diff --git a/tex/context/base/strc-flt.mkiv b/tex/context/base/strc-flt.mkiv
index 67023d701..ea52aa82d 100644
--- a/tex/context/base/strc-flt.mkiv
+++ b/tex/context/base/strc-flt.mkiv
@@ -180,6 +180,7 @@
\def\@@bknlines {\floatsharedparameter\c!nlines } % global one
\def\@@bkmargin {\floatsharedparameter\c!margin } % global one
\def\@@bkcache {\floatsharedparameter\c!cache } % global one
+\def\@@bklocation {\floatsharedparameter\c!location }
% float
%
@@ -1960,5 +1961,49 @@
\def\somerightpagefloat{\placesomerightpagefloat}
\def\somefacefloat {\placesomefacefloat}
\def\someslotfloat {\placesomeslotfloat}
-
+
+%D Local floats:
+
+\def\setuplocalfloats
+ {\getparameters[\??lf]}
+
+\setuplocalfloats
+ [%\c!before=\blank,
+ %\c!after=\blank,
+ \c!inbetween=\blank]
+
+\installfloathandler \v!local \somelocalfloat
+
+\initializeboxstack{localfloats}
+
+\newcounter\noflocalfloats
+
+\def\resetlocalfloats
+ {\doglobal\newcounter\noflocalfloats
+ \initializeboxstack{localfloats}}
+
+\def\somelocalfloat[#1]%
+ {\doglobal\increment\noflocalfloats
+ \savebox{localfloats}{\noflocalfloats}{\box\floatbox}}
+
+\def\getlocalfloats
+ {\dorecurse\noflocalfloats
+ {\ifnum\recurselevel=\plusone % 1\relax
+ \getvalue{\??lf\c!before}%
+ \else
+ \getvalue{\??lf\c!inbetween}%
+ \fi
+ \dontleavehmode\hbox{\foundbox{localfloats}\recurselevel}%
+ \ifnum\recurselevel=\noflocalfloats\relax
+ \getvalue{\??lf\c!after}%
+ \fi}}
+
+\def\flushlocalfloats
+ {\getlocalfloats
+ \resetlocalfloats}
+
+\def\getlocalfloat#1{\expanded{\foundbox{localfloats}{\number#1}}}
+
+\def\forcelocalfloats{\let\forcedfloatmethod\v!local}
+
\protect \endinput