Rosetta Code:Village Pump/Task page subsections

From Rosetta Code
Task page subsections
This is a particular discussion thread among many which consider Rosetta Code.

Summary

Solving the problems caused by per-language subheaders on task pages

Discussion

Problem:

On many task pages, people have separated some language sections into multiple subsection - often for multiple alternative solutions or approaches to the problem.

That's great and all, but it causes two problems:

  1. Unstable links

    If you link to [[SomeTask#Simple_Solution]], and then someone adds another "Simple Solution" subsection for another language on the same page but higher up than the first, then your link will suddenly point to the wrong place (the section that it used to point at would now be referred to as #Simple_Solution_2, due to MediaWiki's consecutive numbering of id attributes).
  2. Less informative "Recent changes" page

    Some people like to watch the Special:RecentChanges page for edits to specific programming languages. That's possible because when the person who made the edit clicked the "Edit" link of the corresponding language header, the summary message will show something like:

     (→‎{{header|Perl}}: use more descriptive variable names)

    However, when they clicked the "Edit" link of a subsection, the summary will be something like:

     (→‎Recursive Solution: use more descriptive variable names)

    ...which doesn't say anything about which language the edit was for.

Possible Solution:

To fix those problems, I suggest the addition of a new template called section, and making this the officially recommended way to introduce language-specific subsections:

==== {{section|Perl|Simple Solution}} ====

...With the following features:

  • people would see the language name in edit summaries (that's a given)
  • the template would output its third argument, so readers of task pages won't even see a difference (that's easy)
  • the template would force the language name to appear in the subsection's link name (which is used in the table-of-contents), e.g. SomeTask#Perl__Simple_Solution instead of SomeTask#Simple_Solution (that's the part that requires further research)

Any MediaWiki experts out there who can comment on the feasibility of implementing the third feature (without breaking the first)?

Any other opinions/suggestions?

Cheers,
--Smls (talk) 12:08, 4 July 2014 (UTC)

I too had seen the problem of not knowing what had been edited from the RecentChanges page that I use all the time and have in some cases prefixed subheadings with 'Python:' which is similar to your solution above. --Paddy3118 (talk) 12:48, 4 July 2014 (UTC)
We have {{anchor}} which adds an anchor link and has a display text option. You could try that out in the Sandbox to see if it might work. You could make the section template add its arguments in the correct places to make it work the way you want. --Mwn3d (talk) 18:00, 23 July 2014 (UTC)