Template talk:PortalButton

Troubleshooting
I think I've fixed the narrow misbehaviour by wrapping the image syntax in a div with style clear:both. Now the text stays below the image in narrow widths.

Would you be able to take a look at the font-weight problem? I'm at a dead end on that. Cheers Cesde v a  (talk)


 * Ok I will see if I can fix the font-weight problem. JLJ001 (talk) 15:09, 23 May 2018 (UTC)
 * Well it now does bold or italics, default is none. This uses a conditional function to add ''' wiki-markup. JLJ001 (talk) 15:27, 23 May 2018 (UTC)
 * Thanks, that's amazing. Cesde v a  (talk) 16:34, 23 May 2018 (UTC)
 * I'm not versed in the slightest on #ifreq, but is that line of markup defined outside of the main div (below the noinclude tags) supposed to be there? Also where on Wikipedia can i learn about that type of markup? Cheers Cesde v a  (talk) 00:25, 25 May 2018 (UTC)
 * Indeed I seem to have left that there by accident (fixed now). The actual markup is explained in more detail at MW:Help:Extension:ParserFunctions and MW:Help:Magic words. JLJ001 (talk) 09:01, 25 May 2018 (UTC)
 * Thanks. Cesde v a  (talk) 19:46, 25 May 2018 (UTC)

Live testing
The template is being tested at Portal:Herbalism/RelatedArticles.


 * Issues:

- The templates, when in formation, have a slight affinity to the left margin of the page. Possibly a mediawiki trait.

- Mixing portrait dimensioned images with landscapes requires making adjustments, or just not using portrait images.


 * Notes:

Template generally performing well.

Would like to be able to center the inline-block, relative to the mediawiki skin.


 * Adding the  parameter will now center it, but also overrides the margin setting if used, and if used may also change other behavior since the element is declared as a block rather than as inline. JLJ001 (talk) 20:50, 25 May 2018 (UTC)
 * Cheers, yep, it's now centered but in a block. I was thinking...


 * center=yes opens div tag


 * center=end closes div tag

That way you could open the centering div in one pb template, and close the centering div in another. Every template in-between would be centered right? Or am I just bonkers? Cesde v a (talk) 21:27, 25 May 2018 (UTC)


 * While that is technically possible (and coded), I can't help but feeling some future editor with no knowledge of how this template works would find it a real pain to find why all their elements are mysteriously floating around. A better solution may be to use center immediately after, which can center numerous elements at once by putting the closing }} where you want it to close. However if desired,  will omit the closing  , and   will add an otherwise unnecessary   just before the template. JLJ001 (talk) 22:00, 25 May 2018 (UTC)

Thanks for the extra fun. I think you are probably right. As I was nodding off to sleep, another way to do it occurred to me:

   

Cesde v a (talk) 22:38, 25 May 2018 (UTC)

Sandbox testing
Observation: Removing the overflow:hidden attribute caused the template to adjust its rendered sizing slightly.

Action: Overflow values are now a parameter. Will probe this further.

Action/Observation: Removed the centering code and added 'left:%' and 'right:%' parameters. Set 'left' to 5%. Buttons sat in a regular inline-block formation without centering issues. In mobile-mode the buttons acted as expected.

I also removed clear:both from the div wrapping the image, but that likely had no effect, so will restore.

Action:
 * Will remove the 'right%' parameter as I think it may be obsolete.
 * Restore clear:both

Sorry I keep pinging you. I want to set 'left:5%' as default but I don't think that would be a good idea for individual buttons, and I don't want to interfere with the code you've already added. Do you think I should make a new derivative template called 'PortalMultiButton' (or similar) that focuses on using multiple buttons at once? Cesde v a (talk) 18:09, 26 May 2018 (UTC)


 * It could be an option to add a  parameter which activates it (and maybe other things specific to multi button use), but keeping it in the same template? JLJ001 (talk) 18:24, 26 May 2018 (UTC)


 * Ya i hadn't thought of that. Let's give that a go. I'll update the documentation with the latest developments. Cesde v a  (talk) 18:42, 26 May 2018 (UTC)

Lua
I've created Module:PortalButton for use with this template.

The first function is called 'yesparity'. It should check the value of the  parameter against lowercase "yes" or "y", and prevent it activating when people inevitably write 'no'.

I haven't tested the function yet and it may not work. My knowledge of Lua, or any programming, is very limited Cesde v a  (talk) 11:29, 30 May 2018 (UTC)


 * That is a good idea. JLJ001 (talk) 13:06, 30 May 2018 (UTC)

Documentation page Style
Is there a particular reason the documentation subpage is so marked-up? It makes it a bit difficult to add anything because I have to navigate the tangle of divs. &mdash; AfroThundr (u &middot; t &middot; c) 22:01, 2 June 2018 (UTC)
 * I didn't understand how other templates produced the standard doc page, so I just hashed out a quick sketch using some transitional markup. Just a temporary solution. Cesde v a  (talk) 23:18, 2 June 2018 (UTC)