summaryrefslogtreecommitdiff
path: root/mod/tex/context/third/rst/rst_parser.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_parser.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_parser.lua')
-rw-r--r--mod/tex/context/third/rst/rst_parser.lua44
1 files changed, 24 insertions, 20 deletions
diff --git a/mod/tex/context/third/rst/rst_parser.lua b/mod/tex/context/third/rst/rst_parser.lua
index b0a02e6..ec9366e 100644
--- a/mod/tex/context/third/rst/rst_parser.lua
+++ b/mod/tex/context/third/rst/rst_parser.lua
@@ -1,38 +1,42 @@
#!/usr/bin/env texlua
--------------------------------------------------------------------------------
-- FILE: rst-parser.lua
--- USAGE: ./rst-parser.lua
--- DESCRIPTION:
--- OPTIONS: ---
--- REQUIREMENTS: ---
+-- USAGE: refer to doc/documentation.rst
+-- DESCRIPTION: https://bitbucket.org/phg/context-rst/overview
-- AUTHOR: Philipp Gesang (Phg), <megas.kapaneus@gmail.com>
--- VERSION: 1.0
--- CREATED: 31/08/10 11:53:49 CEST
+-- VERSION: 0.3
+-- CREATED: 2011-05-04 17:41:15+0200
--------------------------------------------------------------------------------
--
-rst = {}
-helpers = {}
-optional_setups = {}
+local rst
+local helpers = {}
+local optional_setups
if context then
+ thirddata = thirddata or { }
+ thirddata.rst = { }
+ thirddata.rst_helpers = helpers
+ --thirddata.rst_setups = optional_setups
+
environment.loadluafile("rst_helpers")
+ environment.loadluafile("rst_directives")
environment.loadluafile("rst_setups" )
environment.loadluafile("rst_context")
- rst = rst_context
- helpers = helpers
- optional_setups = optional_setups
+
+ rst = rst_context
+ optional_setups = thirddata.rst_setups
else
- rst = require "rst_context"
- helpers = require "rst_helpers"
+ rst = require "rst_context"
+ helpers = require "rst_helpers"
optional_setups = require "rst_setups"
+ rst_directives = require "rst_directives"
end
-
-local rst_debug = true
+helpers.rst_debug = false
local warn = function(str, ...)
- if not rst_debug then return false end
+ if not helpers.rst_debug then return false end
local slen = #str + 3
str = "*["..str.."]"
for i,j in ipairs({...}) do
@@ -1374,7 +1378,7 @@ local function get_setups (inline)
\setupcolors[state=start]
\setupinteraction[state=start,focus=standard,color=darkgreen,contrastcolor=darkgreen]
-\setupbodyfontenvironment [default] [em=italic]
+%\setupbodyfontenvironment [default] [em=italic]
\sethyphenatedurlnormal{:=?&}
\sethyphenatedurlbefore{?&}
\sethyphenatedurlafter {:=/-}
@@ -1443,7 +1447,7 @@ do
strip_comments = Cs((comment + 1)^0)
end
-function rst.do_rst_file(fname)
+function thirddata.rst.do_rst_file(fname)
local rst_parser = parser
local raw_data = load_file(fname)
local processed = rst_parser:match(raw_data)
@@ -1457,7 +1461,7 @@ function rst.do_rst_file(fname)
end
end
-function rst.do_rst_snippet(txt)
+function thirddata.rst.do_rst_snippet(txt)
local processed = parser:match(txt)
local setups = get_setups(true)
local tmp_file = tex.jobname .. "–rst_temporary.tex.tmp"