summaryrefslogtreecommitdiff
path: root/tex/context/base/strc-not.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2010-01-17 23:50:00 +0100
committerHans Hagen <pragma@wxs.nl>2010-01-17 23:50:00 +0100
commit4e362156550b2624811c01de388d3d695f444d77 (patch)
treef3d343ab5c0d57634aa8f2411013dd4dc49aebee /tex/context/base/strc-not.lua
parentc3fb9b7d537059ec737147e65049e54585a9f777 (diff)
downloadcontext-4e362156550b2624811c01de388d3d695f444d77.tar.gz
beta 2010.01.17 23:50
Diffstat (limited to 'tex/context/base/strc-not.lua')
-rw-r--r--tex/context/base/strc-not.lua38
1 files changed, 30 insertions, 8 deletions
diff --git a/tex/context/base/strc-not.lua b/tex/context/base/strc-not.lua
index f390c05b5..97e1ffe72 100644
--- a/tex/context/base/strc-not.lua
+++ b/tex/context/base/strc-not.lua
@@ -52,14 +52,14 @@ function notes.store(tag,n)
end
state.start = state.start or nnd
end
- tex.write(#nd)
+ texwrite(#nd)
end
-function notes.get(tag,n)
+local function get(tag,n)
local nd = notedata[tag]
if nd then
- n = n or #notedata
- nd = nd[n or n]
+ n = n or #nd
+ nd = nd[n]
if nd then
if trace_notes then
logs.report("notes","getting %s of %s",n,tag)
@@ -69,6 +69,14 @@ function notes.get(tag,n)
end
end
+local function getn(tag)
+ local nd = notedata[tag]
+ return (nd and #nd) or 0
+end
+
+nodes.get = get
+nodes.getn = getn
+
-- we could make a special enhancer
function notes.listindex(tag,n)
@@ -142,7 +150,7 @@ function notes.doifcontent(tag)
end
local function internal(tag,n)
- local nd = notes.get(tag,n)
+ local nd = get(tag,n)
if nd then
local r = nd.references
if r then
@@ -160,6 +168,20 @@ local function ordered(kind,name,n)
return o and o[n]
end
+notes.internal = internal
+notes.ordered = ordered
+
+function notes.doifonsamepageasprevious(tag)
+ local same = false
+ local n = getn(tag,n)
+ local current, previous = get(tag,n), get(tag,n-1)
+ if current and previous then
+ local cr, pr = current.references, previous.references
+ same = cr and pr and cr.realpage == pr.realpage
+ end
+ commands.doifelse(same)
+end
+
function notes.checkpagechange(tag) -- called before increment !
local nd = notedata[tag] -- can be unset at first entry
if nd then
@@ -203,7 +225,7 @@ function notes.deltapage(tag,n)
what = 3
end
end
- tex.write(what)
+ texwrite(what)
end
function notes.postpone()
@@ -218,14 +240,14 @@ function notes.postpone()
end
function notes.setsymbolpage(tag,n)
- local nd = notes.get(tag,n)
+ local nd = get(tag,n)
if nd then
nd.metadata.symbolpage = texcount.realpageno
end
end
function notes.getsymbolpage(tag,n)
- local nd = notes.get(tag,n)
+ local nd = get(tag,n)
nd = nd and nd.metadata.symbolpage
texwrite(nd or 0)
end