diff options
author | Marius <mariausol@gmail.com> | 2012-02-17 01:20:15 +0200 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2012-02-17 01:20:15 +0200 |
commit | 78f55ee13ec8a41dc28a1b6ac91ea259df0965d9 (patch) | |
tree | 0b23eb88ef9433d0d528ebdf1e13ab7e6cd1dc1d /tex/context/base/anch-pos.lua | |
parent | 8956e856f94fffee875e24be7b6115a3b7aac7a3 (diff) | |
download | context-78f55ee13ec8a41dc28a1b6ac91ea259df0965d9.tar.gz |
beta 2012.02.16 23:57
Diffstat (limited to 'tex/context/base/anch-pos.lua')
-rw-r--r-- | tex/context/base/anch-pos.lua | 56 |
1 files changed, 33 insertions, 23 deletions
diff --git a/tex/context/base/anch-pos.lua b/tex/context/base/anch-pos.lua index b43cd3781..d6fefd3b8 100644 --- a/tex/context/base/anch-pos.lua +++ b/tex/context/base/anch-pos.lua @@ -52,21 +52,22 @@ job.positions = jobpositions _plib_ = jobpositions -local default = { +local default = { -- not r and paragraphs etc __index = { - x = 0, -- x position baseline - y = 0, -- y position baseline - w = 0, -- width - h = 0, -- height - d = 0, -- depth - p = 0, -- page - n = 0, -- paragraph - ls = 0, -- leftskip - rs = 0, -- rightskip - hi = 0, -- hangindent - ha = 0, -- hangafter - hs = 0, -- hsize - pi = 0, -- parindent + x = 0, -- x position baseline + y = 0, -- y position baseline + w = 0, -- width + h = 0, -- height + d = 0, -- depth + p = 0, -- page + n = 0, -- paragraph + ls = 0, -- leftskip + rs = 0, -- rightskip + hi = 0, -- hangindent + ha = 0, -- hangafter + hs = 0, -- hsize + pi = 0, -- parindent + ps = false, -- parshape } } @@ -79,11 +80,10 @@ local function initializer() collected = jobpositions.collected -- enhance regions with paragraphs for tag, data in next, collected do - local hi = data.hi - if hi and hi ~= 0 then - local region = data.r - if region then - local r = collected[region] + local region = data.r + if region then + local r = collected[region] + if r then local paragraphs = r.paragraphs if not paragraphs then r.paragraphs = { data } @@ -92,19 +92,25 @@ local function initializer() end end end + setmetatable(data,default) end + -- add metatable + -- for tag, data in next, collected do + -- setmetatable(data,default) + -- end -- sort this data and add metatable for tag, data in next, collected do local region = data.r if region then local r = collected[region] - local paragraphs = r.paragraphs - if paragraphs and #paragraphs > 1 then - sort(paragraphs,sorter) + if r then + local paragraphs = r.paragraphs + if paragraphs and #paragraphs > 1 then + sort(paragraphs,sorter) + end end end -- so, we can be sparse and don't need 'or 0' code - setmetatable(data,default) end end @@ -348,6 +354,7 @@ function commands.parpos() -- todo: relate to localpar (so this is an intermedia local hangindent = tex.hangindent local hangafter = tex.hangafter local parindent = tex.parindent + local parshape = tex.parshape if leftskip ~= 0 then t.ls = leftskip end @@ -363,6 +370,9 @@ function commands.parpos() -- todo: relate to localpar (so this is an intermedia if parindent ~= 0 then t.pi = parindent end + if parshape and #parshape > 0 then + t.ps = parshape + end local tag = format("p:%s",nofparagraphs) tobesaved[tag] = t context(new_latelua(format("_plib_.enhance(%q)",tag))) |