I also suspect it's a darn sight easier to construct a Reg Exp when
you know what you want to do as opposed to deconstructing one to see
what it does.
And so on to the IntelliTaggerPlugin [edit] feature
The ability to edit tags without needing to edit the tiddler is very
appealing, as is (are?) TagglyTags
I'd like to be able to incorporate IT's [edit] in the tag list style
used by QuickOpenTagsPlugin.
It's kind-of do-able by replacing the TagglyTags macro hideSomeTags
by "tags" but I'm not sure if that will cause unwanted side
effects. I've not spotted the tags that it is supposed to hide but
it'd be better to keep to the original where possible.
Also I'm not happy with having [edit] alongside the tags, it takes
space feels wrong.
It'd be better (IMO) if it could appear at the top right of the blue
drop-down panel (not asking for much ;)
Getting this to happen is completely defeating me as I cannot yet
follow how Intellitags inserts its [edit] in the original Tags box.
Anyone feel like helping/advising?
chris :-)
The "[edit]" button for the tags is created with the function
abego.IntelliTagger.createEditTagsButton = function(tiddler, place,
text, tooltip, className, id, accessKey)
in the IntelliTagger code
(http://tiddlywiki.abego-software.de/#IntelliTaggerPlugin).
You will find it is called within the overloaded
config.macros.tags.handler function, to add the "[edit]" button behind
the items already created by the original tags.handler function. It is
possible to add this button at other places (e.g. to the right of the
"tags:" text) but most of these locationsrequire some assumption on the
structure of the list that I didn't want to rely on. But of cause you
may modify the code and place the button at other loactions if you like
to. Just call the createEditTagsButton function and pass the proper place.
Udo
--------
Udo Borkowski
http://tiddlywiki.abego-software.de
I also suspect it's a darn sight easier to construct a Reg Exp when
you know what you want to do as opposed to deconstructing one to see
what it does.
On 6/16/06, Chris Lawley < ch...@art-en-soul.cix.co.uk > wrote:
I also suspect it's a darn sight easier to construct a Reg Exp when
you know what you want to do as opposed to deconstructing one to see
what it does.
You're right, regexps often make for "write only" code :) My favourite regex is this one that correctly validates email addresses:
http://ex-parrot.com/~pdw/Mail-RFC822-Address.html
It's sometimes possible to translate one to english though. If you post the regex here I'll have a go.. hopefully it'll be fun and educational for both of us :)
;Daniel
# Preloaded methods go here.
my $lwsp = "(?:(?:\\r\\n)?[ \\t
])";
my $char = '[\\000-\\177]';
sub make_rfc822re {
# Basic lexical tokens are specials, domain_literal, quoted_string, atom, and
# comment. We must allow for lwsp (or comments) after each of these.
# This regexp will only work on addresses which have had comments stripped
# and replaced with lwsp.
my $specials = '()<>@,;:\\\\".\\[\\]';
my $controls = '\\000-\\037\\177';
my $dtext = "[^\\[\\]\\r\\\\]";
my $domain_literal = "
\\[(?:$dtext|\\\\.)*\\]$lwsp*";
my $quoted_string = "\"(?:[^\\\"\\r\\\\]|\\\\.|$lwsp)*\"$lwsp *";
# Use zero-width assertion to spot the limit of an atom. A simple
# $lwsp* causes the regexp engine to hang occasionally.
my $atom = "[^$specials $controls]+(?:$lwsp+|\\Z|(?=[\\[\"$specials]))";
my $word = "(?:$atom|$quoted_string)";
my $localpart = "$word(?:\\.$lwsp*$word)*";
my $sub_domain = "(?:$atom|$domain_literal)";
my $domain = "$sub_domain(?:\\.$lwsp*$sub_domain)*";
my $addr_spec = "$localpart\@$lwsp*$domain";
my $phrase = "$word*";
my $route = "(?:\@$domain(?:,\@$lwsp*$domain)*:$lwsp*)";
my $route_addr = "
\\<$lwsp*$route?$addr_spec\\>$lwsp*";
my $mailbox = "(?:$addr_spec|$phrase$route_addr)";
my $group = "$phrase:$lwsp*(?:$mailbox(?:,\\s*$mailbox)*)?;\\s*";
my $address = "(?:$mailbox|$group)";
return "$lwsp*$address";
}
Getting OT here but.. I was curious about this. It seems insane. The page doesn't mention that the re doesn't appear in the code. Here is the actual code which constructs it. I bet some of the regexps in the pre 2.0 wikifier would have similarly long and unreadable.# Preloaded methods go here.
my $lwsp = "(?:(?:\\r\\n)?[ \\t ])";my $char = '[\\000-\\177]';
sub make_rfc822re {
# Basic lexical tokens are specials, domain_literal, quoted_string, atom, and
# comment. We must allow for lwsp (or comments) after each of these.
# This regexp will only work on addresses which have had comments stripped
# and replaced with lwsp.my $specials = '()<>@,;:\\\\".\\[\\]';
my $controls = '\\000-\\037\\177';
The only change to analyse such a RegEx is to split it up, e.g. like this:
Sorry, Daniel, I forgot....
Next time...
Or maybe: What about this: new
RegExp("\\[([<]{0,1})([>]{0,1})[Ii][Mm][Gg]\\[(?:([^\\|\\]]+)\\|)?([^\\[\\]\\|]+)\\](?:\\[([^\\]]*)\\]?)?(\\])")
Udo
Daniel Baird wrote:
> On 6/17/06, *Udo Borkowski* <Udo.Bo...@gmx.de
> taken all the fun out of it.
Sorry, Daniel, I forgot....
Next time...
Or maybe: What about this: new
RegExp("\\[([<]{0,1})([>]{0,1})[Ii][Mm][Gg]\\[(?:([^\\|\\]]+)\\|)?([^\\[\\]\\|]+)\\](?:\\[([^\\]]*)\\]?)?(\\])")
Now, I'm pretty sure I've got something wrong in there, because i think the optional trailing ] on the second last line of my final breakdown would allow wrong syntax for the img tag.
Actually, I'd rather keep Trac focused on the core code and the
cooking tools for the moment. We will be opening up Subversion to
third party plugins, and that would be the time to start tracking
issues for them.
Cheers
Jeremy.
--
Jeremy Ruston
mailto:jer...@osmosoft.com
http://www.tiddlywiki.com
Best wishes,
Jeremy
> Daniel: I suggest that you post this as a bug ticket in Trac (i.e. the
> second last ? is too much).
> (http://trac.tiddlywiki.org/tiddlywiki)
Actually, I'd rather keep Trac focused on the core code and the
cooking tools for the moment. We will be opening up Subversion to
third party plugins, and that would be the time to start tracking
issues for them.
On 6/19/06, Jeremy Ruston <jeremy...@gmail.com> wrote:
> Daniel: I suggest that you post this as a bug ticket in Trac (i.e. the
> second last ? is too much).
Actually, I'd rather keep Trac focused on the core code and the
cooking tools for the moment. We will be opening up Subversion to
third party plugins, and that would be the time to start tracking
issues for them.
I'm confused now.. I thought that regex was from the standard wikifier? I never did get the lawn mowed, I'd like to think all that work was helping TiddlyWiki in some way ;)
And, I'm now certain this thread should be on the dev list, not the main list!
;Daniel
--
Daniel Baird
http://danielbaird.com (TiddlyW;nks! :: Whiteboard Koala :: Blog :: Things That Suck)