Page MenuHomePhabricator

Add parameter to remove header and footer
Closed, ResolvedPublic

Description

NOTE: To remove the header and footer, use plain=1 as the first parameter, e.g. {{#babel: plain=1 | sv-5 |de-4 | ... }}

Original task description:
So that babels can be embedded in broader userboxes tables of all sorts without being forced to use the new system for everything.

Event Timeline

bzimport raised the priority of this task from to Lowest.Nov 21 2014, 11:52 PM
bzimport set Reference to bz31309.
bzimport added a subscriber: Unknown Object (MLST).

As one who brought this up in a discussion at Meta ([[m:Talk:Babel extension#Header and footer]]), I vote for this enhancement. Were I to use the Babel box it would only be for the purpose of indicating which languages I understand: I would not want to include self-references to the Babel system on my user page, and I am sure there are other people who would feel the same way.

After few years since its opening, I'm coming back to this topic.

Is it possible to add a parameter to the extension that will allow to NOT show the header & footer?

Thanks

Is it possible to add a parameter to the extension that will allow to NOT show the header & footer?

No, or this bug would be closed.

Nemo, which is the technical costraint?

Nemo, which is the technical costraint?

Probably nothing.

So the answer to "Is possible to add [...]" is yes .-)

Now we just need someone to implement it :)

Change 179984 had a related patch set uploaded (by Ricordisamoa):
Allow removing header and footer from the #babel parser function

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

Patch-For-Review

Note that a lot of pages on major wikis use babelboxes as standalone elements. This enhancement is necessary if we really want the Babel extension to replace old templates. It's a backward compatibility issue

Note that a lot of pages on major wikis use babelboxes as standalone elements. This enhancement is necessary if we really want the Babel extension to replace old templates. It's a backward compatibility issue

I definitely agree, though I don't think my solution is particularly elegant. What about a '#babelplain' or '#plainbabel' parser function?

Once implemented the patch already submitted by Ricordisamoa, could be taken into consideration the use of a more friendly magic word.

However we should pass from the first step in any case. So, can someone review and put in production his patch?

I definitely agree, though I don't think my solution is particularly elegant. What about a '#babelplain' or '#plainbabel' parser function?

Do whatever is easier. I think your solution with a "plain=1" parameter is ok; perhaps just remove the "=1" ("plain" can't be a language code...)

perhaps just remove the "=1" ("plain" can't be a language code...)

I'm afraid that can't be done. The extension falls back to on-wiki templates if the language code is not recognized. A wiki could have a "User plain" template and its users should be able to embed it using {{#babel:plain}}.

I'm afraid that can't be done. The extension falls back to on-wiki templates if the language code is not recognized. A wiki could have a "User plain" template and its users should be able to embed it using {{#babel:plain}}.

There is no reasonable motivation to have a "User plain" template. If you want to be fussy, a wiki could also have "User plain=1" template :) To be 100% sure, you need something like "_plain"

There is no reasonable motivation to have a "User plain" template. If you want to be fussy, a wiki could also have "User plain=1" template :)

There may be no reason for a "User plain" template on Wikimedia wikis, but this extension is widely used and there is no way to disable the "plain" behavior so far.
"Template:User plain=1" is a valid title, but {{#babel:plain=1|xx-x}} doesn't work. It seems that the first argument is actually ignored whenever it contains an equal sign.

There may be no reason for a "User plain" template on Wikimedia wikis, but this extension is widely used and there is no way to disable the "plain" behavior so far.
"Template:User plain=1" is a valid title, but {{#babel:plain=1|xx-x}} doesn't work. It seems that the first argument is actually ignored whenever it contains an equal sign.

{{#babel:plain=1|foo}} will actually generate a babel box with the template {{foo|plain=1}}. Something like {{#babel:foo|#nofooter}} would probably be safe (if ugly) as # is invalid in page names.

In T33309#1482682, @Tgr wrote:

{{#babel:plain=1|foo}} will actually generate a babel box with the template {{foo|plain=1}}. Something like {{#babel:foo|#nofooter}} would probably be safe (if ugly) as # is invalid in page names.

If Template:User foo contains "{{{plain|}}}", {{#babel:plain=1|foo}} returns "" on latest master of MediaWiki+Babel.

It's probably configured differently from Wikimedia wikis, where it works just fine.

In T33309#1483047, @Tgr wrote:

It's probably configured differently from Wikimedia wikis, where it works just fine.

Not as first parameter. Neither {{#babel:1=tisza.gergo|Facebook}} nor {{#babel:wcode=s|wlang=hu|tech ambassador}} work as you expect.

Meta formerly had local custom css that allowed one to wrap the template call in a div using class="babel-plain", which had the desired effect. For some reason (css removed?/deprecated??/broken???) that local workaround no longer works as documented at https://meta.wikimedia.org/wiki/User_language.

I really have no clue why this very simple enhancement request has been so difficult to satisfy.

Change 179984 merged by jenkins-bot:
Allow removing header and footer from the #babel parser function

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

Finally :)

Yay!
Thanks to everybody who helped with this.

Quiddity set Security to None.

I've added details to mw/meta:
https://www.mediawiki.org/w/index.php?title=Extension:Babel&diff=prev&oldid=2083119
https://meta.wikimedia.org/w/index.php?title=User_language&diff=prev&oldid=15474952
and put a note in this task's description,
and an entry in next week's Tech/News (will be frozen for translation in ~24 hours) https://meta.wikimedia.org/wiki/Tech/News/2016/13
Please correct any errors, and make any further updates needed elsewhere!