summaryrefslogtreecommitdiff
path: root/mod/tex/context/third
diff options
context:
space:
mode:
Diffstat (limited to 'mod/tex/context/third')
-rw-r--r--mod/tex/context/third/rst/rst_context.lua4
-rw-r--r--mod/tex/context/third/rst/rst_directives.lua6
-rw-r--r--mod/tex/context/third/rst/rst_helpers.lua2
-rw-r--r--mod/tex/context/third/rst/rst_parser.lua60
-rw-r--r--mod/tex/context/third/rst/rst_setups.lua11
5 files changed, 41 insertions, 42 deletions
diff --git a/mod/tex/context/third/rst/rst_context.lua b/mod/tex/context/third/rst/rst_context.lua
index 86f4177..c742815 100644
--- a/mod/tex/context/third/rst/rst_context.lua
+++ b/mod/tex/context/third/rst/rst_context.lua
@@ -44,7 +44,7 @@ local err = function(str)
end
end
-rst_context = {}
+local rst_context = thirddata.rst
rst_context.collected_adornments = {}
rst_context.last_section_level = 0
@@ -1229,5 +1229,3 @@ function rst_context.directive(directive, ...)
end
return result
end
-
-return rst_context
diff --git a/mod/tex/context/third/rst/rst_directives.lua b/mod/tex/context/third/rst/rst_directives.lua
index a8a5eb7..7515a66 100644
--- a/mod/tex/context/third/rst/rst_directives.lua
+++ b/mod/tex/context/third/rst/rst_directives.lua
@@ -15,9 +15,8 @@ local helpers = helpers or thirddata and thirddata.rst_helpers
--------------------------------------------------------------------------------
local rst_directives = { }
-if context then
- thirddata.rst_directives = rst_directives
-end
+thirddata.rst_directives = rst_directives
+local rst_context = thirddata.rst
rst_directives.anonymous = 0
rst_directives.images = {}
@@ -258,4 +257,3 @@ rst_directives.replace = function(name, data)
]], name, data)
end
-return rst_directives
diff --git a/mod/tex/context/third/rst/rst_helpers.lua b/mod/tex/context/third/rst/rst_helpers.lua
index 73420d0..55c470c 100644
--- a/mod/tex/context/third/rst/rst_helpers.lua
+++ b/mod/tex/context/third/rst/rst_helpers.lua
@@ -625,5 +625,3 @@ do
end
end
-return helpers
-
diff --git a/mod/tex/context/third/rst/rst_parser.lua b/mod/tex/context/third/rst/rst_parser.lua
index 045d322..283ebf2 100644
--- a/mod/tex/context/third/rst/rst_parser.lua
+++ b/mod/tex/context/third/rst/rst_parser.lua
@@ -4,35 +4,24 @@
-- USAGE: refer to doc/documentation.rst
-- DESCRIPTION: https://bitbucket.org/phg/context-rst/overview
-- AUTHOR: Philipp Gesang (Phg), <megas.kapaneus@gmail.com>
--- VERSION: 0.3
--- CHANGED: 2011-05-08 17:55:54+0200
+-- VERSION: 0.6
+-- CHANGED: 2011-08-28 12:44:03+0200
--------------------------------------------------------------------------------
--
-local rst
-local optional_setups
thirddata = thirddata or { }
thirddata.rst = { }
thirddata.rst_helpers = { }
+
+environment.loadluafile"rst_helpers"
+environment.loadluafile"rst_directives"
+environment.loadluafile"rst_setups"
+environment.loadluafile"rst_context"
+
+local rst = thirddata.rst
local helpers = thirddata.rst_helpers
-if context then
- --thirddata.rst_setups = optional_setups
-
- environment.loadluafile("rst_helpers")
- environment.loadluafile("rst_directives")
- environment.loadluafile("rst_setups" )
- environment.loadluafile("rst_context")
-
- rst = rst_context
- optional_setups = thirddata.rst_setups
-else
- --helpers = require "rst_helpers"
- require "rst_helpers"
- rst_directives = require "rst_directives"
- optional_setups = require "rst_setups"
- rst = require "rst_context"
-end
+local optional_setups = thirddata.rst_setups
rst.strip_BOM = false
rst.expandtab = false
@@ -53,7 +42,7 @@ local warn = function(str, ...)
end
str = str .. string.format(" |%6s", string.strip(tostring(j)))
end
- io.write(str .. " |\n")
+ iowrite(str .. " |\n")
return 0
end
@@ -65,6 +54,8 @@ local P, R, S, V, match
local utf = unicode.utf8
+local iowrite = io.write
+
local eol = P"\n"
state = {}
@@ -1465,8 +1456,8 @@ local function get_setups (inline)
return setups
end
-local function main()
- local testdata = load_file(arg[1])
+function thirddata.rst.standalone (infile, outfile)
+ local testdata = load_file(infile)
if testdata == 1 then return 1 end
local processeddata = parser:match(testdata)
@@ -1486,7 +1477,7 @@ local function main()
]]
if processeddata then
- save_file(arg[2], processeddata)
+ save_file(outfile, processeddata)
else
return 1
end
@@ -1534,7 +1525,24 @@ function thirddata.rst.do_rst_snippet(txt)
end
end
+local usage_info = [[
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ rstConTeXt
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Functionality has been moved, the reST converter can now be
+accessed via mtxrun:
+
+ $mtxrun --script rst
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+]]
+
+local function main()
+ iowrite("\n"..usage_info.."\n")
+ return -1
+end
-if not context then
+if not (context or scripts) then
return main()
end
diff --git a/mod/tex/context/third/rst/rst_setups.lua b/mod/tex/context/third/rst/rst_setups.lua
index b7bda95..ee5b5a3 100644
--- a/mod/tex/context/third/rst/rst_setups.lua
+++ b/mod/tex/context/third/rst/rst_setups.lua
@@ -10,13 +10,10 @@
--local rst_directives = context and thirddata.rst_directives or require "rst_directives"
local optional_setups = { }
-local rst_directives
-if context then
- thirddata.rst_setups = optional_setups
- rst_directives = thirddata.rst_directives
-else
- rst_directives = require "rst_directives"
-end
+thirddata.rst_setups = optional_setups
+local rst_directives = thirddata.rst_directives
+local rst_context = thirddata.rst
+ --rst_directives = require "rst_directives"
function optional_setups.footnote_symbol ()
local setup = [[