Commit graph

45 commits

Author SHA1 Message Date
Thiemo Kreuz 6daf49c9bc Fix rebase mistake in extension.json
This is a rebase mistake introduced with I7461ffd. Since If83420a this
module is not defined in extension.json any more, but in the
ResourceLoaderRegisterModules hook in PHP. This is done to be able to
dynamically change the contents of the module, depending on the
availability of anotehr extension.

I'm not exactly sure what happens when a module is defined twice. I
tried locally and it seems to work, with no visible error message.

Bug: T234605
Change-Id: I209e19bbc2184a6d58086a703145ad58671060b6
2019-10-17 09:01:25 +02:00
Thiemo Kreuz 34e3675d0f Remove unused ResourceLoader module ext.cite.a11y
As stated in the patch I26fe41c: "The separate ext.cite.a11y module
is kept for (temporary) compatibility with cached HTML, and should be
removed in about a month." That was almost a year ago.

Bug: T205270
Change-Id: I7461ffd61bea0b79a56b6ee9ce8315f5f6c39b7b
2019-10-16 11:36:02 -07:00
Adam Wight 741f5dcdaa Bundle tracking with another RL module
This is slightly more efficient because it saves on early page-
load bandwidth.

Bug: T234605
Change-Id: If83420a9b4e654fd790e810fa82f922a8ba06e50
2019-10-10 10:44:50 +02:00
Adam Wight c12150082c Baseline reference interaction tracking
Collect EventLogging metrics for footnote and reference link
interactions, so that we can compare behavior with and without
Reference Previews enabled.

This tracking will be reverted once analysis is complete.

A mostly arbitrary sample rate of 1/1000 is hardcoded here.  This is
loosely based on the latest tuning of Popups sampling at 1/100,
divided by a conservative factor of 10 to ensure headroom.

The sample is skewed by skipping clients without sendBeacon support,
but we're avoiding the mw.track synchronous fallback, which injects an
image tag and introduces lag any time the user clicks external links
in the references.

Bug: T231529
Change-Id: Iad32b64114f88675eecbb01712418c968e3cf661
2019-10-01 10:23:31 +02:00
Amir Aharoni 00c31ffc7e Split apihelp messages to a separate file
Bug: T189982
Change-Id: I7808076245d39fa10d75d67c9a9180dccd708f40
2019-07-11 18:03:42 +03:00
Thiemo Kreuz 85ad4513ba Fix highlighting code destroying backlinks on unnamed <ref>s
There are multiple formats for these IDs:

cite_ref-1, cite_ref-2, and so on for anonymous <ref>s without a name.

cite_ref-name_1-0 for named references, where "name" is the custom name,
and "_1" is the sequential number for the reference (same number as above).
The final "-0" is counting the usages. If a named <ref> is only used once,
there is no cite_ref-name_1-1 anywhere on the page.

The later was already checked by the code. But we forgot about unnamed
references! As a consequence IDs like the cite_ref-1 above got misdetected
as reused references.

This patch tries hard to extract code into named functions, so it becomes
much more clear what they do, and why.

Bug: T215317
Change-Id: Iedb5b0c3dffae19bad7df9a43ed2d4512b3921ec
2019-02-20 15:40:46 +00:00
WMDE-Fisch 6dda36a1e7 Improve a11y support on backlinks
This changes the a11y support on the main backlinks by introducing the usage
of title and aria-labels. The support for these elements increased a lot since
the topic was first tackled and seems the appropriate way to go.

A new message was introduced for the link that will be set when directly
coming from a clicked refrence to emphasize that the can jump back to where
he came from.

Bug: T206323
Change-Id: Ifa56d41bcdb8100e19f29619796b62bb3c886d2f
2018-11-26 11:36:26 +01:00
Thiemo Kreuz ee8da566e3 Highlight backreference jump marks by making them bold
The separate "ext.cite.a11y" module is kept for (temporary)
compatibility with cached HTML, and should be removed in about
a month.

Browser tests will be added in a separate patch.

Bug: T205270
Change-Id: I26fe41c328157233cc5b06d38d2ba0f7b036a853
2018-11-19 16:46:08 +01:00
Umherirrender 1cc403429d Use tabs in extension.json
Change-Id: I614010709e7e8679a4382bb4f0d534cb32816e05
2018-09-16 11:12:25 +02:00
Kunal Mehta aa5d0ff171 Only register one name in MessagesDirs
Each name can have multiple directories though.

Change-Id: Ifed47cc7079c2fda96b659a8f887ce6afaa511fb
2018-09-12 16:49:10 +00:00
James D. Forrester a33f107079 VE: Make the OOUI citation icons available
This allows on-wiki use to be migrated to the standard icons rather than
in-repo ones, so that they can (later) be removed.

Change-Id: I19bec075c77396f163977962bbe1afb69a231c1e
2018-08-14 11:55:44 -07:00
Ed Sanders bc20690b88 Give Cite a version number
This allows other extensions to depend on it (e.g. Citoid).

Change-Id: I27eba2c693cad98ee2a854ac7a52329e19d2fa71
2018-05-12 13:28:50 +01:00
Tim Starling db85682b63 Remove failed experiment $wgCiteCacheReferences
This was briefly enabled in WMF production in 2009 and found not to work.
As far as I know, it's been disabled since then. Retaining it requires
maintaining the complex "half-parsed serialization" feature in the core
parser, which I'm deprecating in I838d7ac7f9a218. The core feature was
added solely to support this Cite caching experiment and is not used for
anything else.

Change-Id: I446e0c46913a390dbdf7b49b84040bf47ed6c2f9
2018-02-28 21:04:42 +11:00
Bodhisattwa e00576f24a Removed deprecated position statements from resource loader module
Bug: T184257
Change-Id: I3aa850a4c492f6c927a32f12652cc319bf22ea92
2018-02-02 19:44:31 +00:00
Kunal Mehta 5483046f25 Use SPDX 3.0 license identifier
SPDX released version 3 of their license list (<https://spdx.org/licenses/>),
which changed the FSF licenses to explicitly end in -only or -or-later
instead of relying on an easy to miss + symbol.

Bug: T183858
Change-Id: I77bf3f7910b083ff8a09ebc4c556ab60f500803a
2018-01-04 02:54:51 -08:00
C. Scott Ananian 14459c226b Use HTML5 id attributes; remove use of deprecated Sanitizer::escapeId()
When using HTML5 ids, we need to take greater care to properly escape the
id (or derived strings) before passing them back through
Parser::recursiveTagParse().

Bug: T176170
Change-Id: I89a4f8ba24b867f2d5ccdc2bf9a4312ab9b385a9
2017-09-19 15:42:41 -04:00
Arlo Breault d465b4e001 API: Expose $wgCiteResponsiveReferences via meta=siteinfo
Bug: T159894
Change-Id: I2404999ab11b5cf7b740ae43696c4676ab1b6d22
2017-09-11 23:04:25 -04:00
jenkins-bot 8c4ca272c4 Merge "Reduce column-width to 25em for Minerva skin" 2017-07-11 12:05:48 +00:00
Kunal Mehta a2700ae26d Take advantage of parser test autodiscovery
See <https://www.mediawiki.org/wiki/Parser_tests> and T143976.

Bug: T170037
Change-Id: Iabbb9d967d51d31bf43f53d843b14054f800fb09
2017-07-07 23:42:46 -07:00
jdlrobson bb9720edff Reduce column-width to 25em for Minerva skin
Current Minerva skin is purposely restricted to 55.8em
This means references will never be split into 2 columns as 30em*2=60em.
Dropping it to 25em would mean the CSS applies here and no more than 2
columns would ever be used to display references.

Bug: T160497
Change-Id: I6f9b85cd6cfdb055692b1f537d569c158900f7c9
2017-06-16 11:17:35 -07:00
jenkins-bot 506dceb33c Merge "Highlight text inside <ref> tags as a wikitext in CodeMirror editor" 2017-05-08 18:25:46 +00:00
Pavel Astakhov 9fd55c5f38 Highlight text inside <ref> tags as a wikitext in CodeMirror editor
see bug T163238
Depends-On: Idb7a1a5769a1047ef2f7cd25a7152f73a6613225
Change-Id: I1bf156fa813af4d5f891619f692047bbdb8a1a86
2017-04-29 08:35:24 +06:00
James D. Forrester efce5f2b49 Drop the pointless "AllowCiteGroups" config setting
Bug: T161144
Change-Id: Ie1454926b8bfa108a62d088991e66b6dae9c9f10
2017-04-20 22:56:08 +00:00
Timo Tijhof 04c3ad0107 Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.

That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.

The template currently sets an exact column count (via the CSS3
property `column-count`).

This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.

The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.

It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.

Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.

To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.

Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.

If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.

In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.

* Deprecate cite_references_prefix/cite_references_suffix.

  This message is rarely used and opens up compatibility hazards.
  It was already removed by Parsoid, but the PHP implementation
  still had it. It's typically used to add inline styles to the
  wrapper which is more appropiately done in Common.css (or
  obsoleted as part of the skin or Cite extenion itself nowadays
  depending on what style in question).

  It was also a HTML-style message with separated open and close
  segments, which is an anti-pattern in itself.

* Declare module target explicitly and include mobile. The absence of
  this stylesheet caused subtle BiDi/RTL bugs on mobile.

Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2017-03-07 22:42:47 +00:00
Antoine Musso 5fcecf9e5f Skip registering RL modules depending on VisualEditor
When VisualEditor is not installed, there is no point in registered
resource loader modules that depends on it.  A use case is trying to run
tests for the MediaWiki tarball. It comes with Cite but without
VisualEditor.

The patch is based on GuidedTour patch by Matthew Flaschen
https://gerrit.wikimedia.org/r/#/c/305691/ for T143297

Change-Id: Idf769e0149f93c099a94b1b7a6cb203273dab881
2016-10-14 23:45:03 +02:00
addshore 440b317908 Move parser tests to test directory
Change-Id: I92207b88ddba4018b4a09fb9d8848b60c5f79e1e
2016-09-20 14:33:36 +00:00
addshore c1de73eb32 Move php files in includes directory
Change-Id: Ic6afacbf2a944954826c9d68dd292c28f1c731da
2016-09-20 15:33:10 +01:00
Alex Monk 724d890541 Make it possible to send VE cite toolbar items to the 'insert' (other) group
To be merged with Ifd688ae6

Bug: T133727
Change-Id: Ic87f996f2a95ffe89999384c48f11745f251db0e
2016-06-29 13:36:14 +01:00
James D. Forrester 45a5b658ed Drop backwards-compatibility ext.visualEditor.mwreference module
Change-Id: I5051b650b9430107d683509aee12411fa1db551b
2016-03-13 10:49:26 +00:00
Kunal Mehta 92c858fd76 Remove not actually "@comment" from ResourceModules definition
extension.json only removes top level and "config" keys that start with
@, so this "comment" was actually being passed onto ResourceLoader and
eventually being ignored at that stage.

But since it's not a recognized value, it causes validation of the
extension.json file against the schema to fail.

Bug: T128311
Change-Id: Ibed94e1818c8fc9c3afdc3e09d0af5e84c49a342
2016-02-28 01:24:21 -08:00
jdlrobson 509741dc17 Surface references via api query property
* The query request prop=references will return a JSON blob of all
references in the page
* Conveniently references are returned with an array id key that corresponds
to an anchor tag in the HTML
* When references storage is disabled the API request will trigger an
error.

Bug: T123290
Change-Id: I81a965bcb47d17df18f1e415e3c25f88f6b48ffc
2016-02-26 19:02:12 +00:00
cenarium d63c51ebf2 Merge LinksUpdateConstructed hook into LinksUpdate
This merges the content of the LinksUpdateConstructed hook callback
into the LinksUpdate hook callback since it's fine to defer saving
to the cache.

Change-Id: Iad6008a31aaf659af3c560858df278335bc57c8f
2016-02-26 19:00:54 +00:00
cenarium 70e14ebaeb Store references in page_props and cache
This stores references in page_props during links update in
compressed JSON form. If the size is too big, it's broken up
in several parts to fit, which is very unlikely to occur more
than once.

When the data is retrieved from the db, it's always cached. If
set in config, it's also saved in the cache on parse. If not,
the cache is invalidated when references are modified.

Uses cases include : section preview to also show refs defined
elsewhere on the page (T124840) and MobileFrontend (T123328).
For the later, this still needs API support (T123290).

There's a soft dependency on the core change
I0c73b3d181f32502da75687857ae9aeff731f559.

Bug: T125329
Change-Id: I7b106254b8f264f93b0f0c9cfa89f65adeeea4f0
2016-02-10 14:47:02 +01:00
Ed Sanders 8b0e9c728c VisualEditor: Bring in unit tests from VE
Change-Id: I7da5f25f61d0c7f2331ab927c35d8f6a975041b8
2016-02-05 13:41:43 -08:00
Ed Sanders 18f616b9b8 VisualEditor: Move code for Cite into this repo
This code has been developed over three years now in the repo of MediaWiki's
integration of VisualEditor. It has grown and developed significantly during
that time, but now is pretty stable. A number of hacks inside the MediaWiki-
VisualEditor code base have been used to prevent this code from being loaded
on wikis where the Cite extension is not deployed, but this state of affairs
is and always was meant to be temporary.

This code is under the MIT licence which is a tad messy, but not impossible.
It's clearly labelled as such. The list of authors has been updated to take
into account the influx of new functionality.

Bug: T41621
Bug: T104928
Change-Id: I39936ed83d5a60471a0a75da753f498e80aef234
2016-02-04 08:41:54 -08:00
Amir E. Aharoni 68304fcacd Add pages with Cite errors to a tracking category
Bug: T104792
Change-Id: I6f8b12788a20480bd8880332238d545ee70a8ef9
2015-09-24 12:16:13 +03:00
jenkins-bot e8e88cec17 Merge "Remove WMF deployment hack ext.cite and ext.rtlcite modules" 2015-07-16 20:41:48 +00:00
Derk-Jan Hartman 3bb504207d Add mobile target to VE/parsoid style module for Cite
Change-Id: Id960ddd55d82167536ad457b675f435957b95c50
2015-07-13 14:57:41 +02:00
Derk-Jan Hartman d4baf5927e Remove WMF deployment hack ext.cite and ext.rtlcite modules
It's been 30 days after deployment of I58adcfbcf9af2bb3.

Bug: T101559
Change-Id: I0217b8d15cdd495a163b3f1fc1af018f6d2fe271
2015-07-06 14:47:27 +00:00
Stephane Bisson 61997fd9b8 Style module should define its position explicitly
Put 'ext.cite.style.css' at the top.

Change-Id: Ibb5347a4f831438542da252e6d19f451276419aa
2015-06-10 16:41:13 -04:00
Marc Ordinas i Llopis aa8fed3a3d Use CSS to style Parsoid's Cite HTML
* Add a new module ext.cite.style to load the new CSS.
* Add a ResourceLoaderFileModule that adds the correct CSS file
  depending on the content language, so that the visual style of
  citations can be changed per-language.

The main ext.cite.style.css file renders similarly to MediaWiki's
default Cite style. Also, an example CSS for Farsi numbering is
included.

Bug: T86782
Change-Id: I487095df8a7c4241a14f7b4480360f6774130bec
2015-06-08 21:58:15 +01:00
Derk-Jan Hartman 05cb5cc1a0 Cleanup style RL modules for Cite
Move the JS which is purely for accessibility purposes into a separate
JS RL module named ext.cite.a11y. Move all pure CSS, which is not dependant
on accompanying JS into a separate ext.cite.styles module

Bug: T101559
Change-Id: I58adcfbcf9af2bb3b6d5dabb6c38c42af78e0416
2015-06-06 15:43:27 +02:00
Bartosz Dziewoński 3ac0dedd1b Move '@media print' rules to separate file
Not a fix for T93746 yet, but a prerequisite.

Bug: T93746
Change-Id: I3dc1fa9cf176540500b48f21d9f4f737b37010d1
2015-06-04 22:22:16 +00:00
Kunal Mehta e83a80e348 Set manifest_version in extension.json
Bug: T100745
Change-Id: Iee75b2bfe6b440daf9056cf2b7d624610d0f641e
2015-05-28 20:45:57 -07:00
Kunal Mehta 1048c10178 Add extension.json, empty PHP entry point
Depends upon I9a736a4c0ff73 in MediaWiki core

Bug: T87893
Change-Id: I860a1da0b49092bfeeea2c8f80b4da57efc913ec
2015-05-03 06:36:25 +00:00