projects
/
matthijs
/
master-project
/
report.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3c14ee2
)
Update the pret-trans to current context beta.
author
Matthijs Kooijman
<matthijs@stdin.nl>
Tue, 25 Aug 2009 15:30:41 +0000
(17:30 +0200)
committer
Matthijs Kooijman
<matthijs@stdin.nl>
Tue, 25 Aug 2009 15:30:41 +0000
(17:30 +0200)
pret-trans.lua
patch
|
blob
|
history
diff --git
a/pret-trans.lua
b/pret-trans.lua
index 9c6847e9bf68e5a9fead39032f93f8d1003b8a14..7f32afded167f7f07fe3f1680c7b5b313a3d78c9 100644
(file)
--- a/
pret-trans.lua
+++ b/
pret-trans.lua
@@
-9,9
+9,7
@@
local utf = unicode.utf8
local utf = unicode.utf8
-if not buffers then buffers = { } end
-if not buffers.visualizers then buffers.visualizers = { } end
-if not buffers.visualizers.trans then buffers.visualizers.trans = { } end
+vis = buffers.newvisualizer("trans")
local commands = {}
-- A command to create a horizontal rule.
local commands = {}
-- A command to create a horizontal rule.
@@
-42,50
+40,49
@@
end
local function blanks(n)
print("Inserting " .. n .. " blanks")
for i = 1,n do
local function blanks(n)
print("Inserting " .. n .. " blanks")
for i = 1,n do
- buffers.visualizers.default.empty_line()
+ buffers.visualizers.
handlers.
default.empty_line()
end
end
-- Prettyprint the given lines using the given pretty printer
local function prettyprint(ppr, lines)
-- Change the current visualizer
end
end
-- Prettyprint the given lines using the given pretty printer
local function prettyprint(ppr, lines)
-- Change the current visualizer
- oldvisualizer = buffers.currentvisualizer
- buffers.currentvisualizer = 'lam'
+ buffers.setvisualizer('lam')
-- Output the lines
-- Output the lines
- buffers.hooks.begin_of_
buffer('buffer', 'pret-trans-internal'
)
+ buffers.hooks.begin_of_
display(
)
line = 0
for i = 1,#lines do
_, line = buffers.typeline(lines[i], i, #lines, line)
end
line = 0
for i = 1,#lines do
_, line = buffers.typeline(lines[i], i, #lines, line)
end
- buffers.hooks.end_of_
buffer('buffer', 'pret-trans-internal'
)
+ buffers.hooks.end_of_
display(
)
-- Change the visualizer back
-- Change the visualizer back
- buffers.
currentvisualizer = oldvisualizer
+ buffers.
setvisualizer('trans')
end
-- Capture all lines, without generating any output
end
-- Capture all lines, without generating any output
-function
buffers.visualizers.trans.begin_of_buffer(type, name
)
+function
vis.begin_of_display(
)
lines = {}
end
lines = {}
end
-function
buffers.visualizers.tran
s.begin_of_line(n)
+function
vi
s.begin_of_line(n)
-- Don't generate output here
end
-- Don't generate output here
end
-function
buffers.visualizers.tran
s.flush_line(str, nested)
+function
vi
s.flush_line(str, nested)
table.insert(lines, str)
-- Don't generate output here
end
table.insert(lines, str)
-- Don't generate output here
end
-function
buffers.visualizers.tran
s.end_of_line(n)
+function
vi
s.end_of_line(n)
-- Don't generate output here
end
-- Don't generate output here
end
-function
buffers.visualizer
s.empty_line()
+function
vi
s.empty_line()
table.insert(lines, '')
-- Don't generate output here
end
-- We do the actual work here. Process all the lines in the buffer and
-- generate output for them.
table.insert(lines, '')
-- Don't generate output here
end
-- We do the actual work here. Process all the lines in the buffer and
-- generate output for them.
-function
buffers.visualizers.trans.end_of_buffer
()
+function
vis.end_of_display
()
-- Find the horizontal rule, and see how long it is.
len = nil
for i = 1,#lines do
-- Find the horizontal rule, and see how long it is.
len = nil
for i = 1,#lines do
@@
-154,7
+151,7
@@
function buffers.visualizers.trans.end_of_buffer()
-- Print the conditions
for i = 1,#rights do
tex.sprint(rights[i])
-- Print the conditions
for i = 1,#rights do
tex.sprint(rights[i])
- buffers.visualizers.default.end_of_line()
+ buffers.visualizers.
handlers.
default.end_of_line()
end
-- Fill up the remaining space with blanks
end
-- Fill up the remaining space with blanks