summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/typo-lin.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/mkiv/typo-lin.lua')
-rw-r--r--tex/context/base/mkiv/typo-lin.lua94
1 files changed, 58 insertions, 36 deletions
diff --git a/tex/context/base/mkiv/typo-lin.lua b/tex/context/base/mkiv/typo-lin.lua
index 1d523a200..95f9c13fa 100644
--- a/tex/context/base/mkiv/typo-lin.lua
+++ b/tex/context/base/mkiv/typo-lin.lua
@@ -236,53 +236,75 @@ function paragraphs.checkline(n)
return getprop(n,"line") or normalize(n,true)
end
-function paragraphs.normalize(head,islocal)
- if texgetcount("pagebodymode") > 0 then
- -- can be an option, maybe we need a proper state in lua itself ... is this check still needed?
- return head, false
+-- do we still need this:
+
+if CONTEXTLMTXMODE > 0 then
+
+ function paragraphs.normalize(head,islocal)
+ if texgetcount("pagebodymode") > 0 then
+ -- can be an option, maybe we need a proper state in lua itself ... is this check still needed?
+ return head, false
+ end
+ -- normalizer : todo, get the data, no need to normalize
+ for line, subtype in nexthlist, head do
+ if subtype == linelist_code and not getprop(line,"line") then
+ normalize(line)
+ end
+ end
+ return head, true -- true is obsolete
end
- -- this can become a separate handler but it makes sense to integrate it here
- local mode = texgetcount("parfillleftmode")
- if mode > 0 then
- local l_width, l_stretch, l_shrink = texgetglue("parfillleftskip")
- if l_width ~= 0 or l_stretch ~= 0 or l_shrink ~= 0 then
- local last = nil -- a nut
- local done = mode == 2 -- false
- for line, subtype in nexthlist, head do
- if subtype == linelist_code and not getprop(line,"line") then
- if done then
- last = line
- else
- done = true
+
+else
+
+ function paragraphs.normalize(head,islocal)
+ if texgetcount("pagebodymode") > 0 then
+ -- can be an option, maybe we need a proper state in lua itself ... is this check still needed?
+ return head, false
+ end
+ -- this can become a separate handler but it makes sense to integrate it here
+ local mode = texgetcount("parfillleftmode")
+ if mode > 0 then
+ local l_width, l_stretch, l_shrink = texgetglue("parfillleftskip")
+ if l_width ~= 0 or l_stretch ~= 0 or l_shrink ~= 0 then
+ local last = nil -- a nut
+ local done = mode == 2 -- false
+ for line, subtype in nexthlist, head do
+ if subtype == linelist_code and not getprop(line,"line") then
+ if done then
+ last = line
+ else
+ done = true
+ end
end
end
- end
- if last then -- only if we have more than one line
- local head = getlist(last)
- local current = head
- if current then
- if getid(current) == glue_code and getsubtype(current,leftskip_code) then
- current = getnext(current)
- end
+ if last then -- only if we have more than one line
+ local head = getlist(last)
+ local current = head
if current then
- head, current = insert_before(head,current,new_glue(l_width,l_stretch,l_shrink))
- if head == current then
- setlist(last,head)
+ if getid(current) == glue_code and getsubtype(current,leftskip_code) then
+ current = getnext(current)
+ end
+ if current then
+ head, current = insert_before(head,current,new_glue(l_width,l_stretch,l_shrink))
+ if head == current then
+ setlist(last,head)
+ end
+ -- can be a 'rehpack(h )'
+ rehpack(last)
end
- -- can be a 'rehpack(h )'
- rehpack(last)
end
end
end
end
- end
- -- normalizer
- for line, subtype in nexthlist, head do
- if subtype == linelist_code and not getprop(line,"line") then
- normalize(line)
+ -- normalizer
+ for line, subtype in nexthlist, head do
+ if subtype == linelist_code and not getprop(line,"line") then
+ normalize(line)
+ end
end
+ return head, true -- true is obsolete
end
- return head, true -- true is obsolete
+
end
-- print(nodes.idstostring(head))