Commit graph

3176 commits

Author SHA1 Message Date
Adam Wight 1c947a808d Fix for nested #tag:references
It's possible to nest <references> by using tricky constructs like the
{{#tag function, and this breaks our rollback logic.  Try to show normal
output, otherwise show an error.

Includes regression tests.

Bug: T242437
Change-Id: I33e497cdf8508ce7ccb7f0f315c00af5eee47d0e
2020-01-15 12:44:29 +01:00
Translation updater bot 2691237121 Localisation updates from https://translatewiki.net.
Change-Id: I5b4f429de277f3f629a497527a043b0b64e591ad
2020-01-15 09:53:22 +01:00
Thiemo Kreuz ceb3a1ed5f Add unit test for section preview regression
Bug: T242434
Change-Id: I3e87897a1f9f418c4dd72d3137c74340b6646930
2020-01-14 15:10:47 +01:00
jenkins-bot 41a1859e90 Merge "Don't fail with a LogicException during section preview" 2020-01-14 08:08:29 +00:00
libraryupgrader 812df4820a build: Updating mediawiki/mediawiki-codesniffer to 29.0.0
The following sniffs are failing and were disabled:
* MediaWiki.Commenting.FunctionComment.MissingDocumentationPrivate
* MediaWiki.Commenting.FunctionComment.MissingParamTag
* MediaWiki.Commenting.FunctionComment.ParamNameNoMatch

Additional changes:
* Also sorted "composer fix" command to run phpcbf last.

Change-Id: I148ec7fca3d53bddc2dc5abbcc1c229461feea33
2020-01-14 04:06:09 +00:00
Thiemo Kreuz 42fd0cef58 Don't fail with a LogicException during section preview
This error happens only when previewing an edit, because some of the
validation in Cite::validateRefInReferences() is disabled in preview
mode. Unfortunately this codebase was never properly tested in preview
mode.

This patch is intentionally so small to make it easy to backport.
Tests will follow.

Bug: T242434
Change-Id: I5e529b7227598ab2acc624c90a0cb5d09b3f5452
2020-01-13 14:19:08 +01:00
Translation updater bot 25a13e0e69 Localisation updates from https://translatewiki.net.
Change-Id: I1c6364e9d38f8b1ed0e1d0767b8175319bc3d83d
2020-01-13 09:09:49 +01:00
Thiemo Kreuz bcbc356c14 Remove misleading version number 1.0.0
I would like to argue that calling the current state of this codebase
"version 1.0.0" is plain wrong. A more meaningful version number can
easily be introduced later if one is needed.

Bug: T213066
Change-Id: I4854263592784feb072acea2d9efe99f1f04ab28
2020-01-10 21:31:38 +01:00
Translation updater bot 81f676e35f Localisation updates from https://translatewiki.net.
Change-Id: I338684fcfcd5827a957ce40dc340ad51e56c5ed6
2020-01-10 08:34:04 +01:00
jenkins-bot 09f4deede4 Merge "Replace now unused native cloning feature" 2020-01-09 14:13:58 +00:00
jenkins-bot d18fbcffef Merge "Rewrite ReferenceStackTest::provideRollbackRefs for readability" 2020-01-09 12:53:34 +00:00
jenkins-bot ad0c94bf22 Merge "Annotate TODOs with task number" 2020-01-09 12:48:49 +00:00
jenkins-bot 6d02c1569d Merge "Final clean-ups for a more consistent parameter order" 2020-01-09 12:44:55 +00:00
Adam Wight 170484e933 Annotate TODOs with task number
Each of these TODOs is something that needs to be fixed or implemented,
so it's helpful to map them to tasks.

Change-Id: I807208392d8a609d7f3b371dc3560a48f3578092
2020-01-09 13:13:48 +01:00
jenkins-bot 953030386a Merge "Replace all # single line comments with //" 2020-01-09 11:40:24 +00:00
jenkins-bot 9bbaeb6f24 Merge "Consistent empty lines between @param and @return PHPDoc tags" 2020-01-09 11:40:23 +00:00
jenkins-bot 89df0f1c62 Merge "Simplify a for-loop in ReferenceStack" 2020-01-09 11:40:02 +00:00
jenkins-bot 0be582dc12 Merge "Report conflicting extends="…" with an error message" 2020-01-09 11:37:27 +00:00
Thiemo Kreuz 013e1bfa90 Final clean-ups for a more consistent parameter order
* Always have an empty line between @param and @return to improve
readability as well as consistency within this codebase (before, both
styles have been used).

* Flip parameter order in validateRefInReferences() for consistency with
the rest of the code.

* In Cite::guardedRef() the Parser was now the 1st parameter. I changed
all related functions the same way to make the code less surprising.

* Same in CiteUnitTest. This is really just the @dataProvider. But I feel
it's still helpful to have the arguments in the same order everywhere, if
possible.

* Add a few strict type hints.

* It seems the preferred style for PHP7 return types is `… ) : string {`
with a space before the `:`. There is currently no PHPCS sniff for this.
However, I think this codebase should be consistent, one way or the other.

Change-Id: I91d232be727afd26ff20526ab4ef63aa5ba6bacf
2020-01-09 12:13:54 +01:00
Thiemo Kreuz 04c5773953 Replace all # single line comments with //
There is currently no strict CodeSniffer rule for this. I think we
need to have one sooner or later. Anyway, what I find important is to
have a consistent code style in one codebase.

I refused to do this change previously because I don't like to mess
with Git blame if it's not really necessary. However, at this point all
code was moved around anyway.

I ended removing a comment that appears misplaced now, and doesn't help
maiing the code more readable. I like not having a dot at the end if
it's not really a sentence.

Change-Id: Id1d4f43277c69080c512c1a5ceff4c948bfa05be
2020-01-09 12:13:34 +01:00
Thiemo Kreuz 446524f8a9 Consistent empty lines between @param and @return PHPDoc tags
In the end I don't care much if we agree on having this newline, or
not. What I care about more is that this codebase is consistent.

Personally I prefer having the newline. It creates a visible separation
between what "goes in" and what "goes out" (@throws and @return).

Change-Id: Ibc60af621132e415a5579397c01688fa21eb0be5
2020-01-09 12:00:35 +01:00
jenkins-bot b9b6905171 Merge "Fix incomplete undo/redo stack implementation" 2020-01-09 10:58:35 +00:00
jenkins-bot d3c585ceb1 Merge "Remove old comments talking about removed code" 2020-01-09 10:58:34 +00:00
Translation updater bot 5aff516ccb Localisation updates from https://translatewiki.net.
Change-Id: I0b59e4d7f12ce70b88fbbf46d76f2ec7c6baf4f8
2020-01-09 08:28:37 +01:00
libraryupgrader 88ecc77735 build: Updating npm dependencies
* grunt-stylelint: 0.12.0 → 0.13.0
* stylelint-config-wikimedia: 0.7.0 → 0.8.0

Additional changes:
* Added .eslintcache to .gitignore.

Change-Id: Iabe4cd32a742fbf64bfc24adb326f88c0f13dc3a
2020-01-09 04:19:24 +00:00
jenkins-bot 1f8c99aa72 Merge "Don't process references defined inside template-generated reflists" 2020-01-08 23:32:33 +00:00
jenkins-bot a6c33abc57 Merge "Remove invalid test case" 2020-01-08 17:04:21 +00:00
Thiemo Kreuz 04fbbbd3ca Report conflicting extends="…" with an error message
Bug: T242110
Change-Id: I04342b2c219981dfb9575ea58cfccf6c2ba1066c
2020-01-08 16:47:07 +00:00
Thiemo Kreuz d07110b790 Fix incomplete undo/redo stack implementation
The rollback feature was not able to properly restore a __placeholder__.
That's why a specific use case was behaving different. This already
worked just fine:

<ref extends="a">…</ref>
<references>
<ref name="a">…</ref>
</references>

But this didn't, even if it is the exact same from the users
perspective:

<ref extends="a">…</ref>
{{#tag:references|
<ref name="a">…</ref>
}}

Bug: T239810
Change-Id: I163a1bffb9450a9e7f776e32e66fb08d0452cdb9
2020-01-08 17:43:02 +01:00
jenkins-bot 70e53556a4 Merge "Make native selection over reference nodes visible" 2020-01-08 16:31:18 +00:00
Adam Wight b7c9dbb0d5 Remove invalid test case
Unnamed references are never merged.

Bug: T239788
Bug: T240459
Change-Id: I8dd3706c688108bf2e3c0e9b55f123084b325d16
2020-01-08 16:59:28 +01:00
Thiemo Kreuz 87642f4fb8 Simplify a for-loop in ReferenceStack
The main motivation is to remove the not needed variable $i. As well
as getting rid of the break.

Change-Id: Idd9f83c2166b1c0da7054a616cd8c3d5540ebc12
2020-01-08 16:55:49 +01:00
Thiemo Kreuz e5640b4415 Remove old comments talking about removed code
Change-Id: I75d9180ce8d94e9397249f9557ac1e6cfafdca8b
2020-01-08 16:54:02 +01:00
jenkins-bot 861c4edba7 Merge "Test cases for extends pointing to the <references> section" 2020-01-08 10:42:14 +00:00
Translation updater bot 612be4396b Localisation updates from https://translatewiki.net.
Change-Id: Iabc33a6d75ed662ed928cb83ad54c47b97e39807
2020-01-08 08:41:55 +01:00
Thiemo Kreuz 6ddfd9983b Fix bad numbering when reusing sub-references
Note this leaves *another* bug behind. When a <ref> is properly reused
by name="…", and the content is fine (either missing or identical),
possibly conflicting extends="…" attributes are currently entirely
ignored. However, this is already much better than what happened before.

Bug: T242110
Change-Id: Id808ce31c8036cc290f68bb3e8c5a7b12f4f44cf
2020-01-07 16:34:05 +01:00
WMDE-Fisch b74a88a3f9 Reduce indentation margin for book references
This should now roughly resemble 2nd level indentation for nested
list elements. CSS Janus should take care of RTL compatibily.

Bug: T239329
Change-Id: I2eb5b63033f558555b1d79faba82b5a774ddd934
2020-01-07 13:04:52 +01:00
Thiemo Kreuz 5db90fb5a9 Test cases for extends pointing to the <references> section
This is an extremely relevant use case, but we never had a test for
this:

Some text.<ref extends="book">Page 2</ref>

<references>
  <ref name="book">Title of the book</ref>
</references>

What this means: There is no reference in the text that points to the
book as a whole, only references that point to individual pages. The
base <ref> is not used in the text.

This is already properly rendered. There is no "jump back to the text"
link. However, this fails when <references> is wrapped in {{#tag:…}}.

Bug: T239810
Change-Id: Id22db0238266a4fd6131d1a10eb6bf6227552c19
2020-01-07 12:43:18 +01:00
Translation updater bot c8ed9fe18e Localisation updates from https://translatewiki.net.
Change-Id: I0aabcffb2a955650c0e34c5dc51dab0cb546f773
2020-01-07 08:47:49 +01:00
jenkins-bot 44f3f5bf44 Merge "build: Updating mediawiki/mediawiki-phan-config to 0.9.0" 2020-01-07 03:47:57 +00:00
jenkins-bot b98875bf7c Merge "Consolidate refCallStack-gnosticism" 2020-01-06 12:55:37 +00:00
jenkins-bot ce5dc41597 Merge "Correction to error message" 2020-01-06 12:48:29 +00:00
Adam Wight 2aed80be24 Consolidate refCallStack-gnosticism
The rollbackRefs function no longer needs to "know" details about
how to turn a refCallStack item into a redo item.  This is better a
responsibility of the subroutine, where the items are unpacked.

Change-Id: I1e2ff77cb5e66d70e451ee09e641ff752c770ab4
2020-01-06 12:43:16 +00:00
Translation updater bot 40d3cb1e8c Localisation updates from https://translatewiki.net.
Change-Id: I62aafceebc2aa593c9d163fc9966e675dec9de79
2020-01-06 08:48:26 +01:00
Bartosz Dziewoński b475eca1b9 Don't process references defined inside template-generated reflists
As a result, the references are now treated like any other
template-generated reference, e.g. they can't be edited.

Previously they could be edited as if they weren't template-generated,
causing trouble. Editing them had no effect (changes would not be
saved), and copy-pasting them into another page resulted in
"substituted" content (template metadata was lost).

Bug: T209493
Change-Id: I4e75ccd57cd752a726653c725d8c29a09306e83b
2020-01-04 15:53:21 +01:00
Bartosz Dziewoński 52646d1a7c Make native selection over reference nodes visible
Bug: T241880
Change-Id: Ie712d4edc2ef49dd3b1f4ca186b2e2d539ab8659
2020-01-04 14:00:40 +01:00
Translation updater bot 15fc463994 Localisation updates from https://translatewiki.net.
Change-Id: I0486c53563c6bf1aacd51e48b51f0395d30794c3
2020-01-03 08:44:57 +01:00
Translation updater bot 94e47e5908 Localisation updates from https://translatewiki.net.
Change-Id: I689527e190c21c11c5efa605a4c8680f6ebb9a8c
2020-01-02 08:57:51 +01:00
jenkins-bot 166f8ef565 Merge "Add missing parser tests for relevant responsive edge cases" 2019-12-30 18:48:23 +00:00
jenkins-bot 5c09f8de16 Merge "Clean up i18n messages" 2019-12-29 21:30:05 +00:00