Commit graph

319 commits

Author SHA1 Message Date
Platonides
691b4618e2 Document parser, add test cases for the external entry points to it. 2010-12-26 19:30:10 +00:00
Platonides
fe14fdefa7 Store the options used by the parsing in ParserOutput, per r70783 CR. 2010-12-26 19:21:45 +00:00
Brian Wolff
ff5394caed (Bug 26410) In an internal link, a plus sign is treated as a space if the link
has a % sign in it, but interperted as a + if no % sign is present.

This changes how the parser interperts links slightly. However:
*I can't imagine anyone is relying on this behaviour
*Things should be consistent. a + sign shouldn't magically change meaning
if there is a % sign somewhere else in the link.
*Pages are allowed to contain % signs in their title, and + signs,
you should be able to link to such pages just by typing there name without
resorting to %2B.
*If you have a page named foo%+ having [[{{PAGENAME}}]] link to a different
page seems inherently wrong.
*The previous behaviour seemed accidental.
2010-12-24 09:53:08 +00:00
Mark A. Hershberger
aa08646a71 Misc whitespace changes, mostly EOL w/s and indention fixes so TAB = 4 spaces 2010-12-19 04:31:15 +00:00
Tim Starling
36d43eabc0 Fixed comments and indenting style from r68491. 2010-12-14 09:01:48 +00:00
Mark A. Hershberger
e002df9eca * Add FIXME about the bug I found during testing
* Make the only instance of the ParserOptions::getMaxIncludeSize() that doesn't match its method signature match.
2010-12-11 03:53:22 +00:00
Mark A. Hershberger
2e18112d60 Whitespace changes (before others) — “svn diff -x-w” shows no changes 2010-12-11 03:52:35 +00:00
Alexandre Emsenhuber
6d60b96223 Moved constant values from constructor to class definition 2010-12-10 18:48:11 +00:00
Alexandre Emsenhuber
58d09d4d53 Fixes for r78201:
* Per Reedy, add braces where needed
* Revert one change that should not have been there
2010-12-10 18:23:33 +00:00
Alexandre Emsenhuber
510309e4ab * (bug 19006) {{REVISIONUSER}} no longer acts like {{CURRENTUSER}} in some cases
* Removed other usages of $wgUser in Parser stuff, as stated in doc
* Added mechanism to get an User object in Parser, based either on the object given in Paser::preSaveTransform() or the ParserOptions otherwise
2010-12-10 18:17:20 +00:00
Chad Horohoe
699e53dc2f Revert r68230, r68231 (mode="grid" on tables) per CR. It's in the history if anyone wants to work on this again 2010-12-10 16:03:57 +00:00
Sam Reed
c14037a2e0 Fix 1 deprecated method call in SpecialPage, and 3 non static methods called statically 2010-11-28 16:04:48 +00:00
Sam Reed
c15c1c6abb More reversion of r77297, 2 of 2 commits to keep it readable in CR (hopefully) 2010-11-25 22:24:28 +00:00
Antoine Musso
6fe29c9c30 revert r76464
* mixed style changes and variable removing
* logic changes
* useful comments removed
2010-11-25 20:01:34 +00:00
Sam Reed
a54a1ee178 Fixup some more documentation 2010-11-13 00:47:51 +00:00
Sam Reed
10ecfeb03b Various unused variables, add some braces
Explicitally define some variables used in hook type calls
2010-11-10 19:49:04 +00:00
Sam Reed
1e4934e9b7 foreach loop is pointless if you're then just going to keep a counter manually
Hence switch foreach to for loop
2010-11-10 19:19:46 +00:00
Alexandre Emsenhuber
1a4957e0b4 * (bug 21364) External links using link= attribute on images now respect $wgExternalLinkTarget 2010-11-09 12:25:57 +00:00
Sam Reed
d08f91f596 Per CR on r45418...
Explicitally define $refers = array();, as it being in a loop is just slight confusing with the isset
2010-10-18 23:50:33 +00:00
Sam Reed
44cf22acfc Followup r69904, make call to getRandomString static in Parser->unserialiseHalfParsedText() 2010-10-17 18:51:00 +00:00
Alexandre Emsenhuber
f5f01d7d23 Per Platonides, follow-up to r67834: fix doc and removed no more needed return-by-ref of Parser::getTitle() 2010-10-16 18:58:29 +00:00
Platonides
405bc4d998 Follow r69904. Make Parser::getRandomString real private.
Parser_DiffTest::dtUniqPrefix is now lazyloader.
I also fixed the typo in its declaration.
2010-10-15 22:12:19 +00:00
Sam Reed
6b3b915353 Big attack on unused variables... 2010-10-14 20:53:04 +00:00
Platonides
7b6afb1996 Change the FIXME to the other way.
The issue is, php strtolower() calls tolower(3), which is locale sensitive.
Eg. LC_ALL='pt_BR.ISO-8859-1' php -r'echo strtolower("ÉÁÇÚÍ");'

Adding a call to setlocale(LC_ALL,'C'); in Setup.php may be a good idea.
2010-10-08 22:51:03 +00:00
Platonides
3d408e8d5b Remove $wgServerName. Its only usage was for {{servername}}, and needed to be kept in sync with $wgServer in LocalSettings.
None of the 3 globals based on it changed if you set it in LocalSettings.

Note that all those !isset( $wgServerName ) in ApiTests were useless, since if not in LocalSettings it would be 'localhost', not null (as still are those !isset( $wgServer )).
2010-09-29 15:47:56 +00:00
Sam Reed
22764a53f8 Braces, spaces, and a few unused arrays 2010-09-21 06:55:49 +00:00
Platonides
537826a674 Remove $wgContLanguageCode usage in core.
sed -i 's/$wgContLanguageCode/$wgLanguageCode/g'
These are now the same, always. Per and since r15827.

$wgLanguageCode wins due to being the one set by LocalSettings.

$wgContLanguageCode definition at includes/Setup.php kept for now.
2010-09-07 22:37:55 +00:00
Conrad Irwin
efb47b97d2 Bug 6204 - TOC not properly rendered when using $wgMaxTocLevel
Credit for mini-patch to Brandon Ooi
2010-09-04 00:03:45 +00:00
Sam Reed
18346aa7e2 Remove unused global
Simplify some logic
2010-09-02 23:12:47 +00:00
Philip Tzou
0f6c992519 follow up r69134. Change all of convertLinkToAllVariants()'s callers to call autoConvertToAllVariants(). 2010-08-23 02:07:31 +00:00
Sam Reed
721ecb6d2d Remove some more unused variables
Remove srvus() from Parser, unused, and calling testSrvus wrongly
2010-08-19 11:21:14 +00:00
Platonides
9e96f8db77 Parser should only use content messages. 2010-08-12 13:23:28 +00:00
Platonides
69ad72018b Followup r70783. Give doEditSectionLink an extra parameter with the language to use for the editsection. 2010-08-12 12:30:47 +00:00
Platonides
a72332929c getSkin() should get a Title as parameter. 2010-08-11 17:11:24 +00:00
Platonides
34d35fb6f9 Use only the page relevant pieces in the parser cache key. Eg. two users with different math options will now
use the same parsercache entry for articles without <math> tags.
The cache key format is kept as a fallback so the old cached entries can be reused.

Should boost parsercache hits, but it also makes easier to pollute the parsercache by tag hooks that behave 
badly, directly using $wgUser or $wgLang.

Extensions hooking PageRenderingHash now see !edit=0 and the !printable=1 bits.

Fixes bug 24714 - Usage of {{#dateformat: }} in wikis without $wgUseDynamicDates can lead to unexpected results

Builds upon r70498, r70498, r70501, r70517, r70651, r70653, r70765, r70780.
2010-08-09 21:53:21 +00:00
Platonides
6d20e79faf Make thumbsize option go through ParserOptions.
Yet another parameter for makeImageLink2...
2010-08-07 22:35:23 +00:00
Aryeh Gregor
65e8acdf0a Improve $wgExperimentalHtmlIds support
Now works (again?) in IE6.  That didn't like getting non-legacy ID's on
redirects -- it doesn't interpret them as UTF-8, so anything non-ASCII
breaks.  If this works in all the browsers I test in, I'll enable it --
it will produce *much* nicer-looking anchors for non-English wikis, and
also section names with English punctuation.
2010-08-05 20:16:43 +00:00
Platonides
9c143c5900 Use ParserOptions accessors.
Only one direct usage remains, in ParserCache::getKey, which will be rewritten.
2010-08-05 19:01:47 +00:00
Sam Reed
5582aca1ed * (bug 23848) Add {{ARTICLEPATH}} Magic Word
Apply my patch, as it seems to be working when I tried it this time
2010-08-05 15:21:15 +00:00
Platonides
5dd9a37af3 Follow up r70498. Actually remove the quickUserCan(). 2010-08-05 14:46:14 +00:00
Platonides
7bfebad308 Change quickUserCan( 'edit' ) and getIsPrintable() into setEditSection( false )
Follow up r48544. Init ParserOptions::mIsPrintable in initialiseFromUser()
Move the "No edit section it's printable" from Parser to Article.
This leaves getIsPrintable() unused. Left there for extensions (none seems to be using it, could be removed).

The "even if the user has them on" comment wasn't accurate. The user preference only controls them via CSS.
Anyway, it would work as expected now if it got moved into ParserOptions. The setEditSection() no longer set it to true.

Remove the quickUserCan( 'edit' ) which is just a hidden way of calling $wgUser from the Parser to be explicitely 
done in Article to disable the editsection. This results in quickUserCan being called once instead of twice if $wgUseETag == true;.
2010-08-05 14:37:50 +00:00
Platonides
b572c9c147 Followup r69961. Remove now unused global. 2010-07-27 12:19:08 +00:00
Platonides
c7e85a5e04 Insert a new line in between when adding </td><td> in tables.
This is html neutral, but helps the parser to realise that things should be broken there.
Fixes the tag nesting issues of the [ftp://|x||]] parser test.
Parser16 test still has its own tag bug.
2010-07-26 22:29:20 +00:00
Aryeh Gregor
022b7ba140 Reconcept cl_raw_sortkey as cl_sortkey_prefix
In response to feedback by Phillipe Verdy on bug 164.  Now if a bunch of
pages have [[Category:Foo| ]], they'll sort amongst themselves according
to page name, instead of in basically random order as it is currently.
This also makes storage more elegant and intuitive: instead of giving
NULL a magic meaning when there's no custom sortkey specified, we just
store an empty string, since there's no prefix.

This means {{defaultsort:}} really now means {{defaultsortprefix:}},
which is slightly confusing, and a lot of code is now slightly
misleading or poorly named.  But it should all work fine.

Also, while I was at it, I made updateCollation.php work as a transition
script, so you can apply the SQL patch and then run updateCollation.php
and things will work.  However, with the new schema it's not trivial to
reverse this -- you'd have to recover the raw sort keys with some PHP.
Conversion goes at about a thousand rows a second for me, and seems to
be CPU-bound.  Could probably be optimized.

I also adjusted the transition script so it will fix rows with collation
versions *greater* than the current one, as well as less.  Thus if some
site wants to use their own collation, they can call it 137 or
something, and if they later want to switch back to MediaWiki stock
collation 7, it will work.

Also fixed a silly bug in updateCollation.php where it would say "1000
done" if it did nothing, and changed $res->numRows() >= self::BATCH_SIZE
to == so people don't wonder how it could be bigger (since it can't, I
hope).
2010-07-26 19:27:13 +00:00
Sam Reed
1a96bd4aa2 Followup r69904 $self to self 2010-07-25 20:51:16 +00:00
Sam Reed
a02f418196 Make getRandomString static as per comment
Fix usage in top of Parser (changed by me earlier)
2010-07-25 20:44:40 +00:00
Sam Reed
8b8500c121 More self:: to $this-> 2010-07-25 18:13:56 +00:00
Sam Reed
04f68827d0 Removal of unused globals
Removal of one setting of a variable to '', then not using further
2010-07-24 19:11:52 +00:00
Roan Kattouw
be40cca131 Kill two functions in Parser that have been ununused forever, add a clarifying comment elsewhere. 2010-07-20 09:23:37 +00:00
Platonides
a5655cfdf2 Update the old magic with new one.
Not only should this have used setContainsOldMagic() instead of manually modifying the member, 
the outdated magic reduced the caching time to one hour even if you just used something like 
{{currentmonth}}, which is hinted to one day.

This is the only usage of old magic, we could remove it but perhaps it is used by some extension?
2010-07-19 23:08:52 +00:00