User talk:AzaToth/Logic

Add discussion
Active discussions

OpinionsEdit

AzaToth asked "what do you think"? Adrian 17:55, 17 December 2005 (UTC)

Looks very promising. Can that be pushed into MediaWiki? And how long does it take until we have that in place? Again, I'm a bloody newbie (but this time a double-plus one). However, I'm really glad to see you walking in that direction. That's very exciting. Thank you very much indeed. Do we have to test that somewhere on a separate setup? Oh my, I'm probably not of much help. One Idea: maybe it would be good to write a bit more about how that can be used in wiki code, this means extending the documentation section, so that people who do not know php programming can read and understand. But I'm not shure. What's prime is that we need a fast track to get that into media wiki (I mean into the platform that runs Wikipedia). Not an endless discussion about all the details. Adrian 17:55, 17 December 2005 (UTC)
But of course we need to thoroughly understand it. So I must relativate "Not an endless discussion about all the details" a bit. What I meant was that it might be good to use just one syntax that works and not debate too long about which syntax to choose, as this might just be personal taste. Thanks for helping me to understand! Adrian 09:56, 18 December 2005 (UTC)
Um. We may need to go for this: New project policy. So there might be no "fast track"... Adrian 10:22, 18 December 2005 (UTC)
Ah, no. Wrong track. "Projects" seem to be whole new wiki-cites. Does not apply to this here. Adrian 14:02, 18 December 2005 (UTC)

SecurityEdit

Why incorporate all of these things in a way that users can manipulate, when you could just modify the mediawiki source? Wouldn't this allow users to write dangerous things?

Templates, for instance, are a sort of middle ground between the regular users and the developers; a way to write some simple code to make life easier for the end user (like using the easily-remembered {{clear}} instead of <br style="clear:both" />). It allows the sort-of knowledgeable users to make shortcuts in the wikitext for the regular users without bothering the busy developers.

But don't these logic functions make the middle ground too powerful? Don't they put dangerous tools in places that are editable by anyone? 151.202.83.149 00:40, 18 December 2005 (UTC)

Re "you could just modify the mediawiki source": As I understand User:AzaToth/Logic it is meant as a modification to the mediawiki source code. Carl? Adrian 09:50, 18 December 2005 (UTC)
Yes it is AzaToth 13:02, 18 December 2005 (UTC)
I meant "why include such basic functions in the Mediawiki source code which can be accessed by users in creating templates?" it seems like it would be a security risk. When a user wants a template with if functionality, in other words, that higher-level functionality should be included in the Mediawiki code, not implemented as a template. 151.202.83.149 20:53, 18 December 2005 (UTC)
This is not implemented as a template. This is syntax included in the mediawiki code AzaToth 21:00, 18 December 2005 (UTC)

Examples dissectedEdit

I have some questions to see if I understand correctly. In the example:

:''Main page{#if|{#gt|{#nparams#}|1#}|s#}: {#[!]map!!![[!]]!, !{#[!]params!*#}#}''

I see this:

:''Main page{#if|{#gt|{#nparams#}|1#}|s#}: {#[!]map!!![[!]]!, !{#[!]params!*#}#}''
            ----- if expression ---------

In the if expression I see:

{#if|{#gt|{#nparams#}|1#}|s#}
     --- test expr. -----

If the test expression evaluates to something non-empty (correct?) then the if expression is expanded as "s#".

"s#" looks like a constant expression. Why do we need the "#" char after "s"?

The test expression is a greather-than-expression

{#gt|{#nparams#}|1#}

It expands to something non-empty if {#nparams#} is greather than 1. "1#" is a constant expression (integer with value 1).

The expression {#nparams#} seems to be the number of parameters.

What do we have to do if we want to write "#gt" literally as article text such that it is not parsed away? What happens if there is somewhere the character sequence "1#" in page text already? Adrian 00:53, 18 December 2005 (UTC)

It search for strings {#...#}, only text inside those get parsed. More exactly the regular expression '\{#(?:(?!.*?\{#))(.*?)#\}' AzaToth 01:13, 18 December 2005 (UTC)
Aah yes. Thanks. Sorry for me being so dumb again :-). I learn by asking silly questions. So it is rather like this:
In the if-expression:
{#if|{#gt|{#nparams#}|1#}|s#}
The final "#" char belongs to the closing "}" of the if-expression. Not to the s. So we could also write it like this to emphasize:
{#if | {#gt | {#nparams #} |1 #} |s #}
This would also be valid "new wiki". Correct? Adrian 09:46, 18 December 2005 (UTC)
  • I assume yes (have to check trim on test first :)), also, delimiter can be overrided by placing [delimiter] befor the keyword AzaToth 13:01, 18 December 2005 (UTC)

DelimiterEdit

Why is this delimiter feature needed? Wouldn't it be sufficient to stick with "|" as delimiter? I fear a bit that presenting too much options to users could confuse them. But I'm not shure. Adrian 18:40, 18 December 2005 (UTC)

The delimiter is optional, and is there for example if you want to use | verbatim inside as a argument, for example a table. To be as fast as possible, it will just split on the delimiter, disregard of any other constructs inside an argument, like for example:
{#[$]if$foo$
{|
|table
|}
#}

works, but

{#if|foo|
{|
|table
|}
#}

does not. AzaToth 19:54, 18 December 2005 (UTC)

Looks interestingEdit

Is this available live anywhere we can get to? —Phil | Talk 13:37, 19 December 2005 (UTC)

commentsEdit

Is yet another syntax ({#...#}) really needed? The template syntax is also used for "Magic words" like PAGENAME. So what about

{{IF|THEN=...|ELSE=...}}
instead of :
{#if|...|...#}
.

Of course you can define the first as a template that includes the second. But I think it's better to force people not to start the unreadable-template-contents from the beginning. Keywords Will also help other people in contributing.

The {{[delim] syntax could also help for normal templates.

To speed up the inclusion of templates a compiler would also help so templates only need to be parsed when they are changed . Or is there already such an internal compiler in MediaWiki?

In every case: thanks for your effort! -- Nichtich 16:22, 3 January 2006 (UTC)

TwinkleEdit

AzaToth,

Is there a chance if twinkle could be placed on meta-wiki, i've found it useful on wikipedia, but wondered if it was possible. →Yun-Yuuzhan 22:47, 30 December 2007 (UTC)
Return to the user page of "AzaToth/Logic".