Page MenuHomePhabricator

ConvertReference should ignore plain PDF links for now
Closed, ResolvedPublicFeature

Description

Feature summary: Prevent ConvertReference from Suggesting a conversion of a PDF citation.

Use case(s): The Suggestion Mode feature for converting a reference (ConvertReferenceEditCheck.js) does not work at all with PDF files. There is a possibility that it may work in the future (via T424982 and linked tasks), but for now it is creating Suggestions that cannot be completed with the built-in conversion tool.

Benefits: Decrease the quantity of tasks that are significantly more complex than intended.

Alternative: On some wikis, there is a related "inline cleanup template", e.g. Enwiki's w:en:Template:Bare_URL_PDF. -- We could potentially show the contributor a button to add that template, instead of just not-showing the ConvertReference Suggestion at all (or hoping they'll attempt a fully-manual conversion).

Notes: Filing based on comments at:


Derived Requirement

Ensure ConvertReference does not generate Suggestion Mode suggestions for citations that contain plain PDF links, since the built-in conversion tool cannot currently convert these PDF references.

Test Steps

Test Case 1: Ensure ConvertReference does not suggest conversion for plain PDF links

  1. Open a Wikipedia article containing a reference with a plain PDF URL.
  2. Open the article in VisualEditor.
  3. Enable Suggestion Mode.
  4. Navigate to the section containing the plain PDF citation.
  5. Allow Suggestion Mode to analyze the article.
  6. Review the suggestions generated for the PDF citation.
  7. Verify that no ConvertReference suggestion is displayed for the plain PDF citation.
  8. ✅❓❌⬜ AC1: ConvertReference does not generate a conversion suggestion for a citation containing a plain PDF link.

Test Case 2: Ensure ConvertReference continues to suggest conversions for supported non-PDF citations

  1. Open a Wikipedia article containing both a plain PDF citation and a supported non-PDF citation.
  2. Open the article in VisualEditor.
  3. Enable Suggestion Mode.
  4. Allow Suggestion Mode to analyze the article.
  5. Locate the plain PDF citation.
  6. Verify that no ConvertReference suggestion is displayed for the PDF citation.
  7. Locate the supported non-PDF citation.
  8. Verify that ConvertReference can still provide a suggestion for the supported citation when it meets the feature's criteria.
  9. ✅❓❌⬜ AC2: Ignoring plain PDF links does not prevent ConvertReference from generating suggestions for eligible non-PDF citations.

QA Results - Beta

ACStatusDetails
1✅T436547#12305014
2✅T436547#12305014

Event Timeline

So, caveat: we cannot actually detect PDFs. We can detect URLs that seem to point to a filename ending in .pdf, which is related but doesn't actually map 1:1 in either direction. E.g. arxiv PDF URLs look like https://arxiv.org/pdf/2608.27557.

Change #1332797 had a related patch set uploaded (by DLynch; author: DLynch):

[mediawiki/extensions/VisualEditor@master] ConvertReferenceEditCheck: add a forbiddenExtensions config, default pdf

https://gerrit.wikimedia.org/r/1332797

So, caveat: we cannot actually detect PDFs. We can detect URLs that seem to point to a filename ending in .pdf, which is related but doesn't actually map 1:1 in either direction. E.g. arxiv PDF URLs look like https://arxiv.org/pdf/2608.27557.

@DLynch: accurate for me to think the above describes what you implemented in 1332797?

Alternative: On some wikis, there is a related "inline cleanup template", e.g. Enwiki's w:en:Template:Bare_URL_PDF. -- We could potentially show the contributor a button to add that template, instead of just not-showing the ConvertReference Suggestion at all (or hoping they'll attempt a fully-manual conversion).

Related: would Edit Check's existing configuration architecture accommodate what @Quiddity is describing here? E.g. when volunteers set a value for, let's call it, inlineCleanupTemplate, the decline button could do as Nick is describing?

Great first step. Thank you for clarifying.

Related: would Edit Check's existing configuration architecture accommodate what @Quiddity is describing here? //E.g. when volunteers set a value for, let's call it, inlineCleanupTemplate, the decline button could do as Nick is describing?

That's a thing we could do, certainly. Though we might want to not have decline do it, because then the check would have no way for the user to communicate "you are wrong".

Related: would Edit Check's existing configuration architecture accommodate what @Quiddity is describing here? //E.g. when volunteers set a value for, let's call it, inlineCleanupTemplate, the decline button could do as Nick is describing?

That's a thing we could do, certainly. Though we might want to not have decline do it, because then the check would have no way for the user to communicate "you are wrong".

Oh, good point. Created: T436606

Change #1332797 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] ConvertReferenceEditCheck: add a forbiddenExtensions config, default pdf

https://gerrit.wikimedia.org/r/1332797

@DLynch Quick question regarding AC1 before I mark this as resolved. You just want a URL ending in .pdf to not receive a "Convert reference" suggestion, while a normal URL should still receive one, correct? Also, if the "Convert reference" suggestion is open for reference 2 and I click on reference 1, should the suggestion close since reference 1 is a PDF or is that fine?

Test Result - Beta

Status: ✅ PASS / ❓Need More Info
Environment: Beta
OS: macOS Tahoe 26.5.2
Browser: Chrome 152
Device: MBA
Emulated Device: NA

Test Artifact(s):
https://en.wikipedia.beta.wmcloud.org/w/index.php?title=T436547_test&veaction=edit

Test Steps

Test Case 1: Ensure ConvertReference does not suggest conversion for plain PDF links

  1. Open a Wikipedia article containing a reference with a plain PDF URL.
  2. Open the article in VisualEditor.
  3. Enable Suggestion Mode.
  4. Navigate to the section containing the plain PDF citation.
  5. Allow Suggestion Mode to analyze the article.
  6. Review the suggestions generated for the PDF citation.
  7. Verify that no ConvertReference suggestion is displayed for the plain PDF citation.
  8. ✅❓AC1: ConvertReference does not generate a conversion suggestion for a citation containing a plain PDF link.
ReferenceConvert button

Test Case 2: Ensure ConvertReference continues to suggest conversions for supported non-PDF citations

  1. Open a Wikipedia article containing both a plain PDF citation and a supported non-PDF citation.
  2. Open the article in VisualEditor.
  3. Enable Suggestion Mode.
  4. Allow Suggestion Mode to analyze the article.
  5. Locate the plain PDF citation.
  6. Verify that no ConvertReference suggestion is displayed for the PDF citation.
  7. Locate the supported non-PDF citation.
  8. Verify that ConvertReference can still provide a suggestion for the supported citation when it meets the feature's criteria.
  9. ✅ AC2: Ignoring plain PDF links does not prevent ConvertReference from generating suggestions for eligible non-PDF citations.

See AC1

Quick question regarding AC1 before I mark this as resolved. You just want a URL ending in .pdf to not receive a "Convert reference" suggestion, while a normal URL should still receive one, correct?

Yes. And specifically the suggestion in the sidebar -- this doesn't change anything about the "convert" button in the citation context item.

Also, if the "Convert reference" suggestion is open for reference 2 and I click on reference 1, should the suggestion close since reference 1 is a PDF or is that fine?

That's unrelated -- the sidebar suggestion doesn't change when you move your selection around unless you actively move your focus into another suggestion's range of the document. So in this case nothing should happen.

Ok sounds good. I will now mark this as Resolved. Thanks for all your work!

GMikesell-WMF edited projects, added: Verified; removed: Editing QA.
GMikesell-WMF updated the task description. (Show Details)