Am Sonntag, 20. April 2014 13:17:54 UTC+2 schrieb Danielo Rodríguez:
>
> They are hard to read,
>

Not in general. They *can* be hard to read..
 

> they are hard to write
>

Not in general. Just for thse who do not yet understand them ;)
 

> and you can get unexpected behaviors.
>

You can get unexpected behaviour all the time you do something on a 
computer.
 

> I want to keep the syntax simple.
>

Great! Regexp syntax is simpl :D (just kidding - a bit)
 

> That way any user can write their own entries. 
>

That's why I propose regexp. That way any user - who understands regexps - 
can write even more powerful shortcuts.
 

> Anyway. Could you explain your idea a bit more? What are the advantages of 
> your idea? I don't understand at all what this does:
>

Sure:
 

> "alt+t" : [ { search:/^/gm, replace:"|" }, { search:/  +/g, replace:"|" },
>  { search:/$/gm, replace:"|" } ]
>

The idea is, that the alt+t handler finds an array of objects. It then 
executes the instructions in each of the array elements. So it searches in 
the tiddler or in the selected range for the regular expression given under 
"search" and replaces the matches with the string given under "replace".

/^/gm means: Search for the start of the line (g=search globally, meaning, 
search the whole range. m=consider the range to consist of multiple lines)

/  +/g means: Search for any space followed by a sequence of 1 or more (+) 
spaces, so search for at least 2 spaces.

/$/gm means: Search for the end of the line. g and m is explained above.

So what this would do is to first search for all linestarts and out a | 
there. Then it would search for all sequences of 2 or more spaces and 
replace them with a pipe. Last it would put a pipe at the end of each line.

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.

Reply via email to