Commit graph

127 commits

Author SHA1 Message Date
Brad Jorsch d945d82fb1 Mark parser hook output as volatile
Using the new functions introduced in I95b3cf87, mark the output of
<ref> and <references> as volatile so that caching can be avoided.

Bug: 46815
Bug: 31834
Change-Id: I897defba32ac6adf72b6bc9ea7e933a87b1ba17b
2013-12-06 18:43:45 -05:00
Kunal Mehta a94c871cd2 Only load RL modules when a <ref> tag is being used
Bug: 55684
Change-Id: I8f7528ef8468bf3fa1c901fd6dc67b5eebc0cbd6
2013-11-01 13:47:35 +00:00
Kunal Mehta f57bb804a3 Show error messages in content language to avoid cache issues
Bug: 31216
Change-Id: I725a972cbbf14fb179a24ab0682ad497524d4274
2013-10-15 21:38:45 -07:00
Kevin Israel b3becfb569 Add back serialize() calls for internal errors
For a value of the incorrect type, the type in question is a
relevant part of the error message.

Follows-up Ie0271de755a63fcda8a3671cc115af7bc931a02b.

Change-Id: I09d9f1975bdfabffe44a6f69b5296cdcbf03a51e
2013-09-28 19:40:17 +00:00
Kevin Israel a2f4a5a25d Remove calls to wfDebugDieBacktrace
Deprecated in I12336983e29524a450fc61ed9df4d840066be9b6.

Change-Id: Ie0271de755a63fcda8a3671cc115af7bc931a02b
2013-09-27 21:52:39 -04:00
Ed Sanders 4f3f9068b0 Add more specific class to cite errors
Problem:

* VisualEditor needs to be able to more reliably target Cite errors.

Solution:

* Add a more specific class to cite errors

Grumble:

* Ideally all extensions would use mw-ext-{extension name} as a prefix to
  their CSS classes (or something similar).

Bug: 51337
Change-Id: If4f5360cc1c7b765ad896b14901a9b024782cc93
2013-07-15 01:46:53 +00:00
Brad Jorsch e7de455f88 (bug 47291) Make sure cloned Cite is cleared
The cloned Cite object in the ParserCloned hook must be cleared, even if
the clone occurs inside a <ref> or <references> tag. The simple way to
do this is to set mInCite and mInReferences to false before calling
clearState().

While Cite could probably use a major cleanup, let's fix this bug now
instead of waiting for someone to get around to it.

Bug: 47291
Change-Id: Id3e91c41dc33a703b5326961fd57e1fe8ac61f5b
2013-04-16 15:52:49 -04:00
Brad Jorsch 73f856820e (bug 32368) Handle cloned parsers
If the parser is cloned, we need to clone our data object and
reassociate the hooks. Otherwise references may be lost when the clone
has ParserClearState called.

Change-Id: Ic1d75850e8d610ea890e34c38d062a358fd55178
Depends-On: Ieec65c908d71e89b9a66f83b9a626f842aadacbb
2013-02-22 21:24:14 +00:00
Brad Jorsch e6c76b5d23 (bug 13073) Work around Tidy confusion
If the <references> tag is wrapped (e.g. <div><references></div>) and
the first ref on the page contains a newline, Tidy will get confused and
insert extra paragraph breaks in the output.

We can avoid this easily enough by inserting a newline between
MediaWiki:cite_references_prefix and the first reference's <li>.

Note since this changes the output we also have to adjust the parser
tests to expect the new output.

Change-Id: I8222d53eaf2b20f842915fe90af724711a20bfc5
2012-11-26 19:29:03 +01:00
eranroz da8e6f3b45 Cite anchors should be numbered starting at 1
Fix for bug 10537: Cite anchors should be numbered starting at 1
On the way a small refactoring (getting rid of redundant variable)

Change-Id: Iee94917f3f860516cc310d1cdb1c4f9065d40984
2012-10-18 01:03:31 +02:00
Siebrand Mazeland 52ca5a1a5a Maintenance for Cite extension.
* Update deprecated calls.
* Remove superfluous newlines.
* Add @todo where uncertain.

Change-Id: Ifc79b199fa551c23fafa190664688c8320059338
2012-08-30 10:41:27 +02:00
Brad Jorsch 4933d7a682 (bug 17865) Fix wikilinking in "refs without references" error
The [[MediaWiki:Cite error refs without references]] message does not
correctly display wikilinks. This is because it takes effect during
ParserBeforeTidy, which misses the call to replaceLinkHolders(). And
parsing directly to HTML (with MessageCache::singleton()->parse()) would
lose categories and such added by the error message.

Gerrit change Iaa2755f994edb081eb1d176f632f7add41640dbf adds a
"ParserAfterParse" hook, which can be used to add this message in time
to be correctly handled by replaceLinkHolders().

Change-Id: I093d85d8f8c2ac3238609d145ae5b985602bb3fd
Depends-On: Iaa2755f994edb081eb1d176f632f7add41640dbf
2012-08-07 13:16:46 -04:00
Sam Reed 714af9033f Many other occurance/occurence typos 2012-03-19 14:59:29 +00:00
Max Semenik 53ae80785a Follow-up r102160: removed arrows from tooltips 2012-01-04 15:00:01 +00:00
Roan Kattouw 2142134491 (bug 17865) Fix double-parsed error messages in Cite. Modified patch by Brad Jorsch 2011-11-14 12:22:07 +00:00
Roan Kattouw 7103224ce0 (bug 20050) References containing numbered lists cause Tidy to corrupt the references list. Patch by Brad Jorsch 2011-11-14 12:02:23 +00:00
Gabriel Wicke f876382e67 Back out accidentally-committed r102967. 2011-11-14 11:14:39 +00:00
Gabriel Wicke 4a2232bbe2 Fixes bug #17865 2011-11-14 11:06:42 +00:00
Sam Reed 607f9bbd27 Whitespace/documentation 2011-09-14 15:07:20 +00:00
Platonides e9dff9d1e2 Follow up r89220. Misleading comment left from r88971 2011-05-31 17:51:30 +00:00
Platonides 9fc91b9899 Remove Cite singleton. Store it inside each associated parser at $parser->extCite
This fixes bug 20748 and bug 15819 without breaking the other tests. Reverts r88971.
The conflict with CategoryTree was the old problem of a message being called inside 
of a parser callback, this time with clearState for which the hook is global.
2011-05-31 17:49:22 +00:00
Sam Reed c48d4b674b Documentation 2011-05-28 20:44:24 +00:00
Kevin Brown 37ff765a58 Fix bug 20748 and bug 15819. 2011-05-27 15:22:36 +00:00
Sam Reed 3e5bbe33e7 Remove whitespace, unneeded globals, and swap and/or for &&/|| 2011-04-27 11:11:54 +00:00
Jan Paul Posma 68ea91084d Followup of r82891 and r82894. Fixes hook for InlineEditor, which forces a page reparse when either a <ref> or <references> tag shows up. Doesn't affect normal behaviour when not using InlineEditor. 2011-03-04 11:45:22 +00:00
Jan Paul Posma 1aac56bb83 Fixed call per http://www.mediawiki.org/wiki/Special:Code/MediaWiki/82891#c14483 2011-02-27 15:30:35 +00:00
Jan Paul Posma efb47a9d90 Added hook to support partial rendering for the InlineEditor extension. Doesn't affect normal behaviour. 2011-02-27 14:50:56 +00:00
Platonides 286a80efc1 Make Cite properly register to any parser instead of just $wgParser.
Makes CiteParserTests work with r82867 code.
2011-02-26 22:39:53 +00:00
Mark A. Hershberger bdf20cb5de Followup r82744 Always grep extensions, even for recent additions to the codebase. 2011-02-24 23:06:12 +00:00
Mark A. Hershberger ab606caf02 w/s cleanups 2011-02-24 23:05:22 +00:00
Tim Starling ef36bb331b * Updates for r82645: isValidHalfParsedData(), ise/ize spelling change
* Fixed inappropriate use of empty()
2011-02-23 07:03:26 +00:00
Aryeh Gregor d951a47cdc Style fixes for Cite_body.php
Tested only with php -l.
2011-02-22 00:07:21 +00:00
Sam Reed 1d7fb709b1 Add some braces, fixup some indenting 2011-02-03 21:40:55 +00:00
Alexandre Emsenhuber 5ab3ac860a Use wfMessage() instead of playing with $wgMessageCache 2011-01-17 08:04:14 +00:00
Sam Reed 2ee798e17f More deprecated method call removals and updates 2010-10-29 15:32:44 +00:00
Niklas Laxström 510fb4f1ce Untested fix, second parameter was ignored 2010-09-02 09:03:00 +00:00
Chad Horohoe 9ad4b8a37e More php4-style constructors. I think thats most of them 2010-08-30 17:11:45 +00:00
ThomasV b7e6f6d278 follow-up to r71157 2010-08-23 08:19:42 +00:00
ThomasV b5883ddc36 Support for references spread on multiple transcluded pages, using the 'follow' parameter. 2010-08-16 12:05:57 +00:00
ThomasV 2c5cb7034a added fixme comment 2010-08-11 14:36:59 +00:00
Alexandre Emsenhuber a015b8f170 Big changes to extensions' documentation:
* changed all @addtogroup to @ingroup
* added some @file where needed
* changed some @package/@subpackage to @ingroup
2010-06-06 15:12:22 +00:00
Chad Horohoe 8889add2cf Revert r66934 (Removing wfLoadExtensionMessages() from everything). I disagree on principle...we branch extensions for this very reason. But people want trunk extensions compatible for several versions back, meh. 2010-05-27 15:56:53 +00:00
Chad Horohoe 695d3db96e Large commit. Removed 800+ references to no-op wfLoadExtensionMessages() 2010-05-26 22:25:32 +00:00
Platonides d9b8f32959 Add lists cite_link_label_group-$group to be used for the groups links names.
Fixes bug 22265
2010-05-22 14:28:48 +00:00
Sam Reed e532ce62cc Stylize on some used extensions etc 2010-04-17 21:07:37 +00:00
Alexandre Emsenhuber f2c3c1450f Fix documentation URL, requested by arseny92 on IRC 2009-12-05 14:28:24 +00:00
Max Semenik 7ceae896fa Fixed numerous problems in extensions found with new features of syntaxChecker. Mostly trailing ?>, but also occasional BOMs and leading whitespace 2009-11-14 13:41:31 +00:00
Robert Rohde 75004e338f Extends Cite to allows <ref> content to be defined within a <references> block
See comments on Bug 5997, Bug 15724, and discussion at:
 http://en.wikipedia.org/w/index.php?title=Wikipedia_talk:Citing_sources&oldid=304222618#Improving_.3Cref.3E
2009-07-26 22:15:13 +00:00
Andrew Garrett 43a4822175 Improve Cite references caching by making it dependent on a config setting, which defaults to off.
This way, we can still use it as emergency optimisation if the need arises.
2009-02-12 18:02:27 +00:00
Tim Starling 813c686a03 Don't double-parse messages, it breaks lots of things. Fixes bug #17442. 2009-02-11 06:34:39 +00:00
Andrew Garrett 598202b229 Re-implementation of r46725 (caching of Cite <references /> output).
This time, I've written a Parser method called serialiseHalfParsedText, which, as the name implies, grabs some half-parsed text, and fixes up all of the strip
markers, and link comments, and makes it safe to import some other time with unserialiseHalfParsedText. I tested it by live-hacking the cache key to be a constant,
and then putting <references /> on a completely different page, where it worked perfectly.
2009-02-03 04:58:08 +00:00
Andrew Garrett 4f0b501f07 Fix profiling mistake. 2009-02-03 04:57:48 +00:00
Andrew Garrett d35dbd9f50 Cache cite <references /> output by contents. That way, changes that don't affect Cite references won't cause a re-parsing of Cite, which is a big CPU hog on Wikimedia. 2009-02-03 04:57:28 +00:00
Brion Vibber 439ba88a51 Revert r46725, r46726 "Cache cite <references /> output by contents. That way, changes that don't affect Cite references won't cause a re-parsing of Cite, which is a big CPU hog on Wikimedia."
Causes data corruption in output due to misaligned strip markers.
2009-02-02 21:49:10 +00:00
Andrew Garrett 782b1a20c0 Fix profiling mistake. 2009-02-02 19:34:51 +00:00
Andrew Garrett fedbf8ccc8 Cache cite <references /> output by contents. That way, changes that don't affect Cite references won't cause a re-parsing of Cite, which is a big CPU hog on Wikimedia. 2009-02-02 19:29:02 +00:00
Robert Rohde b7b5f80537 revert of r46520 2009-01-29 10:13:12 +00:00
Robert Rohde 047c89b2c0 Move cite_error formatting wrapper into Mediawiki: space rather than hard coded in Cite_body.php 2009-01-29 05:10:07 +00:00
Alex Z. ca5c36c9b5 (bug 16854) Show an error message when a page has <ref> tags and no <references/>. Patch by Brad Jorsch. 2009-01-26 18:02:28 +00:00
Alex Z. 76837d57ea partial revert of 45771, mistaken commit? 2009-01-16 18:30:29 +00:00
Raimond Spekking f5f2927be5 Localisation updates for extension messages used by WMF from Betawiki 2009-01-15 16:45:03 +00:00
Tim Starling c3048a5e92 Reverting r45379 as per comment 5 on bug 16854, i.e. it doesn't work with section editing. 2009-01-07 13:10:29 +00:00
Chad Horohoe a82380d2a6 (bug 16854) Provide explicit error when <references /> is omitted. Patch by Brad Jorsch. 2009-01-03 18:59:22 +00:00
Aryeh Gregor f7969c9d4b Improve ugly interface for Sanitizer::escapeId()
Calling it with no extra arguments will now assume that you're escaping
a whole id, not an id fragment, which is safer.  Also, instead of ugly
bitfield-based options, I've changed the options to use an array of
strings.  I fixed all callers in trunk.  Out-of-tree callers that were
using Sanitizer::NONE will get correct behavior, while those that were
calling it with no arguments will get slightly changed behavior (an x
will be prepended).  I think this is harmless enough that we can skip
back-compat cruft here.

This should cause no visible changes.  No parser test regressions.
2008-12-30 00:22:14 +00:00
Steve Sanbeg 62c5542980 update comment 2008-10-04 22:26:45 +00:00
Steve Sanbeg 2cd561ea0e fix for bug 15770, allow <ref name=whatever></ref> for compatability with #tag 2008-10-01 19:56:40 +00:00
Aryeh Gregor 2cd995f73c Fix for last commit
My last commit didn't catch anything but plain <ref>: <ref name="foo"> would be allowed.  Fixed using a regex from the patch on bug 12757 by Max Semenik.
2008-09-18 17:21:13 +00:00
Aryeh Gregor 1c902f410c (bug 6199) Generate error for unbalanced <ref>s
This basically uses the patch I posted to that bug two years ago.  It's crude, but it should avoid the most common false positives while hopefully not causing too many false negatives.  It should be possible to refine it to avoid even more false negatives, but for the time being, this will at least prevent most of the constant headaches that newbies get when chunks of articles vanish because they forgot a closing </ref>.
2008-09-18 17:16:10 +00:00
Siebrand Mazeland 5bca5776eb * Fix common spelling error (seperate -> separate)
* Fix two more spelling errors in Translate extension messages
2008-09-15 20:28:25 +00:00
Aaron Schulz 6c824fd58d Consistent return array to avoid notices 2008-09-12 14:41:23 +00:00
Alex Z. e7454069b6 (bug 15517) - Use correct error message if group parameter is allowed (message already existed but was apparently unused). 2008-09-09 03:55:54 +00:00
Brion Vibber e8786ea9b5 Revert r38669 for now (Cite extension "add format=a option for alphabetic format").
It isn't obviously clear how this is meant to be used, and there are no test cases for the newly added mode.
Newly added code doesn't match our code standards, making it harder to read, and contains mysterious things like "$argv=array_merge($argv);" which seem a bit odd.
2008-08-08 19:11:31 +00:00
Steve Sanbeg a4ce1077d1 add format=a option for alphabetic format 2008-08-05 21:52:26 +00:00
Aryeh Gregor 9fcce4febe Delete Cite::validateName(). Use Xml::escapeId() instead. All parser tests pass. 2008-07-30 21:23:43 +00:00
Shinjiman c2d03f184b * (bug 14216) Grouping references link displays are urlencoded instead rendering the normal text
patch by fdcn
2008-06-18 18:42:52 +00:00
Roan Kattouw 2986a5a8d2 Cite: Fix bug 11224 (finally): in some obscure cases (notably when parsing for an anon without edit rights), Parser::clearState() somehow got in the call path of Cite::ref(), clearing the Cite state in mid-parse every time. I've worked around this by refusing to clear state if the state indicates we're in the middle of parsing something, but this is probably not a proper fix as there seems to be something deeply evil going on in the Parser (big surprise) causing it to clear state haphazardly. Anyone interested in further investigation should read the backtrace I posted on bug 11224 2008-06-16 14:04:39 +00:00
Brion Vibber 933caf85db Update a bunch of extensions to avoid unstubbing $wgParser early for setHook() on current MW versions. 2008-06-06 20:38:04 +00:00