Hi there,
I'm looking at Wikklytext and designing my own macro. I have got the
Hello World macro running so am set up in this respect however I want
to make some global variables available to the macro.
I am assuming the WikContext would be the best place to do this but I
have no idea how to prep the WikContext variable to contain this
variable.
To best explain I'll try using an example:
#Example:
#define a variable:
foo = {'a':{'variable':2},b:{'variable':3}}
#define a macro
def macro(context, *args):
multiplier = int(args[0].text)
bar =(context.foo.a.variable * multiplier) +
(context.foo.b.variable * multiplier)
return str(bar)
#run wikklytext
wikklytext.WikklyText_to_InnerHTML(arguments)
The result of this would make the <<macro 4>> render 20 in this case.
How would I go about doing something like this? Which argument would
this be passed in for the call to WikklyText_to_InnerHTML?
Really hope you can make sense of what I am trying to achieve here.
Many thanks
Jon
--
You received this message because you are subscribed to the Google Groups "WikklyText" group.
To post to this group, send email to wikkl...@googlegroups.com.
To unsubscribe from this group, send email to wikklytext+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/wikklytext?hl=en.
Sort of.. I'm using raw python code.
What I don't understand is I have a complex python data structure -
environ -(a dictionary containing strings, integers and other
dictionaries) and I want to access it from my macro.
I try
tiddler =context.var_set("environ",environ)
However when I try:
environ =context.var_get("environ")
Instead of getting the dictionary I get a text element....? (<Element
'Text' at 0x17d4b30>)
To unsubscribe from this group, send email to wikklytext+...@googlegroups.com.
Sample code might help:
So I run the code below.
My log statement suggests it has done what I want.
However in my macro when I try to get the value
eg. context.uservars["environ"]
I find it doesn't exist. In fact context.uservars is empty. Am I
setting this too early in my code? Where does it get overwritten?
To unsubscribe from this group, send email to wikklytext+...@googlegroups.com.
Much appreciated.
Jon
> ...
>
> read more »
> ...
>
> read more »
--
You received this message because you are subscribed to the Google Groups "WikklyText" group.
To post to this group, send email to wikkl...@googlegroups.com.
I'm told this might provide a good starting point:
http://peak.telecommunity.com/DevCenter/setuptools#making-your-package-available-for-easyinstall
Jon
On Dec 18, 6:53 pm, Frank McIngvale <fmcingv...@gmail.com> wrote:
> Actually I'm not putting the 1.9.x series on PyPI yet -- there are some
> compatibility breaks in how the wiki attaches to Apache and I wanted to give
> anyone running the wiki a chance to switchover without breaking it. I'll be
> posting the link here instead.
>
> BTW, I'm not familiar with the notation like "wikklytext==dev" -- does PyPI
> let you post "stable" vs "dev" releases? I looked before but couldn't find
> anything like that.
>
> frank
>
> On Fri, Dec 18, 2009 at 10:51 AM, jdlrobson <jdlrob...@gmail.com> wrote:
> > Great.
> > Am assuming doing pip install wikklytext==dev will give me the latest
> > version when it is released?
> > My rss feed is now pointed athttp://wikklytext.com/wiki/rss.xmlas I
> ...
>
> read more »
> ...
>
> read more »
> On Fri, Dec 18, 2009 at 1:05 PM, jdlrobson <jdlrob...@gmail.com> wrote:
> > I've not had any experience myself but it's definitely possible (pip
> > for install can be installed in this way - pip install pip==dev and
> > pip install pip both work.
>
> > I'm told this might provide a good starting point:
>
> >http://peak.telecommunity.com/DevCenter/setuptools#making-your-packag...
> ...
>
> read more »