summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-10-04 23:14:25 +0000
committerKarl Berry <karl@freefriends.org>2011-10-04 23:14:25 +0000
commit4f68b0c5d5f831d436030b16a89144bd43c1bd42 (patch)
treefcc6886d2d14a0b8d51bcdf079e42447b99cc7c4 /Master/texmf-dist/scripts
parent9eca32c15f6dbc09ab0bfd2f7aa3b6cce8fd3754 (diff)
context-rst (4oct11)
git-svn-id: svn://tug.org/texlive/trunk@24199 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts')
-rw-r--r--Master/texmf-dist/scripts/context/lua/third/rst/mtx-t-rst.lua64
1 files changed, 64 insertions, 0 deletions
diff --git a/Master/texmf-dist/scripts/context/lua/third/rst/mtx-t-rst.lua b/Master/texmf-dist/scripts/context/lua/third/rst/mtx-t-rst.lua
new file mode 100644
index 00000000000..c7aa459bc75
--- /dev/null
+++ b/Master/texmf-dist/scripts/context/lua/third/rst/mtx-t-rst.lua
@@ -0,0 +1,64 @@
+#!/usr/bin/env texlua
+--------------------------------------------------------------------------------
+-- FILE: mtx-rst.lua
+-- USAGE: mtxrun --script rst --if=input.rst --of=output.tex
+-- DESCRIPTION: context script interface for the reStructuredText module
+-- REQUIREMENTS: latest ConTeXt MkIV
+-- AUTHOR: Philipp Gesang (Phg), <megas.kapaneus@gmail.com>
+-- CREATED: 2011-08-28 12:43:49+0200
+--------------------------------------------------------------------------------
+--
+
+scripts = scripts or { }
+scripts.rst = { }
+
+environment.loadluafile("rst_parser")
+
+local ea = environment.argument
+
+local helpinfo = [[
+===============================================================
+ The reStructuredText module, command line interface.
+ © 2010--2011 Philipp Gesang. License: 2-clause BSD.
+ Home: <https://bitbucket.org/phg/context-rst/>
+===============================================================
+
+USAGE:
+
+ mtxrun --script rst --if=input.rst --of=output.tex
+
+Mandatory arguments:
+
+ “infile.rst” is your input file containing reST markup.
+ “outfile.tex” is the target file that the TeX-code will be
+ written to.
+
+Optional arguments:
+ --et=bool “expandtab”, should tab chars (“\t”, “\v”) be
+ converted to spaces?
+ --sw=int “shiftwidth”, tab stop modulo factor.
+
+===============================================================
+]]
+
+local application = logs.application {
+ name = "mtx-rst",
+ banner = "The reStructuredText module for ConTeXt, hg-rev 135+",
+ helpinfo = helpinfo,
+}
+
+scripts.rst.input = ea("if")
+scripts.rst.output = ea("of")
+
+if scripts.rst.input and scripts.rst.output then
+ local expandtab = ea("et") == "true" and true
+ local shiftwidth = ea("sw")
+ local debug = ea("debug") == "true"
+ if expandtab then thirddata.rst.expandtab = true end
+ if shiftwdith then thirddata.rst.shiftwidth = tonumber(shiftwidth) end
+ if debug then thirddata.rst_helpers.rst_debug = debug end
+ thirddata.rst.standalone(scripts.rst.input, scripts.rst.output)
+else
+ application.help()
+end
+