summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2014-04-28 23:24:00 +0200
committerHans Hagen <pragma@wxs.nl>2014-04-28 23:24:00 +0200
commit3a9be11a68e3bd5453edf1c0c7d469442dbd0cf3 (patch)
tree01d807ccd33b88e0c3e03e2ba2372bf665b0adc3 /scripts
parent7e02e6e8f9e6bee6c8813d3937fdbc8deb2d6e74 (diff)
downloadcontext-3a9be11a68e3bd5453edf1c0c7d469442dbd0cf3.tar.gz
beta 2014.04.28 23:24
Diffstat (limited to 'scripts')
-rw-r--r--scripts/context/lua/mtx-scite.lua55
-rw-r--r--scripts/context/lua/mtxrun.lua6
-rw-r--r--scripts/context/stubs/mswin/mtxrun.lua6
-rwxr-xr-xscripts/context/stubs/unix/mtxrun6
-rw-r--r--scripts/context/stubs/win64/mtxrun.lua6
5 files changed, 67 insertions, 12 deletions
diff --git a/scripts/context/lua/mtx-scite.lua b/scripts/context/lua/mtx-scite.lua
index 972edbfe6..ae8c67387 100644
--- a/scripts/context/lua/mtx-scite.lua
+++ b/scripts/context/lua/mtx-scite.lua
@@ -6,6 +6,8 @@ if not modules then modules = { } end modules ['mtx-scite'] = {
license = "see context related readme files"
}
+-- mtxrun --script scite --tree --source=t:/texmf/tex/context --target=e:/tmp/context --numbers
+
local P, R, S, C, Ct, Cf, Cc, Cg = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.Ct, lpeg.Cf, lpeg.Cc, lpeg.Cg
local lpegmatch = lpeg.match
local format, lower, gmatch = string.format, string.lower, string.gmatch
@@ -22,6 +24,8 @@ local helpinfo = [[
<category name="basic">
<subcategory>
<flag name="words"><short>convert spell-*.txt into spell-*.lua</short></flag>
+ <flag name="tree"><short>converts a tree into an html tree (--source --target --numbers)</short></flag>
+ <flag name="file"><short>converts a file into an html tree (--source --target --numbers --lexer)</short></flag>
</subcategory>
</category>
</flags>
@@ -36,6 +40,8 @@ local application = logs.application {
local report = application.report
+local scite = require("util-sci")
+
scripts = scripts or { }
scripts.scite = scripts.scite or { }
@@ -241,6 +247,51 @@ function scripts.scite.words()
report("you need to move the lua files to lexers/data")
end
+function scripts.scite.tree()
+ local source = environment.argument("source")
+ local target = environment.argument("target")
+ local numbers = environment.argument("numbers")
+ if not lfs.isdir(source) then
+ report("you need to pass a valid source path with --source")
+ return
+ end
+ if not lfs.isdir(target) then
+ report("you need to pass a valid target path with --target")
+ return
+ end
+ if source == target then
+ report("source and target paths must be different")
+ return
+ end
+ scite.converttree(source,target,numbers)
+end
+
+function scripts.scite.file()
+ local source = environment.argument("source")
+ local target = environment.argument("target")
+ local lexer = environment.argument("lexer")
+ local numbers = environment.argument("numbers")
+ if source then
+ local target = target or file.replacesuffix(source,"html")
+ if source == target then
+ report("the source file cannot be the same as the target")
+ else
+ scite.filetohtml(source,lexer,target,numbers)
+ end
+
+ else
+ for i=1,#environment.files do
+ local source = environment.files[i]
+ local target = file.replacesuffix(source,"html")
+ if source == target then
+ report("the source file cannot be the same as the target")
+ else
+ scite.filetohtml(source,nil,target,numbers)
+ end
+ end
+ end
+end
+
-- if environment.argument("start") then
-- scripts.scite.start(true)
-- elseif environment.argument("test") then
@@ -251,6 +302,10 @@ end
if environment.argument("words") then
scripts.scite.words()
+elseif environment.argument("tree") then
+ scripts.scite.tree()
+elseif environment.argument("file") then
+ scripts.scite.file()
elseif environment.argument("exporthelp") then
application.export(environment.argument("exporthelp"),environment.files[1])
else
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua
index 7bd96b247..8679aefb1 100644
--- a/scripts/context/lua/mtxrun.lua
+++ b/scripts/context/lua/mtxrun.lua
@@ -7180,7 +7180,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["trac-log"] = package.loaded["trac-log"] or true
--- original size: 25455, stripped down to: 16617
+-- original size: 25607, stripped down to: 16617
if not modules then modules={} end modules ['trac-log']={
version=1.001,
@@ -16875,8 +16875,8 @@ end -- of closure
-- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 694406
--- stripped bytes : 246345
+-- original bytes : 694558
+-- stripped bytes : 246497
-- end library merge
diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua
index 7bd96b247..8679aefb1 100644
--- a/scripts/context/stubs/mswin/mtxrun.lua
+++ b/scripts/context/stubs/mswin/mtxrun.lua
@@ -7180,7 +7180,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["trac-log"] = package.loaded["trac-log"] or true
--- original size: 25455, stripped down to: 16617
+-- original size: 25607, stripped down to: 16617
if not modules then modules={} end modules ['trac-log']={
version=1.001,
@@ -16875,8 +16875,8 @@ end -- of closure
-- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 694406
--- stripped bytes : 246345
+-- original bytes : 694558
+-- stripped bytes : 246497
-- end library merge
diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun
index 7bd96b247..8679aefb1 100755
--- a/scripts/context/stubs/unix/mtxrun
+++ b/scripts/context/stubs/unix/mtxrun
@@ -7180,7 +7180,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["trac-log"] = package.loaded["trac-log"] or true
--- original size: 25455, stripped down to: 16617
+-- original size: 25607, stripped down to: 16617
if not modules then modules={} end modules ['trac-log']={
version=1.001,
@@ -16875,8 +16875,8 @@ end -- of closure
-- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 694406
--- stripped bytes : 246345
+-- original bytes : 694558
+-- stripped bytes : 246497
-- end library merge
diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua
index 7bd96b247..8679aefb1 100644
--- a/scripts/context/stubs/win64/mtxrun.lua
+++ b/scripts/context/stubs/win64/mtxrun.lua
@@ -7180,7 +7180,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["trac-log"] = package.loaded["trac-log"] or true
--- original size: 25455, stripped down to: 16617
+-- original size: 25607, stripped down to: 16617
if not modules then modules={} end modules ['trac-log']={
version=1.001,
@@ -16875,8 +16875,8 @@ end -- of closure
-- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 694406
--- stripped bytes : 246345
+-- original bytes : 694558
+-- stripped bytes : 246497
-- end library merge