Commit graph

333 commits

Author SHA1 Message Date
Ilmari Karonen
7e5472dea3 followup r80511: make {{PAGENAMEE}} and friends also call wfEscapeWikiText() (why is the code duplicated, anyway??) 2011-01-18 20:15:50 +00:00
Happy-melon
2d8ee839cb (bug 529, bug 12974) alter behaviour of the table- and template-parser:
* Remove the hack from bug 529 which inserts a newline when the template text begins with any block character; this breaks many things in many exciting ways.  I've left it in for now when the text begins with a wikitable, as that markup can't be mistaken for anything else.
* Instead, move the contents of a table cell onto a new line for parsing, so that linestart elements (including nested tables) will parse as normal.  

This means that structures like

{| 
| {{template-containing-wikilist}}
|}

Will still work, but for the right reason, and structures like

{|
| style="color:{{template-containing-hexcode}}" | Foo
| * Bar
| {|
   | Look at me, I'm nested!
  |}
|}

Will all now start to work.  Structures like 

* Foo {{template-containing-wikilist}}

Will now not, but honestly, should they?
2011-01-16 23:57:13 +00:00
Robert Leverington
2a30aa1d25 Add new hook ArticlePrepareTextForEdit, called when preparing text to be saved.
Add new parser option "PreSaveTransform" that allows the pre-save transformation to be selectively disabled.
2011-01-16 21:12:26 +00:00
Platonides
7970796f1a Pasting lines typo in r80025 2011-01-16 16:41:15 +00:00
Daniel Friesen
39ab3cfc9f Implement Message::isBlank and Message::isDisabled.
And while we're at it... update a random assortment of code using wfEmptyMsg to use the new wfMessage class and our exists/isBlank/isDisabled methods.
2011-01-14 10:51:05 +00:00
Platonides
5ceb97cfc3 Follow up r80025.
The space is actually used inside extensions, such as Maps, covertly called as 'display_map' into 
Validator, then converted into 'display map' by getName().
2011-01-12 00:11:11 +00:00
Platonides
f1bcac7be1 Forbid '<', '>', ' ', '\n', '\r' in parser hook names.
Registering a tag hook with < or > on its name resulted in a UNIQ marker.
Spaces, tabs or LF do work (CR fails due to the CR->LF transformation), 
but it's easier to also forbid them, just as they are not allowed in other 
markup languages.
2011-01-11 18:38:32 +00:00
Tim Starling
8e42c60b60 Update comment for r64876 2011-01-07 01:38:06 +00:00
Alexandre Emsenhuber
86d7eeb4d3 Easier method (and to check existence in correct language) 2011-01-05 15:50:34 +00:00
Daniel Friesen
7e0a31a4d4 Allow filenames to be specified in a <gallery> with the File:, Image: or media: omitted by defaulting to NS_FILE. 2011-01-05 06:16:13 +00:00
Platonides
8de91ab2e4 Partial revert of r79520, follow up to r79558. Unconditionally use the new format.
For environments post r70783, they will need to rerender pages with __NOEDITSECTION__ or no headings (hopefully those will be simple pages).
There will be no extra parser cache misses for environments pre r70783.
2011-01-04 11:31:06 +00:00
Daniel Friesen
d3b9fcdc4a Followup r79520 and r79528, one of the args was missing when calling doEditSectionLink. Additionally the LanguageConverter was screwing up editsection markers really badly. Switched to <editsection> pesudo-xml style markers for best compatibility with the language converter. (tags are already escaped so we don't need to worry about similar user input) 2011-01-04 04:20:09 +00:00
Daniel Friesen
ecd545b1fd Followup r79520, some characters inside the encoded data were being modified by the parser causing it to break. Switching to a encoding scheme without that issue and adding a test to throw a less fatal error. 2011-01-03 21:04:05 +00:00
Daniel Friesen
969561ae3c Try to output editsection markers instead of rendered editsection links and defer the rendering to a point where the markup does not need to be stored in the cache.
Doing this allows skins to override doEditSectionLinks without poluting the parser cache or fragmenting the parser cache more.
As a side effect it eliminates the primary cause of user language based parser cache fragmentation.
Because this makes most old parser cache entries invalid $wgUseEditSectionTokens is provided so that large installations like Wikipedia can keep their old parser cache entries.
2011-01-03 20:17:20 +00:00
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