On Sun, 2012-03-04 at 23:20 -0500, Aditya Mahajan wrote:
> If you want to use the automagic way, you can define \BazaarRevision to
> redefined \BazaarRevision, for example:
>
> \def\BazaarRevision
> {\ctxlua{context.setevalue(
>
d use. For example:
\def\initilizebazaar
{\ctxlua{context.setevalue(
"usebazaarrevision",
os.resultof"bzr revno | tr -d '\\n'")}}
\appendtoks \initilizebazaar \to \everystarttext
and then use can use \usebazaarrevision in the main text
s: %s",table.concat(files," ")))
end
function document.choosegraphic()
if #files > 0 then
context(table.remove(files, math.random(1,#files)) or "dummy")
else
context("dummy")
end
end
\stopluacode
\def\Co
cs: %s",table.concat(files," ")))
end
function document.choosegraphics()
if #files > 0 then
context(table.remove(files, math.random(1,#files)) or "dummy")
else
context("dummy")
end
end
\stopluacode
\def\
= unicode.utf8” at the
top of the file.)
Regards
Philipp
>
> Thanks
> Jaroslav Hajtmar
>
> Here is my minimal example:
>
> \def\mymacro#1{\ctxlua{for i=1, string.len('#1') do
> context(string.sub('#1',i,i)..", ") end}}
>
> \starttex
(orig_pos)
string.lenutf8(string),
but without success.
Can you please someone help?
Thanks
Jaroslav Hajtmar
Here is my minimal example:
\def\mymacro#1{\ctxlua{for i=1, string.len('#1') do
context(string.sub('#1',i,i)..", ") end}}
\starttext
%\mymacro{šěřěžř
rnalfigure
[\ctxlua{context("http://placekitten.com/g/\%0.0f/\%0.0f";,
\withoutpt{\the\dimexpr\kittenwidth},
\withoutpt{\the\dimexpr\kittenheight})}]
[#1, method=jpg]}
\starttext
\placefigure[left,none]{}
{\externalkitten[width=0.5\textwidth, h
Sorry for the noise…
I found the answer to my last question in module-01.pdf, pages 92 and 93: the
right definition is
\define[3]\RandomCoeff{%
\setevalue{Coeff#1}{\ctxlua{tex.print(math.random(#2,#3))}}
}
that is one has to use \setevalue instead of \setvalue (that is
Hi again Wolfgang and Peter,
The solution you provided to my problem is great but has a small issue…
Considering the definition
\define[3]\RandomCoeff{%
\setvalue{Coeff#1}{\ctxlua{tex.print(math.random(#2,#3))}}
}
after saying
\RandomCoeff{Alpha}{1}{10}
one gets
Thanks for Wolfgang: your solution, that is
\setuprandomize[2012]
\define[3]\RandomCoeff{%
\setvalue{Coeff#1}{\ctxlua{tex.print(math.random(#2,#3))}}}
works indeed and it is somehow simpler than using \expandafter\csname, and as a
matter of fact, after reading your message I searched in
ne[3]\RandomCoeff{%
>> \ctxlua{a = math.random(#2,#3)}
>> % \csname{Coeff#1}\endcsname{\ctxlua{tex.print(a)}} %% this line does not
>> work as expected...
>
> \setuprandomize[2012]
> \define[3]\RandomCoeff{%
> \expandafter\def\csname
> Coeff#1\endcsname{\ct
wrote:
> Reccently I did something random in ctxlua. I post it in the hope it will be
> useful.
>
> Hans van der Meer
>
> \startluacode
> -- Define our namespace as hvdm
> hvdm = hvdm or {}
>
> -- Return random series of numbers 1..n depe
Am 05.01.2012 um 21:11 schrieb Meer, H. van der:
> Reccently I did something random in ctxlua. I post it in the hope it will be
> useful.
>
> Hans van der Meer
>
> \startluacode
> -- Define our namespace as hvdm
> hvdm = hvdm or {}
Don’t use a globa
Am 05.01.2012 um 21:17 schrieb Peter Münster:
> On Thu, Jan 05 2012, Otared Kavian wrote:
>
>> \define[3]\RandomCoeff{%
>> \ctxlua{a = math.random(#2,#3)}
>> %\csname{Coeff#1}\endcsname{\ctxlua{tex.print(a)}} %% this line does not
>> work as expecte
On Thu, Jan 05 2012, Otared Kavian wrote:
> \define[3]\RandomCoeff{%
> \ctxlua{a = math.random(#2,#3)}
> % \csname{Coeff#1}\endcsname{\ctxlua{tex.print(a)}} %% this line does not
> work as expected...
\setuprandomize[2012]
\define[3]\RandomCoeff{%
\expandafter\def\csn
Reccently I did something random in ctxlua. I post it in the hope it will be
useful.
Hans van der Meer
\startluacode
-- Define our namespace as hvdm
hvdm = hvdm or {}
-- Return random series of numbers 1..n depending on the number of
arguments
function
number chosen between 1 and 10?
I tried to use the following approach, but could not make it work:
%%% begin random-coeff.tex
\setuprandomize[2012] % set a seed
\ctxlua{CoeffAlpha = math.random(1,10) ;}
\def\CoeffAlpha{\ctxlua{tex.print(CoeffAlpha)}}
%
\define[3]\RandomCoeff
es what I wanted to do.
>
> \starttext
> \setvariable{namespace}{var}{Some context}
> \ctxlua{
> local s = context.getvariable("namespace", "var")
>
> if s == "" then
> ...
> else
> ...
> end
> }
> \stoptext
>
>
ed some
> combinations, based on manual but I couldn't succeed. The code below
> exemplifies what I wanted to do.
>
> \starttext
> \setvariable{namespace}{var}{Some context}
> \ctxlua{
> local s = context.getvariable("namespace", "var")
>
&g
low
exemplifies what I wanted to do.
\starttext
\setvariable{namespace}{var}{Some context}
\ctxlua{
local s = context.getvariable("namespace", "var")
if s == "" then
...
else
...
end
}
\stoptext
I know that I can use some of \if* TeX commands, bu
function userdata.specialparagraph()
local text = buffers.getcontent("specialparagraph")
text = string.gsub(text,"\n\n"," ¶ ")
context(text)
end
\stopluacode
\def\startspecialparagraph
{\dostartbuffer[specialparagraph][startspecialparag
nd > references > invalid page reference: 0
structure > sectioning > section @ level 3 : 0.3.4 -> Cornucopianism
references > unknown reference [Terms & Concepts][Malthusianism]
structure > sectioning > section @ level 3 : 0.3.5 -> Corporate Personhood
pages > flushing realpage 13,
context(rightpage)
> else
> context(leftpage)
> end
> return true
> end
> }
> end
>
> \stopluacode
>
> \starttext
>
> \ctxlua{userdata.myheadertext(&qu
)
if math.odd(tex.count["realpageno"]) then
context(rightpage)
else
context(leftpage)
end
return true
end
context(": ")
> return true
> end
> }
> end
>
> \stopluacode
>
> \starttext
> \ctxlua{userdata.myheadertext("A")}
> \input knuth
> \page
> \input ward
> \stoptext
>
> Wolfgang
> __
context(": ")
return true
end
}
end
\stopluacode
\starttext
\ctxlua{userdata.myheadertext("A")}
\input knuth
\page
\input ward
\stoptext
Wolfgang
___
If your questi
)
context.setupheadertexts{
function()
context.labeltext(s)
context(": ")
end}
end
\stopluacode
\starttext
\ctxlua{myheadertext("A")}
\input knuth
\page
\input ward
\stoptext
Thanks for
context.setupheadertexts{ function()
>context.labeltext("willi")
> -- context.space()
>context(": ")
>context(s)
>end }
> end
> \stopluacode
>
> \ctxlua{documentdata.myheadertext("Headertext")}
>
> \st
.setupheadertexts{ function()
context.labeltext("willi")
-- context.space()
context(": ")
context(s)
end }
end
\stopluacode
\ctxlua{documentdata.myheadertext("Headertext")}
\starttext
\input knuth
\stoptext
Wolfgang
__
>>context.setupheadertexts{context(s)} --context.labeltext(s)
>> end
>> \stopluacode
>
> \startluacode
> function documentdata.myheadertext(s)
>context.setupheadertexts{s}
> end
> \stopluacode
>
>&
pluacode
\startluacode
function documentdata.myheadertext(s)
context.setupheadertexts{s}
end
\stopluacode
> \starttext
> \ctxluamyheadertext{"Headertext"}}
String are passed with braces.
\ctxlua{documentdata.myheadertext("Headertext")}
Wolfgang
t;]
if target then
local id = string.gsub(target,"^#","")
local n = notes[id]
if n then
n = n + 1
e.at.footnote = n
notes[id] = n
e.at["x
Dear ConTeXt folks,
I want to create monochrome plots, but `option=monochrome` is ignored.
\usemodule[gnuplot]
\setupGNUPLOT[terminal=context,option=monochrome]
\startGNUPLOTscript[pi]
plot pi t '$π = \ctxlua{context(ma
Am Montag, den 12.12.2011, 23:13 +0100 schrieb Mojca Miklavec:
[…]
> One more example. One thing that would most probably work (I didn't
> try it) would be the following:
>
> \startGNUPLOTscript[name]
> plot sin(x) t '$\pi = \ctxlua{math.pi()}$'
> \stopGNUPLOT
t command.
> >
> > I tried the following.
> >
> >\usemodule[gnuplot]
> >
> >\startGNUPLOTscript[lua]
> > plot \ctxlua{context(1.2 * x + 3)}
> >\stopGNUPLOTscript
>
> This won't work. The reason is that contents
line for me.
I have not yet figured out how to read values from a file in Lua and
just tried to print a constant to the gnuplot command.
I tried the following.
\usemodule[gnuplot]
\startGNUPLOTscript[lua]
plot \ctxlua{context(1.2 * x + 3
rk (I didn't
try it) would be the following:
\startGNUPLOTscript[name]
plot sin(x) t '$\pi = \ctxlua{math.pi()}$'
\stopGNUPLOTscript
How can you explain to ConTeXt whether lua command has to be executed
before or after gnuplot does its job? (label width will be wrong in
either case
files I want to use Lua to create the formula
> for the line for me.
>
> I have not yet figured out how to read values from a file in Lua and
> just tried to print a constant to the gnuplot command.
>
> I tried the following.
>
> \usemodule[gnuplot]
>
> \s
to read values from a file in Lua and
just tried to print a constant to the gnuplot command.
I tried the following.
\usemodule[gnuplot]
\startGNUPLOTscript[lua]
plot \ctxlua{context(1.2 * x + 3)}
\stopGNUPLOTscript
\startGNUPLOTscript
;w+")
function testfun(param)
Use the thirddata or userdata namespace for for functions.
debug:write(param)
-- tex.print(param)
end
\stopluacode
\def\testmac#1{\directlua{testfun('#1')}}
\unprotect
\def\testmac#1{\ctxlua{testfun(\!!bs\detokenize{
> Thanx Jaroslav
>
> \startluacode
> debug=io.open("debug.txt","w+")
>
> function testfun(param)
Use the thirddata or userdata namespace for for functions.
>debug:write(param)
>-- tex.print(param)
> end
>
> \stopluacode
>
>
&
On Sun, 4 Dec 2011, Aditya Mahajan wrote:
\def\executeCommand
{\doifmode{*first}
{\ctxlua{job.files.run(\!!bs\externalfiter::input_file\!!es,
\!!bs\externalfiltercommand\!!es)}}}
The solution is to remove the test for the first mode. Needs a bit of
and
{\doifmode{*first}
{\ctxlua{job.files.run(\!!bs\externalfiter::input_file\!!es,
\!!bs\externalfiltercommand\!!es)}}}
The solution is to remove the test for the first mode. Needs a bit of
refactoring to ensure that the solution still works for MkII. (Do
attached file). Any hints
> are welcome.
\definetwopasslist{test}
\newcount\testcount
\starttext
\immediatesavetwopassdata{test}{}{First Entry}
One: \gettwopassdata{test}\twopassdata
\startluacode
commands.savetwopassdata("test","Second Entry")
\stopluacode
Two: \ctxl
ableaction(textlineactions,format("thirddata.comments.filters.%s",name))
end
\stopluacode
\unprotect
\unexpanded\def\installcomments{\dodoubleargument\doinstallcomments}
\def\doinstallcomments[#1][#2]%
{\ctxlua{thirddata.comments.install(\!!bs#1\!!es,\!!bs\detokenize{#2}\!!es)}}
.sequencers.enableaction(textlineactions,"thirddata.comments.translate")
end
function comments.disable()
utilities.sequencers.disableaction(textlineactions,"thirddata.comments.translate")
end
comments.disable()
\stopluacode
\def\enablecomments {\ctxlua{thirddata.comments.enable()}}
\def\disable
ns,"thirddata.comments.translate")
end
function comments.disable()
utilities.sequencers.disableaction(textlineactions,"thirddata.comments.translate")
end
comments.disable()
\stopluacode
\def\enablecomments {\ctxlua{thirddata.comments.enable()}}
\def\disable
;endgroup
<*> chem_z_zero("\dochemicaltext{O}")
;
...
1 \starttext
2 \startchemical
3 \chemical [ONE,Z0] [O]
4 >> \stopchemical
5 \stoptext
6
\stopchemical ...erence \ctxlua {chemicals.stop()}
eif r_one == r_two then
context("[same pagenumbers]")
else
context("[different pagenumbers]")
end
end
\stopluacode
\ctxlua{document.pagesetup("one","two")}
\ctxlua{document.pagesetup("one","two-a")}
\ctxlua{document.pagesetup("two-a&quo
rackets. Here is a short example:
>>
>> \starttext
>> sometext
>> \reference[myref]{}
>> is
>> \ctxlua{tex.print(\atpage[myref])}
>> \stoptext
>>
>> Is there a way to mask the brackets?
>
> "\atpage[myref]"
>
My lua functi
ext
>> sometext
>> \reference[myref]{}
>> is
>> \ctxlua{tex.print(\atpage[myref])}
>> \stoptext
>>
>> Is there a way to mask the brackets?
>
> "\atpage[myref]"
>
My lua function doesn't just print the parameter. I have a functio
On 3-11-2011 10:15, Martin Fechner wrote:
Hi all,
I try to call a lua-function, but it seems that it doesn't work if the
parameter contains squared brackets. Here is a short example:
\starttext
sometext
\reference[myref]{}
is
\ctxlua{tex.print(\atpage[myref])}
\stoptext
Is there a way to
Hi all,
I try to call a lua-function, but it seems that it doesn't work if the
parameter contains squared brackets. Here is a short example:
\starttext
sometext
\reference[myref]{}
is
\ctxlua{tex.print(\atpage[myref])}
\stoptext
Is there a way to mas
limitation by using
\ctxlua{os.copy(...)}. Ideally, one should be able to use
\ctxlua{os.rename(...)} but os.rename does not work on Windows.
Aditya
___
If your question is of interest to others as well, please add an entry to
e of a dimension with
\number:
\starttext
\scratchdimen=3pt
\number\scratchdimen
\ctxlua{context(tex.dimen["scratchdimen"])}
\stoptext
which also means that you can say \scratchcounter=\scratchdimen and test
dimens as if they are numbers ... this is why we can have
\let\ifzeropt\ifcase
w
h
\number:
\starttext
\scratchdimen=3pt
\number\scratchdimen
\ctxlua{context(tex.dimen["scratchdimen"])}
\stoptext
Wolfgang
___
If your question is of interest to others as well, please add an entry to
Thank you for your detailed information.
2011/10/25 Hans Hagen :
> On 25-10-2011 14:09, Lutz Haseloff wrote:
>>
>> Hi all,
>>
>> some months ago I printed the name of the current font with following
>> code:
>>
>> \starttext
>> The current font
On 25-10-2011 14:09, Lutz Haseloff wrote:
Hi all,
some months ago I printed the name of the current font with following code:
\starttext
The current font is: \ctxlua{tex.print(font.getfont(font.current()).fullname)}.
\stoptext
Now I get an error message:
! LuaTeX error:1: no string to print
On Tue, Oct 25, 2011 at 2:09 PM, Lutz Haseloff
wrote:
> Hi all,
>
> some months ago I printed the name of the current font with following code:
>
> \starttext
> The current font is:
> \ctxlua{tex.print(font.getfont(font.current()).fullname)}.
> \stoptext
>
&
Hi all,
some months ago I printed the name of the current font with following code:
\starttext
The current font is: \ctxlua{tex.print(font.getfont(font.current()).fullname)}.
\stoptext
Now I get an error message:
! LuaTeX error :1: no string to print
stack traceback:
[C]: in function
Thanks,
I was already trying to jump through the hoops of \ctxlua, but this is really
simple and exactly what I needed. The offline calls to context/metapost figure
production now can get all the information needed to synchronize with the main
document.
Hans van der Meer
On 16 okt. 2011, at 19
\setupbodyfont
[cambria]
\starttext
\ctxlua{moduledata.fonts.show_a_lot("Cambria")}
\stoptext
It probably needs to be improved. Users are welcome to submit additional
(language related) sample alphabets etc. It might also become an option
for mtx-fonts.lua
== There has been a cha
\dosetcolorattribute\??ur\c!color
\goto{\hyphenatedurl{\ctxlua{structures.references.urls.get("#1","\@@uralternative","\@@urspace")}}}[fileorurl(#1)]%
\endgroup}
but this makes \url inherit the style from \setupinteraction rather than
\setupurl.
Also, \url does
> color rendered seems to kick in (in acrobat).
>
You can try to add
\startluacode
function backends.codeinjections.rgbtransparencygroup()
local d = lpdf.dictionary {
S = lpdf.constant("Transparency"),
CS = lpdf.constant("DeviceRGB"),
telse{#1}%
{\getparameters[\??pb][k=\s!unknown,t=article,n=,s=,a=,y=,o=,u=,#1]}%
{\getparameters[\??pb][k=#1,t=article,n=,s=,a=,y=,o=,u=]}%
\ctxlua{bibtex.hacks.register("\@@pbk")}%
\catcode\commentasciicode\othercatcode
\dodostartpublication}
\def\dodostartpublication#1\s
luacode into
my-module.mkiv file, then I have a problem with catcodes inside strings defining
by [[ ... ]].
>
> Or must be module consists of two separate files (my-module.lua and my-module.mkiv)? Must I to load the Lua module file (my-module.lua) into ConTeXt module file (my-module.m
file (my-module.lua) into
> ConTeXt module file (my-module.mkiv) by command \ctxlua{dofile("my-module.lua
> ");} and then load module file (my-module.mkiv) into my user file by command
> \usemodule[my-module]?
>
> Is there something like \useluamodule[] or
> \usem
de strings
defining by [[ ... ]].
Or must be module consists of two separate files (my-module.lua and
my-module.mkiv)? Must I to load the Lua module file (my-module.lua)
into ConTeXt module file (my-module.mkiv) by command
\ctxlua{dofile("my-module.lua ");} and then load module file
(
context(values[arg])
else
context("Invalid index.")
end
else
context("Invalid command.")
end
end
\stopluacode
\starttext
\starttabulate
\NC \type{\macroI} \EQ \ctxlua{test("\\macroI")
context("Invalid index.")
end
else
context("Invalid command.")
end
end
\stopluacode
\starttext
\starttabulate
\NC \type{\macroI} \EQ \ctxlua{test("\\macroI")} \NC\NR
\NC \type{\macroII} \EQ \ctxlua{test("
1 um 14:42 schrieb Jaroslav Hajtmar:
Thanx Wolfgang.
But I guess I was wrong to express..
I need to pass parameter '\\macroI' to the function and turn it up a inside
luafunction expand to its value.
Not possible.
Ie when \def\macroI{6}
Then I need when I make in y
>
> Then I need when I make in your example \ctxlua{test("\\macroI")} get the
> result :
> "The argument “6” is a positive number" and not result "The argument “6” is a
> string."
That’s odd because for me
\ctxlua{test("\macroI")}
results
Thanx Wolfgang.
But I guess I was wrong to express..
I need to pass parameter '\\macroI' to the function and turn it up a
inside luafunction expand to its value.
Ie when \def\macroI{6}
Then I need when I make in your example \ctxlua{test("\\macroI")} get
the result :
t;,arg)
else
context("The argument \\quotation{%s} is a negative
number",arg)
end
else
context("The argument \\quotation{%s} is a string."
g.." is number.\\par ")
else
context(arg.." is not number.\\par")
end
if type(tonumber(arg))=='number' then
context(arg.." is number.\\par ")
else
context(arg.." is not number.\\par")
end
end
\stopluacode
\starttext
\
On 14-7-2011 5:12, Jaroslav Hajtmar wrote:
To show what macros I want to convert, I mention these examples:
\def\opencsvfile{%
\dosingleempty\doopencsvfile%
}
\def\doopencsvfile[#1]{%
\dosinglegroupempty\dodoopencsvfile
}
\def\dodoopencsvfile#1{%
\iffirstargument
\ctxlua
macros I want to convert, I mention these examples:
\def\opencsvfile{%
\dosingleempty\doopencsvfile%
}
\def\doopencsvfile[#1]{%
\dosinglegroupempty\dodoopencsvfile
}
\def\dodoopencsvfile#1{%
\iffirstargument
\ctxlua{thirddata.scancsv.opencsvfile("#1")}
\else
\ctxlu
ext/base] grep
-n xmlsetent *
lxml-ini.mkiv:343:\def\xmlsetentity#1#2{\ctxlua{xml.registerentity('#1',\!!bs\detokenize{#2}\!!es)}}
lxml-ini.mkiv:346:% \xmlsetentity{tex}{\TEX{}} % {} needed
Regards, Philipp
>Shouldn't it be
context.bTD()
if i < nofdays +1 then
context(i)
else
context()
end
context.eTD()
context.eTR()
end
context.eTABLE()
end
\stopluacode
\def\maandtabel#1{\
LuigiYY(s)
end
end
\stopluacode
\def\ThisHelpsLuigiX#1{\ctxlua{LuigiX('#1')}}
\def\ThisHelpsLuigiY#1{\ctxlua{LuigiY('#1')}}
\def\LuigiYY#1{#1\hskip\zeropoint plus .1pt\relax}
The disadvantage of the lua way is that for long strings we end up with
a lot of
On Thu, Jun 09 2011, Procházka Lukáš Ing. - Pontex s. r. o. wrote:
> but I'd need to get also the source file name ("Source.mkiv") and the option
> ("--result" -> "Result.pdf").
\starttext
result (lua): \ctxlua{context(environment.outputfilena
ysis) for some reason.
>
> Anyone knows why ?
>
> \enableregime[il1]
> \starttext
> \startluacode
> userdata = userdata or {}
> math.randomseed( os.time() )
> function userdata.random(...)
> context(arg[math.random(1, #arg)])
> e
> > math.randomseed( os.time() )function userdata.random(...)
> > context(arg[math.random(1, #arg)])
> > end\stopluacode\def\CHOOSERANDOM#1{\ctxlua{userdata.random(#1)}}\dorecurse{10}{\CHOOSERANDOM{"Maths",
> > "Physics", "Alge
userdata.random(...)
context(arg[math.random(1, #arg)]) end\stopluacode\def\CHOOSERANDOM#1{\ctxlua{userdata.random(#1)}}\dorecurse{10}{\CHOOSERANDOM{"Maths",
"Physics", "Algebra", "Analysis", "Chemistry", "Geometry", "Wave eq
[math.random(1, #arg)])
end\stopluacode\def\CHOOSERANDOM#1{\ctxlua{userdata.random(#1)}}\dorecurse{10}{\CHOOSERANDOM{"Maths",
"Physics", "Algebra", "Analysis", "Chemistry", "Geometry", "Wave equation",
"Schrödinger equati
\ctxlua{document.r("math physics")}
(untested)
-
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 |
esent = true
>end
>end
>context.externalfigure({file}, args_present and t)
> end
> \stopluacode
>
> \startxmlsetups xml:externalfigure
> \ctxlua{my_externalfigure("\xmlatt{#1}{resource}",
>{width = "\xmlatt{#1}{width}", height = "\xmlatt{#1}{hei
setups xml:externalfigure
\ctxlua{my_externalfigure("\xmlatt{#1}{resource}",
{width = "\xmlatt{#1}{width}", height = "\xmlatt{#1}{height}"})}
\stopxmlsetups
My first idea was "\expanded{\externalfigure[...][\doif...]}" but it
does not work...
you can
igure(file, t)
local args_present
for k, v in pairs(t) do
if v == "" then
t[k] = nil
else
args_present = true
end
end
context.externalfigure({file}, args_present and t)
end
\stopluacode
\startxmlsetups xml:externalfigure
\ctxlua{my_ex
On 1-6-2011 10:14, Hans Hagen wrote:
[[ ]] vs " " is a lua thing ... but when you pass things from within
tex, expansions happens the same in both; you can try
context("\detokenize{...}")
Sorry, that should have been
\ctxlua{"\detokenize{...}"}
which takes
uatex sets locale to "C".
To see the differences in the environment, just do "set >/tmp/set-shell"
and run context on:
--8<---cut here---start----->8---
\starttext
\ctxlua{os.execute"set >/tmp/set-context"}
\stoptex
o see the differences in the environment, just do "set >/tmp/set-shell"
and run context on:
--8<---cut here---start->8---
\starttext
\ctxlua{os.execute"set >/tmp/set-context"}
\stoptext
--8<---cut here
quot;] ]
$
> - If that also fails, then some other program that reads a file and writes
> its contents to another file.
Usinng the following
\defineexternalfilter
[rest]
[filter={cat \externalfilterinputfile\space | tee
\externalfilterou
rst file with a unicode letter (no
table)?
- If that also fails, then a simple markdown file with a unicode letter.
- If that also fails, then some other program that reads a file and writes
its contents to another file.
- Manually execute the shell command from inside ConTeXt using
\ctxlua
an use:
>
> > \defineconversion[fancy][1,2,5,6,8]
>
> This is ok if the complete list is not too long and when you know
> which numbers the "holes" should have, but I would suspect that
> Alasdair want to be able to increment somewhere the actual counte
ewhere the actual counter
by 1 or 2 without having to check the actual number first.
> There is no interface to increment the counter by arbitrary amount, but
> you can define your own interface to structures.counters.add:
>
> \unprotected
> \def\a
st,
\setstructurecounter[\currentitemgroupcounter]{5}
There is no interface to increment the counter by arbitrary amount, but
you can define your own interface to structures.counters.add:
\unprotected
\def\addtostructurecounter [#1]#2{\ctxlua{structures.counters.add
("\@@thestructurecount
ups xml:pb
\def\svopage{\xmlatt{#1}{n}.}
\xmlflush{#1}
\stopxmlsetups
\startluacode
function filter(lb)
if math.mod(lb,5) == 0 then
context.svopage()
context(lb)
end
end
\stopluacode
\define[1]\MyNumber%
{\ctxlua{filter(#1)}\endgraf}
\startxmlsetups xml:lb
\xmld
)
local l = lists.result[n]
local t = l.titledata
if t then
texsprint(t.label or default or "")
end
end
and then in strc-lst.mkiv:
\edef\currentlistlabel{\ctxlua{structures.lists.la
et
are the same as using texexec, not context.
IIRC, there were some security concerns with MkIV:
\ctxlua{os.execute("cat /etc/passwd")}
Althoug I admit that I tested it long ago (early days of mkiv) there is
some control built in:
system.executionmode
system.executionlist
the mode
701 - 800 of 1195 matches
Mail list logo