Module talk:Footnotes

This is an old revision of this page, as edited by Trappist the monk (talk | contribs) at 14:48, 28 September 2016 (Auto-formatting dashes in parameter "pages"). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Latest comment: 8 years ago by Trappist the monk in topic Auto-formatting dashes in parameter "pages"

This doesn't work properly in Template:Sfn

Please see Template talk:Sfn#Lua version is broken. --Redrose64 (talk) 22:43, 2 April 2013 (UTC)Reply

Broken parameter

Please see Template talk:Harvard citation no brackets#Broken parameter. Similar templates are probably similarly broken. Wtmitchell (talk) (earlier Boracay Bill) 07:13, 28 April 2013 (UTC)Reply

This should be fixed. Dragons flight (talk) 10:18, 28 April 2013 (UTC)Reply

More than six parameters

It would help if the code was more compatible with CS1. At the moment it does not handle more than four authors elegantly. See Module talk:Citation/CS1#CITEREF and harvnb and CITEREF and CS1. -- PBS (talk) 13:09, 21 December 2013 (UTC)Reply

Markup

The Lua CS1 templates strip markup, such as bold or italics, where this module does not. Thus if markup is used in {{sfn}} or variant, then the link and anchor will not match. --  Gadget850 talk 11:28, 6 March 2014 (UTC)Reply

Protected edit request on 27 June 2014

Module:Citation/CS1 runs mw.uri.anchorEncode() on options.id before generating the <span id="... line. For compatibility between generated id in that module and the #CITEREF generated here, I think this change needs to be applied on this module.

(Here is an example footnote which is not linked to it's citation and I think it's because of the above mentioned problem.) Dalba 07:38, 27 June 2014 (UTC)Reply

  Done Thanks for the fix! — Mr. Stradivarius ♪ talk ♪ 12:15, 27 June 2014 (UTC)Reply

Template:sfnp

{{sfnp}} could usefully be implemented within this module as well as {{sfn}}. As far as I can see, function f.sfnp( frame ) would simply duplicate function f.sfn( frame ) with the addition of:

args.bracket_year_left = "(";
args.bracket_year_right = ")";

An oddity at present is that |postscript=none works for {{sfn}} but not for {{sfnp}}. Peter coxhead (talk) 20:21, 15 December 2014 (UTC)Reply

It does in a sort of round-about way:
{{sfnp}} calls {{Harvard citation/core}} calls Module:Footnotes function harvard_core().
Is |postscript=none necessary for {{sfnp}}? The code seems to indicate that {{sfn}} uses '.' for a default of postscript character. If |postscript= is empty or omitted, then {{sfnp}} uses an empty string as the default postscript.
Trappist the monk (talk) 20:38, 15 December 2014 (UTC)Reply
Nope, {{sfnp|James|2004}} generates the following footnote.[1]
(After the tweak noted below, {{sfnp|Smith|2005|ps=none}} generates the following footnote.[2])

References

  1. ^ James (2004).
  2. ^ Smith (2005)
So as a CS2 user, I end up with {{sfnp|ps=|...}} but would prefer |ps=none for same reason as you (well, actually I'd prefer another template, and did once create one, but the consensus was to delete it).
Doing things in a "round-about way" is a sure recipe for software errors (at least that's what I used to teach in first-year software engineering). The complexity of the current code is shown by the fact that it isn't easy to work out what {{sfnp}} actually does. A separate function is clearer and easier to maintain. Or perhaps better still (because more modular), pass appropriate parameters to f.sfn(). Peter coxhead (talk) 21:13, 15 December 2014 (UTC)Reply
Right, it gets it's postscript from the template call to {{Harvard citation/core}}. Module:Footnotes tweaked and I tweaked your example.
You'll get no argument from me in support of round-about code. Every line must be maintained. I'll think about integrating {{sfnp}} in the module.
Trappist the monk (talk) 22:02, 15 December 2014 (UTC)Reply
Ok, tweaked {{sfnp/sandbox}} to pass the bracket defaults as |bracket_year_left=( and |bracket_year_right=) to f.sfn() in Module:Footnotes/sandbox where those parameters override the defaults normally used by {{sfn}}:
Some text using {{sfnp}}.[1]
Some text using {{sfnp/sandbox}}.[2]
Some text using {{sfnp/sandbox|ps=none}}.[3]

References

  1. ^ Smith (2005)
  2. ^ Smith & Jones (2005).
  3. ^ Smith, Jones & Babcock (2005)
Trappist the monk (talk) 13:08, 16 December 2014 (UTC)Reply
A much more elegant approach than the current version; hopefully soon to be deployed. Peter coxhead (talk) 18:56, 16 December 2014 (UTC)Reply
Done.
Trappist the monk (talk) 00:38, 17 December 2014 (UTC)Reply
Thanks! Peter coxhead (talk) 16:54, 17 December 2014 (UTC)Reply

Dashes and hyphens, oh my

A number of threads have shown up on WT:VPT (e.g. WP:VPT#Help in fixing a "cite error") and elsewhere regarding the change in MediaWiki to output an error where the same names are used in a reference but where the reference is defined differently.

It seems to me that a basic level of checking for that could be implemented in this module, either (namely) to treat (example) |p= and |pp= the same before outputting the reference for Template:sfn or to do some basic level of sanity checking e.g. where |p= uses a dash/hyphen (and should not) or where |pp= doesn't use one of the set: (,|-) (or similar).

Thoughts? --Izno (talk) 17:17, 14 November 2015 (UTC)Reply

Only that there's a need to be careful not to exclude electronic publications which increasingly have "page" numbers with non-numerical characters in them. Peter coxhead (talk) 17:26, 14 November 2015 (UTC)Reply
My suggestion would be only to look for certain punctuation. --Izno (talk) 17:40, 14 November 2015 (UTC)Reply
And then do what once the detector detects whatever it is set to detect?
This is difficult. |p=A-1 or |p=17-6 are legitimate page numbers.
Trappist the monk (talk) 18:10, 14 November 2015 (UTC)Reply
Precisely. Peter coxhead (talk) 22:05, 14 November 2015 (UTC)Reply

Auto-formatting dashes in parameter "pages"

Module:Citation/CS1 based templates automatically replace hyphens (-) with endashes (–) when hyphens are typed in the |pages= parameter. Is it possible to implement this feature into this module?
Αντιγόνη (talk) 07:24, 28 September 2016 (UTC)Reply

Yes, we can do that here if there is sufficient support for it. If we do add it, I would like to see us adopt some sort of mechanism that allows editors to override the auto-conversion. Elsewhere I suggested a couple of ways that this might be accomplished. Those proposals were not taken up.
Trappist the monk (talk) 10:40, 28 September 2016 (UTC)Reply
So what would happen with something like |pp=A-1–A-15? Entirely possible with electronic publications. Peter coxhead (talk) 14:15, 28 September 2016 (UTC)Reply
Which is why I suggested |pp=((A-1–A-15)) or |pp=A--1-A--15 as ways to tell the module to 'do it this way': pp. A-1–A-15.
Trappist the monk (talk) 14:48, 28 September 2016 (UTC)Reply