Commit graph

16 commits

Author SHA1 Message Date
Kunal Mehta 44ccde4861 Use ParserOutput::addTrackingCategory()
Change-Id: I2989df0e689df69a0c9cf2ec6001a568fe4f635d
2016-09-14 12:34:21 -07:00
Kunal Mehta 48748a6046 Improve validation of ScribuntoContent
Implement Content::prepareSave() to ensure that any content
directly passed to WikiPage::doEditContent() that doesn't run edit
filters will still be validated. We have to use prepareSave() instead of
Content::isValid() because validation depends upon the current Title.

Create a ScribuntoContent::validate() convenience function to hold the
logic for that and add a todo to use it in the EditFilterMerged hook.

Also, remove a parser test that depended upon being able to save invalid
modules directly, as what it is testing is no longer possible (unless it
pre-dates making valid syntax a requirement).

Bug: T145548
Change-Id: Ie57eff36100963f02899d669df7375577f7375e1
2016-09-14 11:50:07 -07:00
Brad Jorsch 31d53b4a40 ScribuntoContent: Use base class preSaveTransform()
Bug: T142805
Change-Id: I0228c8f9c09504001bb5e1d27b5482af1786c17e
2016-08-15 11:22:14 -04:00
Brad Jorsch aa4d72e3ff Fix uncontroversial phpcs errors
The following continue to be ignored:
* Generic.Arrays.DisallowLongArraySyntax.Found, because I'm not sure
  Scribunto is ready to abandon old version support in master.
* MediaWiki.ControlStructures.AssignmentInControlStructures.AssignmentInControlStructures,
  because it's overly strict for its purpose.

Squiz.Classes.ValidClassName.NotCamelCaps isn't ignored globally, we
just ignore it explicitly every place it's needed.

Change-Id: I307668da6ef7b3e23da19b1fd1e08914239b99b3
2016-05-18 16:31:28 -04:00
Brad Jorsch dd0c6e7668 Use ParserOutput::getRawText() where available
This is unlikely to be a cause of the cache corruption since this isn't
calling setText() on any wikitext ParserOutputs, but let's fix it just
in case.

Bug: T124356
Change-Id: Ic34c654af86385dede843009d89df6f442ddc915
2016-01-25 12:39:23 -05:00
Jackmcbarn bd5e46b941 Check content model instead of title
Make Scribunto compatible with storing content model in the database, by
checking for it directly instead of guessing it based on the title.

Change-Id: I94ae07bc47273fbf65d64b2909e5895c1c3fd7e9
2015-07-19 22:16:21 -04:00
Ori Livneh d426627c9b lint: 'if(' => 'if ('
Change-Id: I056ff6bbc5f992bddfd7e3bd82803de107651b80
2015-06-20 21:38:56 -07:00
Yuri Astrakhan 66ac157c12 Use single quotes for <pre> (easier to read)
Change-Id: Ib666f56471fc8ea7dac36367c962788d1a304100
2014-09-21 22:51:46 -04:00
Brad Jorsch c44d576b78 Update GeSHi integration
Idf4ad439 deprecated SyntaxHighlight_GeSHi::buildHeadItem in favor of
ResourceLoader. We may as well follow along.

To avoid breaking things if people don't update their
SyntaxHighlight_GeSHi in sync with Scribunto, test for the RL class used
in GeSHi's ResourceLoader integration and continue using buildHeadItem
if it's not found.

Change-Id: Id93530dce7c8c5a70a98fca58844adf9b5c6a23f
2014-07-03 14:50:50 -04:00
Derk-Jan Hartman fd295c3b71 Convert Scribunto to use fillParserOutput
Followup-to: Idf4ad4397101a4d19be2ac773cd4bad52188d903
Change-Id: I7e18d57f231716127028dafe44e61cee7d89d4d9
2014-05-10 17:31:26 +02:00
Amir E. Aharoni a8a17a8bb0 Show module doc with the correct direction formatting
* Add mw-content-(ltr|ltr) class to the documentation <div>.
* Rewrite the div code as Html::rawElement instead of
  concatenating a string.

Done in pairing with Niklas Laxström.

Change-Id: I4d68d53df9dcf3556885552b738f2c327aaa8607
2014-05-08 17:48:14 +02:00
Brad Jorsch 1397351289 Add newlines around scribunto-doc-page-show wikitext
Change I15c10379 wrapped the scribunto-doc-page-show message in a div,
which is breaking things when the content of that message starts with
start-of-line-sensitive wikitext. So add a newline inside the div.

Bug: 60664
Change-Id: If596bed72f779f5980348ac111b63e7876d21ff4
2014-02-10 00:41:03 +00:00
Brad Jorsch 628c8b60ca Tracking category for modules saved with errors
When the "Allow saving code with errors" checkbox is used, an
automatically-added tracking category would be useful. And we may as
well also include the error message that would have been displayed when
trying to save without that checkbox checked.

Bug: 39605
Change-Id: Ideb72a58887fb1187b9adba80b7245cdca070ce4
2013-12-09 12:00:16 -05:00
Liangent 1050d29845 Modules should be in English (while docs are not)
Change-Id: I15c10379ab2282a508322df3914d82e1fc463a22
2013-05-29 15:08:31 +00:00
Brad Jorsch ded331ddc9 (bug 45845) Allow for docs at non-subpages
It has been claimed that some wiki might want to place module
documentation at a location other than as a subpage of the module, for
example under "Project:Module documentation/$1". It's possible to
support this, so we may as well.

This also involves renaming the "scribunto-doc-subpage-*" messages to
"scribunto-doc-page-*", since the interpretation of
scribunto-doc-subpage-name would be drastically changed.

Note that any wiki that has customized scribunto-doc-subpage-name will
need to re-customize scribunto-doc-page-name, the old value will not be
transferred.

Bug: 45845
Change-Id: Ic453561691e04b5250d219cc7d871c17e60b9912
2013-03-12 14:33:40 -04:00
Brad Jorsch 30a75fb0f1 Add module documentation support
Add the ability for modules to be documented using a /doc subpage, which
is automatically transcluded onto the module page.

To get the transcluding to work right, I wound up having to change from
the deprecated-in-1.21 ArticleViewCustom hook to ContentHandler, as
there didn't seem to be any other way to get the ParserOutput into the
links tables. Which means Scribunto now needs MediaWiki 1.21 rather
than 1.20.

Change-Id: Id487097c2a505c11f92a3404f5d3ee98beb2570c
2013-02-22 05:01:29 +00:00