Commit graph

281 commits

Author SHA1 Message Date
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
Sam Reed
18b308afd6 Followup r69235
Replace setPropert with setProperty
2010-07-10 11:46:47 +00:00
Bryan Tong Minh
a3aac44f04 (bug 14685) Double underscore magic word usage is now tracked in the page_props table, as well as the behavioral magic words {{DEFAULTSORT}} and {{DISPLAYTITLE}}. 2010-07-10 11:30:11 +00:00
Platonides
7b3b076f4d Follow up r68491.
Perform doAllQuotes before external links.
Added test case from http://es.wikipedia.org/w/index.php?title=Pablo_Picasso&action=edit&section=5&oldid=38079844
2010-06-24 13:44:50 +00:00
Platonides
e7d06d4aff Disable pretty italics inside links. Now the italics inside a link alternate text will be handled on its own scope but if they come from the page title, they won't be parsed at all. This is a middle way solution to bug 4598. Now all bug 4598 tests pass.
Pretty italics mean that italics go across links: ''Some [[Link|pretty ''italics'' and stuff]]! -> ''Some [[Link|pretty ''italics'' and stuff]]! -> <i>Some <a>pretty <i>italics</i> and stuff</a>!</i>

This also fixes bug 24093, where interface messages saying '''[[$1]]''' has been deleted/renamed/links here were being bitten by this feature.

The best resolution would be to make pretty italics still work inside alternates, feel free to do so, but doesn't seem worth at this point. The right solution should be to rewrite the quotes handling so it takes its scope into account.
2010-06-23 23:29:54 +00:00
Conrad Irwin
eb41544de5 (bug 22784) Fix normalization of whitespace in autocomment links
put this specific normalisation into Sanitizer::normalizeSectionNameWhitespace
instead of repeating it three times.
2010-06-21 01:17:36 +00:00
Conrad Irwin
e3e24db382 (bug 17857) Make {{anchorencode}} work in a manner more similar to the way that
section links are created by the parser. Also useful for (bug 18431).
2010-06-20 23:43:39 +00:00
Daniel Kinzler
389eba6bd9 follop-up to 68230: forgot to commit the styles needed for layout grids 2010-06-18 19:21:04 +00:00
Daniel Kinzler
4760201ac2 let mode="grid" on a wiki table trigger output as div soup instead of a html table. this should get rid of "layout tables" that confuse screen readers etc. this is very experimental - feel free to revert, i just want to have this diff in the repository, to play with... 2010-06-18 19:17:17 +00:00
Alexandre Emsenhuber
de27b8eee9 * Fixed some doxygen warnings
* Groupped some related functions
2010-06-10 21:05:58 +00:00
Roan Kattouw
f354f69bc2 Fix fatal in r67185 2010-06-01 19:40:35 +00:00
Daniel Kinzler
36c68af119 allow parser/extensions to control for how long a ParserOutput gets cached. Introduced updateCacheExpiry(), Cleaned up use of getCacheTime() for marking uncacheable objects. 2010-06-01 14:28:51 +00:00
Aryeh Gregor
74a21f3bd1 Remove most named character references from output
Recommit of r66254 to trunk.  This was just

find extensions phase3 -iname '*.php' \! -iname '*.i18n.php' \! -iname 'Messages*.php' \! -iname '*_Messages.php' -exec sed -i 's/&nbsp;/\&#160;/g;s/&mdash;/―/g;s/&bull;/•/g;s/&aacute;/á/g;s/&acute;/´/g;s/&agrave;/à/g;s/&alpha;/α/g;s/&auml;/ä/g;s/&ccedil;/ç/g;s/&copy;/©/g;s/&darr;/↓/g;s/&deg;/°/g;s/&eacute;/é/g;s/&ecirc;/ê/g;s/&euml;/ë/g;s/&egrave;/è/g;s/&euro;/€/g;s/&harr;//g;s/&hellip;/…/g;s/&iacute;/í/g;s/&igrave;/ì/g;s/&larr;/←/g;s/&ldquo;/“/g;s/&middot;/·/g;s/&minus;/−/g;s/&ndash;/–/g;s/&oacute;/ó/g;s/&ocirc;/ô/g;s/&oelig;/œ/g;s/&ograve;/ò/g;s/&otilde;/õ/g;s/&ouml;/ö/g;s/&pound;/£/g;s/&prime;/′/g;s/&Prime;/″/g;s/&raquo;/»/g;s/&rarr;/→/g;s/&rdquo;/”/g;s/&Sigma;/Σ/g;s/&times;/×/g;s/&uacute;/ú/g;s/&uarr;/↑/g;s/&uuml;/ü/g;s/&yen;/¥/g' {} +

followed by reading over every single line of the resulting diff and
fixing a whole bunch of false positives.  The reason for this change is
given in <http://lists.wikimedia.org/pipermail/wikitech-l/2010-April/047617.html>.
I cleared it with Tim and Brion on IRC before committing.  It might
cause a few problems, but I tried to be careful; please report any
issues.

I skipped all messages files.  I plan to make a follow-up commit that
alters wfMsgExt() with 'escapenoentities' to sanitize all the entities.
That way, the only messages that will be problems will be ones that
output raw HTML, and we want to get rid of those anyway.

This should get rid of all named entities everywhere except messages.  I
skipped a few things like &nbsp that I noticed in manual inspection,
because they weren't well-formed XML anyway.

Also, to everyone who uses non-breaking spaces when they could use a
normal space, or nothing at all, or CSS padding: I still hate you.  Die.
2010-05-30 17:33:59 +00:00
Platonides
3b150034a0 (bug 8689) Use strict php comparison, so that inserting a long numeric line doesn't produce a fatal error when php tries to convert it to a number. 2010-05-28 14:16:46 +00:00
Chad Horohoe
e1ff6c41dd Typo in comment 2010-05-21 21:08:05 +00:00
Ilmari Karonen
9d0292de51 bug 23588: properly colon-escape links used to replace transclusions if post-expand include size is too large 2010-05-19 00:03:54 +00:00
Jack Phoenix
bcee7c2238 Parser.php: trim trailing spaces 2010-05-15 10:35:54 +00:00
Matěj Grabovský
449b936efd (bug 23426) The {{REVISIONMONTH}} variable is now zero-padded and added new variable {{REVISIONMONTH1}} when unpadded version is needed. 2010-05-11 16:24:14 +00:00
Platonides
73649741ed Recovered parser test whose content got broken in r12975, functionality broken in r14635.
Changed what used to be EXT_LINK_TEXT_CLASS to
define( 'EXT_LINK_TEXT_CLASS', '[^\]\\x00-\\x08\\x0a-\\x1F]' );
In plain English, do not allow control characters in description. We still allow tabs
there, since they may arrive from a paste.

We should probably make the space between the text and the description mandatory, it needs testing.

These tests only work with the Hash Preprocessor, since the DOM Preprocessor changes them into the 
replacement character. Should we autolink an URL with a FFFD? That will require changing some regex 
into unicode ones.
2010-05-05 21:58:39 +00:00
Brion Vibber
e1d1404372 Cleanup for bugs in r65104 (iwlinks table), that'll teach me not to commit at 4am after drinking with the wikimedia devs! 2010-04-18 00:39:12 +00:00
Brion Vibber
8eac509ab5 * (bug 14473) Add iwlinks table to track inline interwiki link usage
Like langlinks, this stores the interwiki prefix (as iwl_prefix) and full page title (as iwl_title), attached to the page doing the liking (as iwl_from -> page_id).
Unlike langlinks, there can be multiple entries stored per interwiki prefix.

Updater to add the table confirmed on MySQL, untested on SQLite but should work.
Someone may still need to add and test a PostgreSQL updater.

Refactored makeWhereFrom2d() out of LinkBatch to Database so it could be re-used for the similar mapping for the interwiki links, which need a string prefix rather than an int namespace key.
Also cleaned it up internally to reuse existing code for building where clauses from arrays. (Tim & Domas -- if the previous more verbose code was there to reduce function call and array processing overhead on very large link lists, feel free to unroll it again if the difference is measurable. Just swap the var names around from the old LinkBatch code and escape the base key value if it's not an integer, it'll be functionally equivalent.)
2010-04-16 01:40:05 +00:00
Happy-melon
2de185e530 Follow-up to r64407 - a perfect example of why we encourage using braces for one-line conditionals in the first place. 2010-04-10 16:44:10 +00:00
Tim Starling
3a2345fe1c Proposed cleanup of recent LanguageConverter-related commits:
* Moved the responsibility for calling $wgOut->setPageTitle() from OutputPage::addParserOutputNoText() to the OutputPage/Parser caller. Previously, every call to $wgOut->addWikiText() (or any other message parsing function) was resulting in the title being reset to a converted version of $wgTitle, producing bug 23124. Moving responsibility to the caller seems to work fairly well, since there are apparently only two callers that really want {{DISPLAYTITLE}} etc. to work (EditPage and Article::view). 
* Reverted data flow obfuscation in OutputPage::setHTMLTitle() from r64851, replaced by the above. The caller decides what overrides what.
* Reverted inappropriate, cache-polluting references to $wgUser and $wgRequest in Parser::parse(), introduced in r64819.
* Reverted incomprehensible boolean parameter to Language::convert() from r64851, reintroduced Language::convertTitle() instead. Gave it a simpler implementation than before.
* Fixed broken {{DISPLAYTITLE}} feature, was being unconditionally overwritten by the ParserOutput::setTitleText() call in Parser::parse(). Give {{DISPLAYTITLE}} precedence over autoconverted title, like we do for -{T|...}-.
* Tested extensively (perhaps not exhaustively)
2010-04-10 13:38:50 +00:00
Philip Tzou
7116f96739 Follow up r64851. Remove $wgOut. 2010-04-10 07:07:49 +00:00
Philip Tzou
221f00408a Fix bug 23115 again. Follow up r64821, r64823 and r64827. Rewrite the converted title to HTML title if the HTML title haven't set by other messages. 2010-04-10 05:46:01 +00:00
Platonides
ec61db2425 Follow up r64828. It was a typo, there's no variable called $wgDisableContentConversion 2010-04-09 20:47:05 +00:00
Philip Tzou
e40921d0b4 Sorry it's $wgDisableLangConversion. 2010-04-09 20:39:56 +00:00
Raimond Spekking
47f2ddfa4e Follow-up r64819: PHP Notice: Undefined variable: wgDisableContentConversion in /www/w/includes/parser/Parser.php on line 379 2010-04-09 20:34:53 +00:00
Platonides
122f0f3c77 Convert the previous title instead of getting it again, so the Main Page keeps pagetitle-view-mainpage as its title. 2010-04-09 20:27:57 +00:00
Platonides
ca78b880a2 Recover namespace names. 2010-04-09 19:46:26 +00:00
Platonides
dc7d0302b1 Follow up r64819. Cosmetical fixes. 2010-04-09 19:35:14 +00:00
Philip Tzou
99240b4946 Bug 23115: Follow up on r64811. Fix another bug which cause talk page can't converted. And fix the title convert problem. 2010-04-09 19:02:04 +00:00
Platonides
551f826d7e Follow up r64813 and r64814 by also applying r64814 to the branches. 2010-04-09 18:08:38 +00:00
Platonides
84b6aa1ce3 Follow-up r64811 on fixing bug 23115.
This restores convert rules to the same ones as before r61101.
2010-04-09 17:56:42 +00:00
Philip Tzou
6175f010ce Bug 23115: Language Converter should apply on talk page. 2010-04-09 17:42:38 +00:00
Jack Phoenix
d561849fca documentation tweak 2010-04-02 20:56:11 +00:00
Happy-melon
bec172cb54 Rationalise comment format. Slightly controversial, perhaps, but I've pretty much borked svn blame already :D Also other doc and spacing fixes. 2010-03-30 21:53:56 +00:00
Happy-melon
af56e348c1 Overhaul code format to coding conventions. 2010-03-30 21:20:05 +00:00
Aryeh Gregor
759db54cc2 Correctly handle <abbr> followed by ISBN
Bug 22905.  Patch based on one submitted by Solitarius.  Basically, we
were assuming that anything matching <a.*?</a> was a link and ignoring
it so as to avoid nested links, but that matched the HTML from

<abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]

so the ISBN didn't work.  Parser test committed, fails without the
Parser.php change.
2010-03-24 13:42:37 +00:00