diff options
author | Philipp Gesang <phg@phi-gamma.net> | 2014-03-02 14:33:49 +0100 |
---|---|---|
committer | Philipp Gesang <phg@phi-gamma.net> | 2018-12-02 21:09:41 +0100 |
commit | 9bf6659f035221c72f62f1293bded4b297045f3e (patch) | |
tree | 163faffcceb5b6bf7eb53374ed506678ea70b0a0 /src | |
parent | 79e7eae6c5af2b42297536ca9aacaacf01b67242 (diff) | |
download | context-rst-9bf6659f035221c72f62f1293bded4b297045f3e.tar.gz |
fix error handling when called directly as Lua script
Diffstat (limited to 'src')
-rw-r--r-- | src/rst_parser.lua | 53 |
1 files changed, 27 insertions, 26 deletions
diff --git a/src/rst_parser.lua b/src/rst_parser.lua index e633899..4fc36cf 100644 --- a/src/rst_parser.lua +++ b/src/rst_parser.lua @@ -5,10 +5,31 @@ -- DESCRIPTION: https://bitbucket.org/phg/context-rst/overview -- AUTHOR: Philipp Gesang (Phg), <phg42.2a@gmail.com> -- VERSION: 0.6 --- CHANGED: 2014-02-28 06:49:01+0100 +-- CHANGED: 2014-03-02 14:25:57+0100 -------------------------------------------------------------------------------- -- +local usage_info = [[ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + rstConTeXt +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Functionality has been moved, the reST converter can now be +accessed via mtxrun: + + $mtxrun --script rst + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +]] + +local main = function () + io.write("\n"..usage_info.."\n") + return -1 +end + +if not (context or scripts) then + return main() +end thirddata = thirddata or { } thirddata.rst = { } @@ -41,6 +62,9 @@ local stringmatch = string.match local stringstrip = string.strip local stringsub = string.sub local utflen = utf.len +local select = select + +local context = context local warn do @@ -51,9 +75,8 @@ do local slen = #str + 3 --str = "*["..str.."]" str = stringformat("*[%4d][%s]", ndebug, str) - local arglst = { ... } - for i=1, #arglst do - local current = arglst[i] + for i=1, select ("#", ...) do + local current = select (i, ...) if 80 - i * 8 - slen < 0 then local indent = "" for i=1, slen do @@ -1580,26 +1603,4 @@ 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 or scripts) then - return main() -end - --- vim:tw=79:et:sw=4:ts=8:sts=4 |