Topic on Project:Support desk

Do you recognize any code problem with this Cite-only named references template?

30
182.232.3.127 (talkcontribs)

The following template was suggested by a community member of Hebrew Wikipedia which I understand to be an expert in Wiki templates development.

Its purpose is to allow people to create, RTL (Hebrew), unnamed, or named, footnotes, by a template call (the data is pushed into a references / tag).

<includeonly>{{#תנאי:{{{שם|}}}
|  <!-- הערת שוליים בלי שם -->
  {{#tag:ref
    | 1 = {{{תוכן|}}}
  }}
|  <!-- הערת שוליים עם שם -->
  <includeonly>{{#tag:ref
    | 1 = {{{תוכן|}}}
    | name = {{{שם|}}}
  }}
}}  <!-- סגירת ה #תנאי --></includeonly><noinclude>
[[קטגוריה:תבניות]]
</noinclude>

תנאי means "condition". I have tested that template with this call:

הערה|תוכן|שם="שם"

But didn't get any footnotes in a references / tag.

Do you recognize any code problem with this Cite-only named references template?

182.232.3.127 (talkcontribs)

By the way, here is a testing webpage if you want to try to debug at your own RTL (Hebrew) MediaWiki 1.34.0:

==תבנית הערה ללא שיום==
* קריאה בלי שם (ראשונה){{הערה|בדיקה ראשונה}}
* קריאה בלי שם (שנייה){{הערה|בדיקה שנייה}}

==תבנית הערה עם שיום באנגלית==

===ללא גרשיים בשם===
* קריאה בלי שם{{הערה|בדיקה ראשונה}}
* קריאה עם שם{{הערה|בדיקה שנייה|name=שם}}
* קריאה כפי שם{{הערה|name=שם}}

===עם גרשיים בשם===
* קריאה בלי שם{{הערה|בדיקה ראשונה}}
* קריאה עם שם{{הערה|בדיקה שנייה|name="שם"}}
* קריאה כפי שם{{הערה|name="שם"}}

==תבנית הערה עם שיום בעברית==

===ללא גרשיים בשם===
* קריאה בלי שם{{הערה|בדיקה ראשונה}}
* קריאה עם שם{{הערה|בדיקה שנייה|שם=שם}}
* קריאה כפי שם{{הערה|שם=שם}}

===עם גרשיים בשם===
* קריאה בלי שם{{הערה|בדיקה}}
* קריאה עם שם{{הערה|בדיקה|שם="שם"}}
* קריאה כפי שם{{הערה|שם="שם"}}

==הערות שוליים==
<references />

@Ciencia Al Poder perhaps you can help by tagging an RTL expert of this community?

This post was hidden by Pppery (history)
182.232.3.127 (talkcontribs)

@Amire80 please share with us an helping comment or at least tag someone who could if you cannot at the moment,

182.232.3.127 (talkcontribs)

Also, the call I used was:

{[הערה|תוכן|שם="שם"}}

Not:

הערה|תוכן|שם="שם"

@Bawolff

Amire80 (talkcontribs)

The immediate thing I can think of: Do you have ParserFunctions and Cite extensions installed?

182.232.3.127 (talkcontribs)

@Amire80 I have both extensions installed and loaded at LocalSettings.php via:

wfLoadExtension( 'Cite' );

wfLoadExtension( 'ParserFunctions' );

I use them "as is" (no special configurations).

Amire80 (talkcontribs)

Two more questions:

If you use just <ref>שלום</ref>, not as a template, does it appear as expected?

Is Hebrew defined as the content language of your wiki ($wgLanguageCode)?

182.232.3.127 (talkcontribs)

@Amire80

About question one: Yes; for example, this works fine when I execute the creation of a MediaWiki webpage:

* בדיקה פשוטה ראשונה<ref>בדיקת תגית רף פשוטה בלי שם</ref>
* בדיקה פשוטה שנייה<ref name="my_new_name">בדיקת תגית רף פשוטה עם שם</ref>
* בדיקה פשוטה שלישית<ref name="my_new_name"></ref>

  • בדיקה פשוטה ראשונה[1]
  • בדיקה פשוטה שנייה[2]
  • בדיקה פשוטה שלישית[2]

About question two: Yes; Hebrew is the main content language of my 1.34.0 (principally all-core) MediaWiki website.

  1. בדיקת תגית רף פשוטה בלי שם
  2. 1 2 בדיקת תגית רף פשוטה עם שם
Amire80 (talkcontribs)

Hmm, I'm not sure then... Have you seen asked @ערן or @IKhitron?

I don't think that RTL is the problem. There must be some bug with the usage of parser functions or template parameters, but I cannot see it myself. Perhaps I'd see it if I could log in myself to the wiki.

IKhitron (talkcontribs)

From my first sight, I can see two opening includeonly and only one closing.

182.232.3.127 (talkcontribs)

I did ask Ikhitron.

Well, am,

Even if I totally remove the includeonly and noninclude tags and the category, sorted, clickable footnote numbers do seem to be created but their content is basically only 1 = so I get this output (FYI dear @IKhitron):

הערות שוליים[עריכה]

  1. ^ לקפוץ מעלה אל:1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 1 =
  2. ^ 1 =
  3. ^ 1 =
  4. ^ 1 =
  5. ^ 1 =
182.232.3.127 (talkcontribs)

@AhmadF.Cheema I invite you to try to translate the template to your own mother tongue (Farsi? Urdu? I recall I thought it's Arabic but was wrong) and perhaps come with your own version, for the sake of all future RTL MediaWiki users who don't want Lua/Scribunto for footnotes.

182.232.3.127 (talkcontribs)

@קיפודנחש you might want to further contribute here (instead only at Hebrew Wikipedia) for the production of a Lua-free/Scribunto-free RTL supporting template for as much people as possible and not just for Hebrew-MediaWiki users.

קיפודנחש (talkcontribs)

your template and the template usage in the examples above do not match.

the template expects a parameter named תוכן' while the usage just use unnamed parameter #1.

IOW, instead of

==תבנית הערה ללא שיום==
* קריאה בלי שם (ראשונה){{הערה|בדיקה ראשונה}}
* קריאה בלי שם (שנייה){{הערה|בדיקה שנייה}}

==תבנית הערה עם שיום באנגלית==

===ללא גרשיים בשם===
* קריאה בלי שם{{הערה|בדיקה ראשונה}}
* קריאה עם שם{{הערה|בדיקה שנייה|name=שם}}
* קריאה כפי שם{{הערה|name=שם}}

===עם גרשיים בשם===
* קריאה בלי שם{{הערה|בדיקה ראשונה}}
* קריאה עם שם{{הערה|בדיקה שנייה|name="שם"}}
* קריאה כפי שם{{הערה|name="שם"}}

==תבנית הערה עם שיום בעברית==

===ללא גרשיים בשם===
* קריאה בלי שם{{הערה|בדיקה ראשונה}}
* קריאה עם שם{{הערה|בדיקה שנייה|שם=שם}}
* קריאה כפי שם{{הערה|שם=שם}}

===עם גרשיים בשם===
* קריאה בלי שם{{הערה|בדיקה}}
* קריאה עם שם{{הערה|בדיקה|שם="שם"}}
* קריאה כפי שם{{הערה|שם="שם"}}

==הערות שוליים==
<references />

you want

==תבנית הערה ללא שיום==
* קריאה בלי שם (ראשונה){{הערה|תוכן = בדיקה ראשונה}}
* קריאה בלי שם (שנייה){{הערה|תוכן = בדיקה שנייה}}

==תבנית הערה עם שיום באנגלית==

===ללא גרשיים בשם===
* קריאה בלי שם{{הערה|תוכן = בדיקה ראשונה}}
* קריאה עם שם{{הערה|תוכן = בדיקה שנייה|שם = שם ההערה}}
* קריאה כפי שם{{הערה|שם = שם ההערה}}

===עם גרשיים בשם===
* קריאה בלי שם{{הערה|תוכן = בדיקה ראשונה}}
* קריאה עם שם{{הערה|תוכן = בדיקה שנייה|שם = הערה שנייה}}
* קריאה כפי שם{{הערה|שם = הערה שנייה}}

==תבנית הערה עם שיום בעברית==

===ללא גרשיים בשם===
* קריאה בלי שם{{הערה|תוכן = בדיקה ראשונה}}
* קריאה עם שם{{הערה|תוכן = בדיקה שנייה|שם=שם שלישי}}
* קריאה כפי שם{{הערה|שם=שם שלישי}}

===עם גרשיים בשם===
* קריאה בלי שם{{הערה|תוכן = בדיקה}}
* קריאה עם שם{{הערה|תוכן = בדיקה|שם="שם רביעי"}}
* קריאה כפי שם{{הערה|שם="שם רביעי"}}

==הערות שוליים==
<references />

i did not test my snippet, but in principle it's correct, modulo typos, while "your" snippet can't work - you pass unnamed parameters, while the template code expects named parameters.

peace.

190.11.78.146 (talkcontribs)

que es esto? necesito hablar con alguien, que no entiendo nada, tampoco quiero que vean mi ip y exijo que me den informacion rapida y eficaz

49.230.98.142 (talkcontribs)

@קיפודנחש

But what if a user doesn't want to write תוכן = תוכן each time --- must that user than use Lua/Scribunto?

peace,

182.232.163.254 (talkcontribs)

To clarify: Say the user only wants

* קריאה בלי שם{{הערה|בדיקה}}
* קריאה עם שם{{הערה|בדיקה|שם="שם רביעי"}}
* קריאה כפי שם{{הערה|שם="שם רביעי"}}

Such as in Hebrew Wikipedia where no תוכן = is used for a footnote's inner content and quote marks does indeed get used.

קיפודנחש (talkcontribs)

i started writing a long and detailed answer, but it's like falling into the rabbit hole.

i'll tell you what i should have probably told you from the start: hewiki did not _always_ use lua. i tried to explain why it does now - it's done this way to save the users the need to add 1= in front of the content, in cases where the content itself contains =.

assuming this is no concern, my advice is to dig a bit in the history of the template on hewiki, find some version before lua, and use it. practically "by definition" this is what you want - a behavior as identical as possible to hewiki - you lose this small advantage of not having to worry about = in the cite content (this character tends to appear in URLs, which tend to appear in references, so the issue is not completely esoteric.

using a named parameter, תוכן= in my illustration, solve this problem in the standard/canonic way, without using scribunto, simple by using a named parameter. if you prefer hewiki compatibility, the best advice i can give you is to use hewiki template, and since you rather not depend on scribuntu, pick the latest historical version before scribuntu got involved, so this version (page was moved, soit's not exactly same name now, but this is it - at the time it was the template itself).

peace

182.232.163.254 (talkcontribs)

@קיפודנחש thanks; to prevent rabbit holes:

  1. I don't copy anything from Hebrew Wikipedia (not anything I didn't wrote myself at least and if so I recreate the footnotes) and I assume that no other user who seeks a similar solution would copy anything from either Hebrew Wikipedia or any other RTL WIkipedia.
  2. I understood that using 1= or תוכן = (or Lua/Scribunto) in case a footnote's content includes = , is not necessarily the only way to go and instead one could {{=}} template call which its template includes only = were that call is used inside footnote template calls which includes = signs (say in URLs), or at least thus I understood from the Stackoverflow topic "Passing an equal sign ('=') to a parameter in a MediaWiki template".
  3. At Hebrew Wikipedia's "תבנית:הערה" page I found a very short-lived history which starts with a reference to "תבנית:הערה/קוד".

In "תבנית:הערה/קוד" I found only first two versions by @Effib and @המתעתק and than I found @Yonidebest 's versions which include lots of advanced Wiki syntax (I wish I had a good book for that syntax near me because I most often find the documentation undidactic).

In my own MediaWiki website I currently have about 65 footnotes without תוכן = to which I would have to manually add תוכן = because I don't know to develop Wiki bots --- your opinion on how it is best to handle with this situation would be helpful to the masses.

182.232.32.46 (talkcontribs)

@קיפודנחש hello again; sadly, after caprice testing, I understand the template doesn't work; I have detailed everything for you below.

Template

{{#תנאי:{{{שם|}}}
|
  {{#tag:ref
    | 1 = {{{תוכן|}}}
  }}
|
  {{#tag:ref
    | 1 = {{{תוכן|}}}
    | name = {{{שם|}}}
  }}
}}

Template calls (nameless and named) are demonstrated in the tests below.

Tests

Testing page 1

בדיקה:הערה ללא שיום בעברית עם הקדמות לפרמטרים

* בדיקה ראשונה{{הערה|תוכן="בדיקה ראשונה"}}
* בדיקה שנייה{{הערה|תוכן="בדיקה שנייה"}}

==הערות שוליים==
{{הערות שוליים}}

Problems

  • Footnote numbers (links and list children) are all just [1] and 1, respectively.
  • Output (as much as I could copy):
1 = "בדיקה ראשונה" שגיאת ציטוט: תג <ref> בלתי־תקין; השם "" הוגדר מספר פעמים עם תוכן שונה

Testing page 2

בדיקה:הערה עם שיום בעברית עם הקדמות לפרמטרים

* קריאה בלי שם{{הערה|תוכן="בדיקה ראשונה"}}
* קריאה עם שם{{הערה|תוכן="בדיקה שנייה"|שם="שם"}}
* קריאה כפי שם{{הערה|שם="שם"}}

==הערות שוליים==
{{הערות שוליים}}

Problems

  • Footnote numbers aren't rendered correctly ([1], [2], [3] instead [1]. [2]. [2]).
  • In the list, appears a footnote number 3 although this one should not exist; rather, a reference to footnote number 2 should appear in superscript.

My humble request

Please opinion about what might cause the described problematic behavior in both cases.

קיפודנחש (talkcontribs)

i didn't analyze it too deeply, but the very first part is back assword.

you test for {{{שם}}}, and when exists, you don't use it, and when it does not exist, you do. it should look more like so:

{{#תנאי:{{{שם|}}}
|
  {{#tag:ref
    | 1 = {{{תוכן|}}}
    | name = {{{שם|}}}
  }}
|
  {{#tag:ref
    | 1 = {{{תוכן|}}}
  }}
}}


peace

49.230.3.185 (talkcontribs)

@קיפודנחש

I understand what went there now (man that syntax is sugary); thanks.

Now, in the context of clickable footnote numbers the code works fine.

But,

In the context of <ol> output there are the problems that everything starts with 1 = and is wrapped with double quote marks (") AND there is also an error in the second testing page:


Testing page 1

בדיקה:הערה ללא שיום בעברית עם הקדמות לפרמטרים

<ol> output:

  1. 1 = "בדיקה ראשונה"
  2. ^ 1 = "בדיקה שנייה"

Testing page 2

בדיקה:הערה עם שיום בעברית עם הקדמות לפרמטרים

<ol> output:

  1. 1 = "בדיקה ראשונה"
  2. ^ לקפוץ מעלה אל:2.0 2.1 1 = "בדיקה שנייה" שגיאת ציטוט: תג <ref>

In great plea, please kindly opinion what's going on there.

49.230.3.185 (talkcontribs)

The calls are the same as before

49.230.3.185 (talkcontribs)

Actually this is the full error I get in the second testing page:

שגיאת ציטוט: תג <ref> בלתי־תקין; השם "שם" הוגדר מספר פעמים עם תוכן שונה
49.230.3.185 (talkcontribs)

Okay, I have managed to remove the 1 = preliminaries by tags so to not include them in webpages where the template is called and the above error, disappeared.

But;

  • I still have double quotes around everything
  • I encounter the problem of [1].[2].[3] and 1,2,3 instead [1],[2] and 1,2 (in the second testing page) again
182.232.191.243 (talkcontribs)

For newcomers; I removed the 1 = preliminaries by <noinclude> tags (which have made them not to be included in all webpages besides the templates very webpage).

182.232.44.61 (talkcontribs)

@Bawolff in the comment above I tried to write

<noinclude>

Inside a single line code but got an empty computer code ( ) occurrence.

This might be a bug because I didn't have that problem with other HTML tags.

AhmadF.Cheema (talkcontribs)

Fixed that, those have to be included inside <nowiki></nowiki> tags.

182.232.166.132 (talkcontribs)
Reply to "Do you recognize any code problem with this Cite-only named references template?"