Edit preview doesn't let you preview cite.php footnotes.
Closed, ResolvedPublic

Description

At present, if a section or article being edited does not contain the <references /> tag, then footnotes will not show up in page preview. This means you have to commit the edit, then examine the new saved page and re-edit instead.

Enhancement request -- if the page being rendered for preview contains cite.php footnotes, AND there is no <references /> tag in the previewed text that will cause footnotes to be displayed, then the preview code adds a horizontal line followed by <references /> after the existing text, so that users can see their proposed footnotes too.

bzimport added a project: Cite.Via ConduitNov 21 2014, 9:14 PM
bzimport added a subscriber: Unknown Object (MLST).
bzimport set Reference to bz5984.
bzimport created this task.Via LegacyMay 16 2006, 3:22 PM
bzimport added a comment.Via ConduitMay 18 2006, 10:12 PM

titoxd.wikimedia wrote:

Would adding <references/> to [[MediaWiki:Edittools]] accomplish the same thing?

bzimport added a comment.Via ConduitMay 18 2006, 11:36 PM

contactbox wrote:

If the text to be rendered in preview is the whole
article, or certain sections, it might contain the
</references> tag already, in which case you don't
want to render it twice. So you have to check and
only add it if it won't be rendered as-is.

Example pathological cases to check for:

<nowiki><references /></nowiki>
<references /> tag included in a template
<ref> ... </ref> or <ref /> in a template

etc.

So you have to check in coding it, whether the
text as-is includes any renderable cite.php refs,
and whether in preview, the text will include a
rendered <references /> section if so.

bzimport added a comment.Via ConduitMay 18 2006, 11:49 PM

contactbox wrote:

Afterthought...

I don't mean you have to "trial render". Rather I
mean, you have to have a way to flag during
rendering, whether a <ref> was rendered and
whether a <references /> was rendered. Possibly an
elegant solution might be that the call to the
render engine has a parameter "
AutoAddReferencesSection", set to TRUE for preview
and FALSE elsewhere, that adds a terminal <
references> section if it is needed, before
returning the rendered text.

But as Im not a coder, that may be a very naive
approach. I don't know how helpful that is.

MZMcBride added a comment.Via ConduitOct 20 2008, 7:56 AM
  • Bug 5492 has been marked as a duplicate of this bug. ***
bzimport added a comment.Via ConduitAug 3 2009, 4:34 PM

rene.kijewski wrote:

I don't think using JavaScript is a proper solution.
Maybe it would be possible to give a preview in the “Templates used in this section”-section?

bzimport added a comment.Via ConduitAug 3 2009, 4:40 PM

svippy wrote:

JavaScript certainly do not seem like a solution to this.

Though, personally, I do not consider this a problem. While editing, you might just add the <references/> tag at the bottom of the section, then preview it, see if those cites are all right, and move on.

You may obviously run into problems when you are reusing cites from earlier (or later) in the article, which are not declared in this section and thus <references/> will not know what to do, except tell you that it does not exist.

This sounds like a revisit of the entire article for this purpose to fulfil itself, which sort of renders the whole feat of using section editing fruitless. I would call this a simple issue you that should just work around. There seems to be no perfect solution. Also, isn't this an issue with the Cite extension rather than with MediaWiki itself?

demon added a comment.Via ConduitAug 6 2010, 12:17 PM
  • Bug 24681 has been marked as a duplicate of this bug. ***
bzimport added a comment.Via ConduitAug 7 2010, 6:45 PM

RSYQFIOJGWZA wrote:

(In reply to comment #7)

Also, isn't this an issue with the Cite extension rather than with MediaWiki itself?

The "Component" is currently set to "Cite".

bzimport added a comment.Via ConduitAug 13 2010, 3:37 AM

RSYQFIOJGWZA wrote:

There are two more javascript solutions mentioned at http://en.wikipedia.org/wiki/MediaWiki_talk:Edittools#References as follows (with absolute URLs):
The userscript at user:js/ajaxPreview http://en.wikipedia.org/wiki/User:Js/ajaxPreview provides a <references /> preview when editing sections. Possibly the code there, or someone at its talkpage, could help here? HTH. -- Quiddity (talk) 21:16, 9 August 2010 (UTC)
If you really care about references, user:Anomie/ajaxpreview.js http://en.wikipedia.org/wiki/User:Anomie/ajaxpreview.js does much more, it even checks for named references from other sections. Of course, JavaScript solutions have nothing to do with Edittols. — AlexSm 22:03, 9 August 2010 (UTC)

bzimport added a comment.Via ConduitJan 7 2011, 2:15 PM

gfitzger wrote:

Seems to me a fairly simple way to solve this would be to include a "Preview Full Article" link, either for all previews or just section-edit previews.

bzimport added a comment.Via ConduitJan 7 2011, 5:03 PM

ayg wrote:

Adding extra links is a bad solution to practically any problem. It would be better to just output the references automatically in section edits if there otherwise aren't any.

bzimport added a comment.Via ConduitFeb 12 2011, 6:36 PM

RSYQFIOJGWZA wrote:

(In reply to comment #12)

It would be
better to just output the references automatically in section edits if there
otherwise aren't any.

Yes, it would. Better still would be to:

  1. not limit that automatic output to section edits, but instead automatically *output* a references section (if there are ref tags but no references section) for the whole page or section (while displaying an existing page or section, to cover up the problem with existing pages) - we already have detection logic for this in the parser;
  2. and automatically *add* a references section (if there are ref tags but no references section) for the whole page to the wikitext (while editing, to fix the problem with existing pages).

An ambitious bot, set of bots, or database correction could automatically *add* a references section (if there are ref tags but no references section) for the whole page to the wikitext for every page in every project of every organization that uses this extension to fix the problem with existing pages, given approval by the developers of those projects.

Svick added a comment.Via ConduitFeb 12 2011, 9:21 PM

(In reply to comment #13)

  1. and automatically *add* a references section (if there are ref tags but no references section) for the whole page to the wikitext (while editing, to fix the problem with existing pages).

How exactly would that be done? What name would that section have? Where would that section go? What about references with group parameter?

On enwiki, {{references}} is usually used instead of <references />, the section name is either “Notes” or “References” and the section goes before the External links section.

I don't think logic should be implemented in MediaWiki, especially since consensus about those things can change and other wikis have other customs. And according to the text at [[Category:Pages with missing references list]], AWB already fixes this and at least enwiki has a bot that fixes those errors.

brion added a comment.Via ConduitMay 6 2011, 9:16 PM
  • Bug 28849 has been marked as a duplicate of this bug. ***
bzimport added a comment.Via ConduitDec 22 2011, 3:31 AM

fredgandt wrote:

Comment in general support for this functionality. For reference (no pun intended), a discussion/proposal on en:WP is here --> [[Wikipedia:Village_pump_(proposals)#Reflist_should_be_shown_when_previewing_a_section_edit]] (first comment for me on Bugzilla and no preview, please excuse if messy).

bzimport added a comment.Via ConduitDec 15 2012, 10:16 PM

s.vanslyck wrote:

When editing a section the footnote text never appears, at least not if the {{references}} or <references /> is not within that section. Suggest this bug be restated as

"Enhancement request -- If the page OR SECTION being rendered for preview contains cite or php footnotes, then the preview code should add a
horizontal line followed by <references /> after the existing text, so that
users can see their proposed footnotes and examine potential errors without having to commit the edit."

Theopolisme added a comment.Via ConduitApr 13 2013, 1:16 AM

This was brought up again at [[Wikipedia:Village_pump_(proposals)#Auto_reflist_when_previewing_whilst_section_editing]], FWIW.

SamB added a comment.Via ConduitFeb 15 2014, 6:11 PM

(In reply to Steve from comment #17)

When editing a section the footnote text never appears, at least not if the
{{references}} or <references /> is not within that section. Suggest this
bug be restated as

"Enhancement request -- If the page OR SECTION being rendered for preview
contains cite or php footnotes, then the preview code should add a
horizontal line followed by <references /> after the existing text, so that
users can see their proposed footnotes and examine potential errors without
having to commit the edit."

I think it would probably sound better if you drop the "page" part.

Also, I don't think you can modify the Description in Bugzilla, only the Summary, so you'd need something much snappier, like "Section edit preview doesn't show cite.php footnotes". (https://bugzilla.wikimedia.org/docs/en/html/bug_page.html doesn't even mention the *existence* of the Description.)

SamB added a comment.Via ConduitFeb 15 2014, 7:18 PM

Also, note that I find this quite annoying, too, and I'd be perfectly content if only the refs actually present in the section are actually included. If it's not in the section I'm editing, I can't possibly screw the reference itself up; the worst that could happen is that I do <ref name=... /> with the wrong name.

Technical13 added a comment.Via ConduitMar 1 2014, 9:02 PM

Can't a collapsed by default section at the bottom of an edit page be added that shows all of the references for the section being edited? https://en.wikipedia.org/wiki/Wikipedia:Village_pump_%28idea_lab%29#Section_editing_reflinks_idea is why I'm bumping this thread. I would think that if whole page references are really wanted, that could also be accomplished as well, and I can think of a detailed output method that I think would work great (although I could see others as disagreeing with me).

gerritbot added a comment.Via ConduitApr 27 2014, 1:48 AM

Change 129932 had a related patch set uploaded by Gerrit Patch Uploader:
Add reference list to section preview if missing

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

gerritbot added a comment.Via ConduitJul 3 2014, 7:33 PM

Change 129932 abandoned by Legoktm:
Add reference list to section preview if missing

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

bzimport added a comment.Via ConduitJul 8 2014, 2:42 PM

wp.makyen wrote:

The abandonment of https://gerrit.wikimedia.org/r/129932 without explanation implies that the fix for https://bugzilla.wikimedia.org/show_bug.cgi?id=66860 solves this issue. Based on testing, the fix for that bug does not show references in section previews.

I can understand that [https://gerrit.wikimedia.org/r/129932 129932] might be incompatible with [https://gerrit.wikimedia.org/r/#/c/141583/ 141583]. However, if that is the reason for abandonment, then please say so. It is also unclear to me that abandonment would be the appropriate course of action if the issue was incompatibility with [https://gerrit.wikimedia.org/r/#/c/141583/ 141583]. In my opinion, the more appropriate course of action would have been to indicate the incompatibility and make additional updates to [https://gerrit.wikimedia.org/r/129932 129932].

Because of the lack of explanation, I am just guessing here as to the reason for the request to abandon those changes. However, at least to me the request implies that [https://gerrit.wikimedia.org/r/129932 129932] is being abandoned because [https://gerrit.wikimedia.org/r/#/c/141583/ 141583] fixes this issue when it does not.

Gadget850 added a comment.Via ConduitSep 25 2014, 5:51 PM

Since the patch is abandoned, I am changing the status to NEW.

He7d3r awarded a token.Via WebNov 24 2014, 12:03 PM
MusikAnimal added a subscriber: MusikAnimal.Via WebFeb 18 2015, 8:36 PM
MGChecker added a subscriber: MGChecker.Via WebMay 20 2015, 4:15 PM
gerritbot added a subscriber: gerritbot.Via ConduitJun 6 2015, 1:05 PM

Change 129932 restored by TheDJ:
Add reference list to section preview if missing

Reason:
let's bring this back

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

gerritbot added a comment.Via ConduitJun 6 2015, 1:06 PM

Change 129932 had a related patch set uploaded (by TheDJ):
Add reference list to section preview if missing

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

gerritbot added a project: Patch-For-Review.Via ConduitJun 6 2015, 1:06 PM
TheDJ added a subscriber: TheDJ.Via WebJun 6 2015, 1:06 PM

I've updated this patch a bit. Anyone wanna try it out ?

fbstj edited the task description. (Show Details)Via WebJun 8 2015, 7:54 AM
fbstj set Security to None.
Cenarium added a subscriber: Cenarium.Via WebSat, Jan 16, 9:01 PM

I've updated this patch a bit. Anyone wanna try it out ?

I've given it a shot.

Restricted Application added subscribers: Luke081515, Aklapper. · View Herald TranscriptVia HeraldSat, Jan 16, 9:01 PM
TheDJ added a comment.Via WebSun, Jan 17, 4:49 PM

@Cenarium looks better already I think. The only thing is that you will still have errors for groups though.. And if we were to meddle there, i'm not really sure if that would break caching.

MGChecker added a comment.Via WebSun, Jan 17, 5:54 PM

Does the Patch also work if a ref isn't defined (with name=) in the section you see in preview, but anywhere else in the article, for example in an other section or within <references</references>?

gerritbot added a comment.Via ConduitWed, Jan 20, 5:58 AM

Change 129932 merged by jenkins-bot:
Add reference list to section preview if missing

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

tstarling added a subscriber: tstarling.Via WebWed, Jan 20, 6:28 AM

Does the Patch also work if a ref isn't defined (with name=) in the section you see in preview, but anywhere else in the article, for example in an other section or within <references</references>?

If an undefined named reference appears in the previewed section, an explanatory warning is shown in the generated references "<ref> tag with name $1 cannot be previewed because it is defined outside the current section or not defined at all".

matmarex closed this task as "Resolved".Via WebWed, Jan 20, 3:34 PM
matmarex edited subscribers, added: matmarex; removed: wikibugs-l-list.
matmarex edited projects, added user-notice; removed Patch-For-Review.
MGChecker added a comment.Via WebWed, Jan 20, 7:29 PM

I don't think this bug is resolved completely. Yes, the basic functionality works well and as expected (thank you really muich for that!), but the behaivor if the reference is defined outside the section edited is quite disappointing. (this basically are two cases:

  1. defined inside <references></references>
  2. defined anywhere else outside the section that is edited

Is there a simple possibility to fix the issue to provide the full functionality?

TheDJ added a comment.Via WebWed, Jan 20, 8:41 PM

@MGChecker no not a simple possibility. You cannot know what is inside 'the rest of the page', without parsing the whole page. And after you parsed the whole page, you wouldn't know where to 'cut' the page again to give only the fragment back to the user. This is one of the reasons why VE doesn't do 'section editing' in the same way as wikitext does section editing.

MGChecker added a comment.Via WebWed, Jan 20, 9:14 PM

I'm not a coder, but I think it could work if MediaWiki tries to find the necessary definitions in the saved page (with some background proceess, so you don't have to cut later) and load the Definitions in the preview. But I wouldn't be surprised if this isn't so trivial as I think.

Restricted Application added a project: TCB-Team. · View Herald TranscriptVia HeraldThu, Jan 21, 12:15 PM
Tobi_WMDE_SW moved this task to Done on the German-Community-Wishlist workboard.Via WebThu, Jan 21, 12:15 PM
Johan moved this task to In current Tech/News draft on the user-notice workboard.Via WebThu, Jan 21, 2:40 PM
MGChecker moved this task to Incoming on the German-Community-Wishlist workboard.Via WebThu, Jan 21, 3:20 PM
Meno25 removed a subscriber: Meno25.Via WebSat, Jan 23, 9:45 AM
Elitre awarded a token.Via WebSat, Jan 23, 10:58 AM
Cenarium added a comment.Via WebMon, Jan 25, 6:38 PM

I'm not a coder, but I think it could work if MediaWiki tries to find the necessary definitions in the saved page (with some background proceess, so you don't have to cut later) and load the Definitions in the preview. But I wouldn't be surprised if this isn't so trivial as I think.

Inspired by Tim Starling's suggestion in T124379, and by T123290, I've been thinking about storing the references in wikitext form in page_props, so they can be retrieved in section preview. But on some pages, these references amount to more than 64KB of wikitext, too much for page_props...

TheDJ added a comment.EditedVia WebTue, Jan 26, 10:00 PM

@Cenarium, I think such an approach would be a nice general solution, but I don't think page_props is particularly suited for this purpose. Perhaps a memcached backed cache + restbase api in front of it ?

And even then, in the context of section editing, how would you deal with the problem of synchronizing the pre and post edited version of it ?

TheDJ added a comment.Via WebTue, Jan 26, 10:21 PM

I've split any remaining functionality requests into: T124840: Section edit preview doesn't let you preview references defined outside the section being previewed

The German-Community-Wishlist and TCB-Team can decide if they want to pull that ticket into the purview of their projects.

Tobi_WMDE_SW moved this task to Done on the German-Community-Wishlist workboard.Via WebWed, Jan 27, 10:47 AM
Tobi_WMDE_SW moved this task to Done on the TCB-Team workboard.
Johan moved this task to Recently announced in Tech/News on the user-notice workboard.Via WebThu, Jan 28, 9:45 AM
Stevietheman added a subscriber: Stevietheman.Via WebFri, Jan 29, 12:41 PM
Cenarium claimed this task.Via WebSun, Jan 31, 10:08 PM
Johan moved this task to Archive on the user-notice workboard.Via WebWed, Feb 3, 1:21 PM
TheDJ added a comment.Via WebMon, Feb 8, 10:22 PM

To all who had (and are still having) part in fixing these problems, there have already been several thank you notes on my talk page for the developers who worked on this:
https://en.wikipedia.org/wiki/User_talk:TheDJ#Reference_Preview

Add Comment