summaryrefslogtreecommitdiff
path: root/mod/tex/context/third/rst/rst_helpers.lua
diff options
context:
space:
mode:
authorPhilipp Gesang <pgesang@ix.urz.uni-heidelberg.de>2011-05-04 17:44:12 +0200
committerPhilipp Gesang <pgesang@ix.urz.uni-heidelberg.de>2011-05-04 17:44:12 +0200
commit78d44502d0e4dc5179b703189da54bc3dfe0d306 (patch)
treea0a38ee12ea1c650e4114fa3903686f5815031e0 /mod/tex/context/third/rst/rst_helpers.lua
parent4dc6e76f8cbd29c762d93b05a8b32541a16890da (diff)
downloadcontext-rst-78d44502d0e4dc5179b703189da54bc3dfe0d306.tar.gz
confirming to Lua module namespace; alternate code from Wolfgang (resting for now)
Diffstat (limited to 'mod/tex/context/third/rst/rst_helpers.lua')
-rw-r--r--mod/tex/context/third/rst/rst_helpers.lua42
1 files changed, 22 insertions, 20 deletions
diff --git a/mod/tex/context/third/rst/rst_helpers.lua b/mod/tex/context/third/rst/rst_helpers.lua
index f081559..e6a886b 100644
--- a/mod/tex/context/third/rst/rst_helpers.lua
+++ b/mod/tex/context/third/rst/rst_helpers.lua
@@ -1,11 +1,10 @@
#!/usr/bin/env texlua
--------------------------------------------------------------------------------
-- FILE: rst_helpers.lua
--- USAGE: ./rst_helpers.lua
+-- USAGE: called by rst_parser.lua
-- DESCRIPTION: Complement to the reStructuredText parser
-- AUTHOR: Philipp Gesang (Phg), <megas.kapaneus@gmail.com>
--- VERSION: 1.0
--- CREATED: 07/09/10 01:03:08 CEST
+-- CREATED: 2011-05-04 17:41:59+0200
--------------------------------------------------------------------------------
--
@@ -16,17 +15,21 @@ local P, R, S, V, match
local C, Carg, Cb, Cc, Cg, Cmt, Cp, Cs, Ct
= lpeg.C, lpeg.Carg, lpeg.Cb, lpeg.Cc, lpeg.Cg, lpeg.Cmt, lpeg.Cp, lpeg.Cs, lpeg.Ct
-helpers = helpers or {}
+local helpers
+if not context then
+ helpers = helpers or {}
+else
+ helpers = thirddata.rst_helpers
+end
helpers.table = {}
helpers.cell = {}
function helpers.dbg_writef(...)
- if helpers_debug == true then
+ if helpers.rst_debug then
io.write(string.format(...))
end
end
---helpers.dbg_write = dbg_write
local dbg_write = helpers.dbg_writef
helpers.patterns = {}
@@ -160,7 +163,6 @@ local function set_layout (line)
return layout
end
-helpers_debug = true
function helpers.table.create(raw)
local newtab = {}
newtab.rows = {}
@@ -295,18 +297,18 @@ function helpers.table.create(raw)
newtab.__init()
- newtab.__draw_debug = function()
- for nr, row in ipairs(newtab.rows) do
- for nc, cell in ipairs(row) do
- local field = cell.variant:sub(1,7)
- if cell.parent then
- field = field .. string.format(" %s,%2s",cell.parent.x, cell.parent.y)
- end
- dbg_write("%12s | ", field)
- end
- dbg_write("\n")
- end
- end
+ --newtab.__draw_debug = function()
+ --for nr, row in ipairs(newtab.rows) do
+ --for nc, cell in ipairs(row) do
+ --local field = cell.variant:sub(1,7)
+ --if cell.parent then
+ --field = field .. string.format(" %s,%2s",cell.parent.x, cell.parent.y)
+ --end
+ --dbg_write("%12s | ", field)
+ --end
+ --dbg_write("\n")
+ --end
+ --end
return newtab
end
@@ -628,5 +630,5 @@ do
end
end
-return helpers
+--return helpers