Template talk:Expand section

Jump to navigation Jump to search

Template-protected edit request on 10 May 2021[edit]

Parts of this template are below the 85% recommendation of MOS:SMALL. I have made changes in the sandbox (diff) to fix the ones involving the text – the date in the default small mode is still below this, but I think that can be overlooked for now, since that is the case in all small versions of amboxes, and should probably be changed over there. Test cases for my changes are here: Template:Expand section/testcases. The same change was just made at Template talk:Empty section. — Goszei (talk) 18:56, 10 May 2021 (UTC) — Goszei (talk) 18:56, 10 May 2021 (UTC)

 Done * Pppery * it has begun... 20:32, 10 May 2021 (UTC)

Variable width[edit]

User:MSGJ: While trying to get the variable width to work here, I actually discovered something that could lead to another useful change: The variable width also works with the large message box. It obviously doesn't look good with the box centred, but it made me think: would it be good to have a version of the template which is left-aligned, variable-width, but not small? What do you think? Regards, DesertPipeline (talk) 12:31, 13 July 2021 (UTC)

I've temporarily set margin-left: 0px; in the sandbox, and it actually looks pretty good! Check out the last testcase on the testcases page to see how it looks. DesertPipeline (talk) 12:36, 13 July 2021 (UTC)

Also, where would the best place be to centralise all of this? As in the discussion about having a parameter for the small left-aligned variable width; having a parameter for the large left-aligned variable width; and anything else that I may have suggested but already forgotten. DesertPipeline (talk) 12:43, 13 July 2021 (UTC)

@DesertPipeline: I suggest Template talk:Ambox — Martin (MSGJ · talk) 21:02, 16 July 2021 (UTC)

How do I remove the left margin?[edit]

Discussion continues at Predefinição Discussão:Expandir seção on pt-wiki.

The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.

I want to remove the left margin in the Porutugese Wikipedia version of this template. In the source code, what makes the template touch the left border of the page? Thanks. --Bageense(disc.) 19:12, 5 August 2021 (UTC)

User:Bageense: How do you want it? The same as it looks now, but in the middle of the page? Or larger like most other amboxes? If neither, please let me know exactly how you want it to look, and I'll try to write the required changes for you. In the below example, "style = margin: auto;" is what controls the horizontal alignment of the box.
In middle of page; same appearance otherwise

Code

{{SAFESUBST:<noinclude />#invoke:Unsubst||date=__DATE__ |$B=
<!--{{Expand section}} begin-->{{Ambox
| name  = Expand section
| type  = content
| small = {{{small|left}}}
| style = margin: null;
| image = [[File:Wiki letter w cropped.svg|{{#ifeq:{{{small|}}}|no|44px|20px}}|alt=[icon]]]
| issue = This section '''needs expansion'''{{#if:{{{with|{{{for|{{{1|}}}}}}}}}
 |  with: {{{with|{{{for|{{{1}}}}}}}}}}}{{#ifeq:{{{punctuation|{{{period|}}}}}}|no||.}} You can help by [{{fullurl:{{FULLPAGENAME}}|action=edit&section={{{section|}}}}} adding to it].{{#if: {{{find|}}} | {{br}}{{find sources mainspace|{{{find|{{ARTICLENAME}} }}} | {{{find2|}}} }}|}}
| talk  = {{{talk|{{{discuss|{{{talksection|}}}}}}}}}
| all   = All articles to be expanded
| cat   = Articles to be expanded
| date  = {{{date|}}}
}}<!--{{Expand section}} end-->
}}<noinclude>
{{Documentation}}
<!-- Add categories and interwikis to the /doc subpage, not here! -->
</noinclude>

Appearance

Same appearance as other amboxes

(This only requires adding the template to a page and passing the parameter |small=no. However, because there is so little text, it looks strange.)

Code

{{Expand section|small=no}}

Appearance

Also, if you want the box to be centred but small, I would recommend making the width of the box fit the text – doing so is an idea that I have had for all small left-aligned amboxes, and I am currently trying to get consensus for that change. Regards, DesertPipeline (talk) 16:15, 18 October 2021 (UTC)
@DesertPipeline: Hello! What I want is neither of those options. I want to keep the small size, but remove the left margin altogether.

style = margin: auto is responsible for the margin? How do we make it null? I tried "0" and "null" instead of auto and it didn't work. --Bageense(disc.) 04:34, 19 October 2021 (UTC)
margin:none and margin:null are not valid declarations. For the margin property, valid values are a length; a percentage; or certain keywords - auto or inherit. none and null are not among them. Some browsers may interpret margin:none as equivalent to margin:0 but it should not be relied upon. --Redrose64 🌹 (talk) 08:21, 19 October 2021 (UTC)
User:Bageense: I'm not sure what you mean exactly; sorry. "Remov[ing] the left margin altogether", if I'm understanding correctly, isn't possible because with this type of code "margin" means "how far away from the edge a page element is". So with margin-left: 0; the element touches the left side of the page (usually – I'm simplifying here, because there are other pieces of code that might affect how this works). If you can explain what you mean by margin in this context, hopefully I'll be able to help. Sorry again for my confusion. Regards, DesertPipeline (talk) 15:23, 19 October 2021 (UTC)
@DesertPipeline: So with margin-left: 0; the element touches the left side of the page. Yes! That's precisely what I want. See the template again: it is touching the left side. In the corresponding template I created in the Portuguese wikipedia (link), it has that default space every normal-sized template has. Perhaps a percentage would work, like Redrose64 said. --Bageense(disc.) 17:01, 19 October 2021 (UTC)
User:Bageense: I understand what you mean now. Add | small = {{{small|left}}} to the template in the same way this one has it – or whatever the Portuguese equivalent of that is. Regards, DesertPipeline (talk) 18:30, 19 October 2021 (UTC)
User:Bageense: Is the problem resolved now? DesertPipeline (talk) 16:13, 25 October 2021 (UTC)

@DesertPipeline: Oh, hi! Before starting this discussion, I think I already tried adding the small parameter in the pt.wiki template. I didn't work, but anyway, the cause of the problem is there, not here. To be honest, I don't remember why I decided to start the discussion here and not there. Because it seems clear that the problem is actually there... --Bageense(disc.) 16:28, 25 October 2021 (UTC)

User:Bageense: I see. I hope that you can get the problem resolved. One possible cause could be that they don't have the CSS code on that Wikipedia for small left-aligned message boxes; if it's not that, then I'm not sure what it could be. Regards, DesertPipeline (talk) 16:32, 25 October 2021 (UTC)
@DesertPipeline: they do. I've been fiddling with this on pt-wiki in my common.css, to see if I could help, and independently noticed mbox-small-left as well. Defaults for these classes are:
  • .mbox-small{clear:right;float:right;margin:4px 0 4px 1em;box-sizing:border-box;width:238px;font-size:88%;line-height:1.25em}
  • .mbox-small-left{margin:4px 1em 4px 0;box-sizing:border-box;overflow:hidden;width:238px;border-collapse:collapse;font-size:88%;line-height:1.25em}
Tried tweaking it before I saw your comment (as well as trying some other approaches afterward) and then again just now after you mentioned it, but so far no joy. The rendered table containing the Expand section box has classes "plainlinks metadata ambox mbox-small-left ambox-content" (see prettified excerpt in my pt sandbox) and I've been fiddling with those in my pt-wiki common.css. I can style the text inside by modifying the table cell containing the text, by adjusting the td class mbox-text-span in my css, but that doesn't touch the container. Fiddling with the table classes hasn't worked so far, and I've gone as far as I can afford at this point. This ought to be resolvable in common.css—we just haven't hit the right class or selector combo yet. Maybe you can figure something out from here. The Expand template is here: pt:Predefinição:Expandir seção. Cheers, Mathglot (talk) 19:52, 25 October 2021 (UTC)
Actually, this entire discussion doesn't belong here, and should be moved to pt-wiki; @Bageense:, if you have no objection, I'll move it and leave a pointer to it. Mathglot (talk) 20:01, 25 October 2021 (UTC)
I have no objection. Honestly, I don't remember what I was thinking when I started the discussion here. I must have had a reason. By the way, thanks for your effort in helping me, Desert. --Bageense(disc.) 23:13, 25 October 2021 (UTC)
@DesertPipeline, one other thing: I did add the |small = {{{small|left}}} to the pt template. I seem to remember, though, that I had an issue with 'small' in some other template (here at en-wiki) before, and tracked down the surprising result that |small=no had precisely the same effect as |small=yes (or any other param value); in fact, it was only checking whether the param was present and had a value, but I think that happened somewhere up the line. Not sure if that's equally true in this case. You can see the module defaults around l. 41-43 of the module config, and it's tested in Module:Message_box at l. 168-172; the small box class is added at l. 187. Not quite sure how it all interacts with the |small= setting, but it's in there somewhere. Mathglot (talk) 22:26, 25 October 2021 (UTC)
The discussion above is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.