Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tag: Disallow conflicting file tags and use functions to validate #1000

Merged
merged 2 commits into from Jul 12, 2020

Conversation

Amorymeltzer
Copy link
Collaborator

@Amorymeltzer Amorymeltzer commented Jun 25, 2020

1st commit disallows some conflicting file tags, as requested at WT:TW. There are probably more we could do, this covers:

  • Only one of {{Bad GIF}}, {{Bad JPEG}}, {{Bad SVG}}, and {{Bad format}} is used
  • Only one of {{Should be PNG}}, {{Should be SVG}}, and {{Should be text}} is used
  • Only one of {{Bad SVG}} and {{Vector version available}} is used
  • Only one of {{Bad JPEG}} and {{Overcompressed JPEG}} is used
  • Only one of {{PNG version available}} and {{Vector version available}} is used
  • The correct extension is used for Bad GIF/JPEG/SVG and Should be PNG/SVG
  • Only allows JPEGs to be tagged with {{Overcompressed JPEG}}
  • Only allows SVGs to be tagged with {{Bad trace}} and {{Bad font}}

2nd commit uses checkIncompatible and checkParameter to make the repetitive validation measures more straightforward.

modules/friendlytag.js Outdated Show resolved Hide resolved
`checkIncompatible` and `checkParameter` should make the repetitive validations easier
@Amorymeltzer Amorymeltzer added this to the July 2020 update milestone Jul 12, 2020
@Amorymeltzer Amorymeltzer merged commit 9758b2b into wikimedia-gadgets:master Jul 12, 2020
@Amorymeltzer Amorymeltzer deleted the tag-mutuals branch July 12, 2020 18:52
@Amorymeltzer
Copy link
Collaborator Author

Unrelated, but woo, 1000 issues/PRs!

Amorymeltzer added a commit to Amorymeltzer/twinkle that referenced this pull request Aug 31, 2020
Amorymeltzer added a commit to Amorymeltzer/twinkle that referenced this pull request Sep 16, 2020
Stems from wikimedia-gadgets#1000 (see also wikimedia-gadgets#1108/wikimedia-gadgets#1114).  Basically, in wikimedia-gadgets#1000 I naively set tag up to check for uses of {{Bad (ext)}} whilst simultaneously forgetting that {{Bad Trace}} and {{Bad font}} were a thing.  This should also improve the message by correctly identifying when an appropriate option is available.

Reported at WT:TW: https://en.wikipedia.org/w/index.php?title=Wikipedia_talk:Twinkle&oldid=978523110#Unable_to_add_Template:Bad_trace

This all needs work anyway.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants