summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2012-11-21 16:11:00 +0100
committerHans Hagen <pragma@wxs.nl>2012-11-21 16:11:00 +0100
commit4bc9f650e3e87812fa7daf77db51a7adf37efdb4 (patch)
tree3adbffa2b57cd3e5945962eaa57c5fe6aa5e3210 /scripts
parent5662188aa79108a3678a97d10978f658c0746d01 (diff)
downloadcontext-4bc9f650e3e87812fa7daf77db51a7adf37efdb4.tar.gz
beta 2012.11.21 16:11
Diffstat (limited to 'scripts')
-rw-r--r--scripts/context/lua/mtx-server-ctx-fonttest.lua30
-rw-r--r--scripts/context/lua/mtx-server.lua2
2 files changed, 23 insertions, 9 deletions
diff --git a/scripts/context/lua/mtx-server-ctx-fonttest.lua b/scripts/context/lua/mtx-server-ctx-fonttest.lua
index b30cf0175..a8d7edf41 100644
--- a/scripts/context/lua/mtx-server-ctx-fonttest.lua
+++ b/scripts/context/lua/mtx-server-ctx-fonttest.lua
@@ -6,12 +6,17 @@ if not modules then modules = { } end modules ['mtx-server-ctx-fonttest'] = {
license = "see context related readme files"
}
---~ dofile(resolvers.findfile("l-aux.lua","tex"))
+-- probably too much but who cares
+
dofile(resolvers.findfile("trac-lmx.lua","tex"))
+dofile(resolvers.findfile("font-ini.lua","tex"))
+dofile(resolvers.findfile("font-con.lua","tex"))
+dofile(resolvers.findfile("font-oti.lua","tex"))
+dofile(resolvers.findfile("font-otf.lua","tex"))
+dofile(resolvers.findfile("font-otp.lua","tex"))
dofile(resolvers.findfile("font-ott.lua","tex"))
dofile(resolvers.findfile("font-syn.lua","tex"))
dofile(resolvers.findfile("font-mis.lua","tex"))
---~ dofile(resolvers.findfile("font-otp.lua","tex"))
local format, gsub, concat, match, find = string.format, string.gsub, table.concat, string.match, string.find
@@ -34,7 +39,7 @@ local process_templates = { }
process_templates.default = [[
\starttext
- \setcharactermirroring[1]
+ \setupdirections[bidi=global]
\definefontfeature[sample][analyze=yes,%s]
\definedfont[name:%s*sample]
\startTEXpage[offset=3pt]
@@ -59,7 +64,7 @@ process_templates.trace = [[
\setupcolors[state=start]
-\setcharactermirroring[1]
+\setupdirections[bidi=global]
\setvariables
[otftracker]
@@ -280,9 +285,11 @@ local edit_template = [[
<br/> <br/>options:&nbsp;%s
]]
+-- <embed src="%s#toolbar=0&amp;navpanes=0&amp;scrollbar=0" width="100%%"/>
+
local result_template = [[
<br/> <br/>
- <embed src="%s#toolbar=0&amp;navpanes=0&amp;scrollbar=0" width="100%%"/>
+ <embed src="%s#view=Fit&amp;toolbar=0&amp;navpanes=0&amp;scrollbar=0" width="100%%"/>
<br/> <br/> results:
<a href='%s' target="source">tex file</a>
<a href='%s' target="result">pdf file</a>
@@ -377,8 +384,14 @@ local function process_font(currentfont,detail) -- maybe just fontname
local sample = string.strip(detail.sampletext or "")
if sample == "" then sample = sample_line end
report("sample text: %s",sample)
- io.savedata(file.join(temppath,file.addsuffix(tempname,"tex")),format(variant,concat(features,","),currentfont,sample))
- os.execute(format("mtxrun --path=%s --script context --once --batchmode %s",temppath,tempname))
+ dir.mkdirs(temppath)
+ local fullname = file.join(temppath,file.addsuffix(tempname,"tex"))
+ local data = format(variant,concat(features,","),currentfont,sample)
+ local command = format("mtxrun --path=%q --script context --once --batchmode %q",temppath,tempname)
+ report("filename: %s",fullname)
+ report("command: %s",command)
+ io.savedata(fullname,data)
+ os.execute(command)
return edit_font(currentfont,detail,tempname)
end
@@ -390,7 +403,8 @@ local tex_template = [[
local function show_source(currentfont,detail)
if tempname and tempname ~= "" then
- return format(tex_template,io.loaddata(file.join(temppath,file.addsuffix(tempname,"tex"))) or "no source yet")
+ local data = io.loaddata(file.join(temppath,file.addsuffix(tempname,"tex"))) or "no source yet"
+ return format(tex_template,data)
else
return "no source file"
end
diff --git a/scripts/context/lua/mtx-server.lua b/scripts/context/lua/mtx-server.lua
index d6e8ac902..c74319a71 100644
--- a/scripts/context/lua/mtx-server.lua
+++ b/scripts/context/lua/mtx-server.lua
@@ -26,7 +26,6 @@ local report = application.report
scripts = scripts or { }
scripts.webserver = scripts.webserver or { }
-dofile(resolvers.findfile("l-url.lua","tex"))
dofile(resolvers.findfile("luat-soc.lua","tex"))
local socket = socket or require("socket")
@@ -226,6 +225,7 @@ function handlers.lua(client,configuration,filename,suffix,iscontent,hashed) --
end
end
else
+ report("problematic script: %s",filename)
errormessage(client,configuration,404)
end
end