Hello Everyone,
I am trying to add some content to wikitext on 'Save'. The formatting blows up when i refresh the page.
Example: the h2 header now shows as the following after doing $element[$i]=$element[$i]." a " == Call Info == a
*I am using the hook ArticleSave. It seems if i add spaces, newlines it works. but when i add any text it blows up.*
Pls find the code snippet. */**
*adding on the hook $wgHooks['ArticleSave'][] = 'functionA';*
*function functionA(&$article, &$user, &$text, &$summary, $minor, $watch, $sectionanchor, &$flags)*
*$element=explode("\n",$text) for loop $element[$i]=$element[$i]." " // this works $element[$i]=$element[$i]." \n\n " // this works $element[$i]=$element[$i]." a " // this does not *
**/*
*Possible problem area*: it seems the problem is with the Parser.php in the doHeadings function where a regular expression is been checked. Once the text is added seems the parser does not recognise it as header anymore.
It will be nice if someone can provide help on this.
Thanks --Viral
On Mon, Feb 18, 2008 at 07:13:15PM -0500, Viral Gupta wrote:
Hello Everyone,
I am trying to add some content to wikitext on 'Save'. The formatting blows up when i refresh the page.
Example: the h2 header now shows as the following after doing $element[$i]=$element[$i]." a " == Call Info == a
The syntax for a heading is: Equal signs, header text, same number of equal signs again, end of line.
A line that doesn't match this pattern is not a heading, and thus the output is verbatim. What should the meaning of a line like == Call Info == a be? Should "a" be part of the heading? In that case, it should be == Call Info a ==
Regards,
jens
Here in == Call Info == a , a is not part of the header.
In this 'a' could be something like a tag which is added.
Thanks --Viral
On Feb 19, 2008 8:28 AM, Jens Frank jf@mormo.org wrote:
On Mon, Feb 18, 2008 at 07:13:15PM -0500, Viral Gupta wrote:
Hello Everyone,
I am trying to add some content to wikitext on 'Save'. The formatting
blows
up when i refresh the page.
Example: the h2 header now shows as the following after doing $element[$i]=$element[$i]." a " == Call Info == a
The syntax for a heading is: Equal signs, header text, same number of equal signs again, end of line.
A line that doesn't match this pattern is not a heading, and thus the output is verbatim. What should the meaning of a line like == Call Info == a be? Should "a" be part of the heading? In that case, it should be == Call Info a ==
Regards,
jens
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Viral Gupta schreef:
Here in == Call Info == a , a is not part of the header.
In this 'a' could be something like a tag which is added.
Thanks --Viral
Why don't you just put it on a line by itself then?
$code .= "\n" . $tag . "\n";
Roan Kattouw (Catrope)
Doing $code .= "\n" . $tag . "\n" will put the tag on the next line (and we want to have the tag on the same line).
Thanks --Viral
On Feb 19, 2008 10:20 AM, Roan Kattouw roan.kattouw@home.nl wrote:
Viral Gupta schreef:
Here in == Call Info == a , a is not part of the header.
In this 'a' could be something like a tag which is added.
Thanks --Viral
Why don't you just put it on a line by itself then?
$code .= "\n" . $tag . "\n";
Roan Kattouw (Catrope)
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Viral Gupta schreef:
Doing $code .= "\n" . $tag . "\n" will put the tag on the next line (and we want to have the tag on the same line).
Thanks --Viral
That was exactly what it was intended to do. However, putting the tag on the same line is guaranteed to break headers. Is it really that essential that the tag be put on the same line?
Roan Kattouw (Catrope)
Yes thats what the new extension is doing that we are trying to develop.
It will really look very odd if the tag is on next line and the data on the previous line.
Thanks --Viral
On Feb 19, 2008 10:27 AM, Roan Kattouw roan.kattouw@home.nl wrote:
Viral Gupta schreef:
Doing $code .= "\n" . $tag . "\n" will put the tag on the next line (and we want to have the tag on the
same
line).
Thanks --Viral
That was exactly what it was intended to do. However, putting the tag on the same line is guaranteed to break headers. Is it really that essential that the tag be put on the same line?
Roan Kattouw (Catrope)
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Viral Gupta schreef:
Yes thats what the new extension is doing that we are trying to develop.
It will really look very odd if the tag is on next line and the data on the previous line.
A broken header will look even more odd. Perhaps you could detect whether the line you're adding a tag to is a header, and in case it is, add the tag on the next line? When parsing these tags, look back a line to see if the previous line happens to be a header.
Roan Kattouw (Catrope)
On Tue, Feb 19, 2008 at 10:17:56AM -0500, Viral Gupta wrote:
Here in == Call Info == a , a is not part of the header.
In this 'a' could be something like a tag which is added.
If you want to have "a" in the header line, you have to put it between the equal signs. Even if MediaWiki would allow text to occur after the second set of equal signs, a </h2> would still cause a line break.
Regards,
jens
wikitech-l@lists.wikimedia.org