Commit graph

22 commits

Author SHA1 Message Date
Steven Rawson fdf17f326f Cite: Move margin in column references
In Vector, Timeless, and Monobook ("desktop"), there is a 0.3em margin applied to <ol>. When in
columns, this causes the first column to be offset from any others vertically. This change moves
the margin from the references <ol> (i.e., sets the list margin-top to 0) to the enclosing div
(sets the div margin-top to 0.3em) when the div has the columns class. This approach is currently
employed by some wikis such as en.wp for their {{reflist}} template.

Minerva doesn't seem to have the relevant top margin.

Bug: T249441
Change-Id: I3eeb3fe9fd690cd8f74df5541b3ef5e10eeed123
2021-02-08 21:56:39 +00:00
Volker E e5b6ae0323 Reduce reference code padding
Don't use inherited one, but set a small one instead.

Change-Id: Ib38102478ed53a6e4fd8cc25d118f346f81758bb
2020-03-18 07:16:13 +00:00
Volker E 774fda06a9 Fix cite error ref code color contrast ratio
Using `background-color: transparent` here to step away from inheritance of whatever `code` would provide theme-independent.

Bug: T247903
Change-Id: Ibeb6b68556b6ad83dacaf1b8fed59a2b971c0221
2020-03-17 21:43:17 +00: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
Adam Wight 377cdb3b9f Less checkered error message style
We print error messages in red, bold, large text so that they stand
out from content.  "<code>" spans, which are prevalent in our messages,
were styled with black text by accident, this patch turns them red.

This should cause less annoyance on readers.

Change-Id: Ic911552909ecc5ace4be927cad5b835e1006355e
2019-12-20 10:58:56 +01:00
Thiemo Kreuz fc1865780d Add missing dot to "1.2." list numbering for extended refs
All mock screenshots on
https://de.wikipedia.org/wiki/Wikipedia:Technische_W%C3%BCnsche/Topw%C3%BCnsche/Erweiterung_der_Einzelnachweise
show this extra dot.

Note the numbering scheme "1." and "1.1" (without the dot) was not a
mistake. It's not uncommon to only have the extra dot on the first
level.

However, I feel the scheme "1." and "1.1." might be a little more
consistent and less surprising.

Change-Id: I0dc467755926f82d88a48fb7594af0bde8bbee21
2019-12-09 09:55:32 +01:00
Thiemo Kreuz 0f146cd56e Fix possibly broken reference list counters in Firefox
This patch applies a few closely related changes:

1. Instead of reusing and possibly messing with the existing
"mw-ref-linkback" counter, I start a new one.

2. I also gave both new counters better names, following the
"mw-ref-…" naming scheme.

3. We must reset the build-in "list-item" counter to make this code
behave sane in Firefox. It looks like this is even described in the
CSS spec and it is not Firefox having a bug, but Chrome being "clever"
and not following the spec.

Bug: T239787
Change-Id: Ib6e9de689129b7c2d50e3a1c720c0d2d5a0c0986
2019-12-04 12:13:13 +01:00
Adam Wight 0f2c56e0ac Fix top-level reference numbering
This fixes a Firefox-only glitch where the CSS counter was messing
with the native list numbering. Example:
https://en.wikipedia.beta.wmflabs.org/wiki/Draft:Cut_the_Crap

Change-Id: I6e6514e73bcf6485402b6a61aa5202ebb83a6479
2019-12-03 12:32:29 +01:00
Thiemo Kreuz 13598ba11e Render nested references
Forked from Icd933fc983.

Bugs and unimplemented features are documented as TODOs in the parser test
fixtures.

Bug: T237241
Change-Id: I9427e025ea0bcf2fa24fd539a775429cc64767cc
2019-11-29 13:40:34 +01:00
Derk-Jan Hartman a603ef420f Make references not inherit bold or italic styling.
There is almost never a situation where this is desirable, yet it
happens quite a lot due to table headers etc having bold styling.
It confuses editors and tends to be less readable.

These style rules have been in en.wp:MediaWiki:Common.css for over 10
years or so, so probably a keeper.

Change-Id: If3d12383853a83d8ef14f1ec54c8c381b6c8f6a2
2018-08-01 14:57:37 +02:00
Eranroz 1ca27aa0d8 Support directionality for reference
Adding option for dir attribute in ref tags. The value must be a valid
direction ('ltr' or 'rtl', case insensitive) or the direction will be
stripped out.

The directionality of the li element is set using a css class accordingly.

Bug: T15673
Change-Id: Iff480bc8cc4f81403b310e8efecd43e29d1d4449
2018-05-02 17:27:32 +02:00
Volker E 223662791c Align colors to WikimediaUI palette ones
Bug: T179608
Change-Id: Ie37b39b17d2e183c091d2e85dc729d75adf555d5
2017-11-02 20:17:19 +00:00
James D. Forrester 490e193f7f Reduce column width from 35em to 30em
Bug: T161788
Change-Id: I9c8e0479187ff92af5207145f52bb73519cecf29
2017-05-11 12:56:34 -07: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
Ed Sanders bac8dd6be7 Add stylelint and make required style fixes
Change-Id: I8a9def8056a72c3da0c066413e94311a1d839f5b
2016-05-17 18:21:30 +01:00
Amir E. Aharoni 52293b1749 Add lang and dir attributes to cite errors
This is needed when the error appears in an element with
a direction that is different from the UI language.

Change-Id: I583c9cc30f5bec24ab92e97ab938463ea0e45c15
2016-04-30 16:16:58 +03:00
Amire80 1b1350491f Don't allow a reference that includes a group name to break in the end of the line
A reference that has a group name appears as "[group 1]".
Because of the added space in the middle, this can break in the end
of a line. white-space: nowrap prevents it.

Change-Id: Icfbc8b7e37b77b93b621e424d1f4e1759ac644cd
2016-03-19 13:55:04 +02:00
cenarium 469217073a Use span with css instead of strong for cite errors
Change-Id: I9b8954b56646ca9c4632788824346e6116de3146
2016-02-24 18:57:37 +00:00
Bartosz Dziewoński 04ac55ed52 Revert "Use display: inline-block instead of unicode-bidi"
I think this change causes too many issues on non-LTR wikis
(see the associated tasks) to be acceptable in the current form.

Maybe it should be redone to apply to RTL text only if it's
worth it there (apologies, but I don't quite understand the issue).

This reverts commit e9c1521fca
and commit 59ef3c8678 (which was
the previous attempt to fix it and caused different issues).

Bug: T108493
Bug: T110057
Change-Id: I205400c59a342dcc4cdf89791bc1c761805cd2a8
2015-08-24 20:33:28 +00:00
Ebrahim Byagowi e9c1521fca Use display: inline-block instead of unicode-bidi
On I16a701f3b962b5e7f63554be2f28888a938548b0 we incorporated
unicode-bidi: embed; instead isolate but it caused regression on
* https://fa.wikipedia.org/?oldid=15565588
* https://fa.wikipedia.org/?oldid=15552160
where references ([۱]) comes before number with Persian digits.

Using unicode-bidi: isolate; is the clean solution for fixing this
however due to Firefox bug https://bugzilla.mozilla.org/1185987
it is not going to fix the regression on Firefox so using
display: inline-block; in hope to get same effect with Chrome
on unicode-bidi: isolate; but also support IE and older browsers.

Change-Id: I1d62c1fb282acc72ab20d71cc8cd21e3e1d71493
2015-08-02 14:02:26 +00:00
Amir E. Aharoni 59ef3c8678 Change unicode-bidi: isolate to embed
"embed" works just as well in modern browsers.

Also fix the comment to be more correct.

Change-Id: I16a701f3b962b5e7f63554be2f28888a938548b0
2015-07-11 22:47:30 +03: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