summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/mlib-pps.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2019-08-11 20:47:52 +0200
committerContext Git Mirror Bot <phg@phi-gamma.net>2019-08-11 20:47:52 +0200
commitd167e9ccebdae0d0081d3c8abd95a440d96a867c (patch)
treef64ebc6ceb5ca12366d4ee5c9c02ca2589478eac /tex/context/base/mkiv/mlib-pps.lua
parent76a1861b8ff7c2befbc41270833a4a0919c93c30 (diff)
downloadcontext-d167e9ccebdae0d0081d3c8abd95a440d96a867c.tar.gz
2019-08-11 20:11:00
Diffstat (limited to 'tex/context/base/mkiv/mlib-pps.lua')
-rw-r--r--tex/context/base/mkiv/mlib-pps.lua30
1 files changed, 27 insertions, 3 deletions
diff --git a/tex/context/base/mkiv/mlib-pps.lua b/tex/context/base/mkiv/mlib-pps.lua
index 62a6de16b..1457020ef 100644
--- a/tex/context/base/mkiv/mlib-pps.lua
+++ b/tex/context/base/mkiv/mlib-pps.lua
@@ -850,6 +850,8 @@ local tx_reset, tx_process do
end
end
+ local madetext = nil
+
function mp.mf_some_text(index,str)
mp_target = index
mp_index = index
@@ -864,24 +866,46 @@ local tx_reset, tx_process do
madetext = nil
end
- local madetext = nil
-
function mp.mf_made_text(index)
mp.mf_some_text(index,madetext)
end
+ -- This is a bit messy. In regular metapost it's a kind of immediate replacement
+ -- so embedded btex ... etex is not really working as one would expect. We now have
+ -- a mix: it's immediate when we are at the outer level (rawmadetext) and indirect
+ -- (with the danger of stuff that doesn't work well in strings) when we are for
+ -- instance in a macro definition (rawtextext (pass back string)) ... of course one
+ -- should use textext so this is just a catch. When not in lmtx it's never immediate.
+
+ local reported = false
+ local awayswrap = CONTEXTLMTXMODE <= 1
+
function metapost.maketext(s,mode)
+ if not reported then
+ reported = true
+ report_metapost("use 'textext(.....)' instead of 'btex ..... etex'")
+ end
if mode and mode == 1 then
if trace_btexetex then
report_metapost("ignoring verbatimtex: [[%s]]",s)
end
+ elseif alwayswrap then
+ if trace_btexetex then
+ report_metapost("rewrapping btex ... etex [[%s]]",s)
+ end
+ return 'rawtextext("' .. gsub(s,'"','"&ditto&"') .. '")' -- nullpicture
+ elseif metapost.currentmpxstatus() ~= 0 then
+ if trace_btexetex then
+ report_metapost("rewrapping btex ... etex at the outer level [[%s]]",s)
+ end
+ return 'rawtextext("' .. gsub(s,'"','"&ditto&"') .. '")' -- nullpicture
else
if trace_btexetex then
report_metapost("handling btex ... etex: [[%s]]",s)
end
-- madetext = utilities.strings.collapse(s)
madetext = s
- return "rawmadetext"
+ return "rawmadetext" -- is assuming immediate processing
end
end