On 3/20/07, Matt Good <[EMAIL PROTECTED]> wrote:
>
>
> On Mar 20, 11:54 pm, "Stephen Hansen" <[EMAIL PROTECTED]> wrote:
> > Now comes the fun part. We had a number of specialized templates for
> > formatting certain common data in a visually pleasing way. I'm writing
> > simple macros for that (as one-file plugins from WikiMacroBase).
>
> It sounds like you may be putting each macro in a separate .py file
> like how the old-style macros were written.  The new style doesn't
> depend on the filename for the name of the macro so you're actually
> free to define multiple macros in a single class if you prefer.


Well, the only thing I could find was
http://trac.edgewall.org/ticket/4381-- and from that example, I wasn't
even sure just how the heck it got the
name of the macro save from the filename or some odd class-name-fu. I
intended on looking up IWikiMacroProvider since the syntax on said ticket
made it seem a lot cleaner... just never got around to it. :) Still doing
some MediaWiki->Trac data cleanups. (And *so* turning off WIKI_CREATE for
all of the users since they don't grok anything like consistency in naming
schemes or that wiki names shouldn't be oddly cased sentences :P)

> The first big hiccup I've noticed? I like to use keyword arguments, since
> > otherwise the peers won't remember what's what, and looking over the
> > pages... I can't rely upon them ever being able to type them in with the
> > proper case.
> >
> > [[APTBuild(build=256, Revision=4587, date=03/03/2007,
> > path=/release/build256)]]
> >
> > Notice the R. :)
> >
> > The question: Am I missing anything obvious(a feature, option, etc) to
> make
> > this not an issue? If not, then I'll probably end up making a patch to
> have
> > parse_args return a case-insensitive dict.
>
> No, parse_args just returns them in whatever case was provided.  If
> you need to normalize the keyword args to lower-case you can do it
> like:
>
> args, kw = parse_args(arg_string)
> kw = dict([(k.lower(), v) for k,v in kw.iteritems()])
>
> In Python 2.4 and up the square-brackets in the second line are
> optional.  And of course if you're doing this in multiple places you
> may want to define that as a function that you can reuse.


I know how to do it, yes :) I just found it odd that it wasn't an issue for
everyone, that's all. Perhaps my people just use macros themselves a lot
more then the average joe, or are a lot less willing to pay attention to
such things on the fly.

Thanks.

--S

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To post to this group, send email to trac-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/trac-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to