Template talk:Refsrc
Pages with messy citations
These pages have <ref>...</ref> tags without a template inbetween. Most are "messy" citations to the source code. More interesting are plain http:// references to the spoilers, wikipedia, or Google Groups. Maybe spoilers should link to [[Scrl-343.txt]], Wikipedia to [[wikipedia:article]], and RGRN to bilious.alt.org/rgrn. After all, Google Groups might disappear sometime. IMHO we should store the messages ids on the wiki now, and perhaps think up a plan for later.
Aklys, Aligned_priest, Alignment, Altar, Angband, Anger, Archeologist_(player_monster), Artifact_weapon, Athame, Barbarian, Barbarian_(player_monster), Black_light, Boulder, Bribe, Bugle, C-ration, Can_of_grease, Canine, Caveman, Caveman_(player_monster), Charging, Cloak_of_displacement, Closet, Cockatrice, Conduct, Conflict, Corpseless, Covetous, Demon, Dented_pot, Diet, Digging, Disintegration, Domestic_animal, Door, Double_Trouble, Double_damage, Dragon, Dragon_(SLASH'EM), Drain_for_gain, Drum_of_earthquake, Dunce_cap, Elfrist, Elven_broadsword, Elven_short_sword, Eucalyptus_leaf, Excalibur, Experience_level, Extended_command, Farming, Flint_stone, Floating_eye, Fort_Ludios, Fungus, Gauntlets_of_power, Giant, Glass, Gnome_(SLASH'EM), Goblin, Green_slime, Gypsy, Half_spell_damage, Healer_(player_monster), Hellfire, Helm_of_opposite_alignment, High_priest, Holy_Spear_of_Light, Invisible_item_(SLASH'EM), Invoke, Jabberwock, Jumping_boots, K-ration, Katana, Knight_(player_monster), Leather_armor, Leather_drum, Level_teleport, Loadstone, Lycanthropy, MS-DOS, Magic_resistance, Magicbane, Manes, Migo, Minetown, Mold_(SLASH'EM), Monk, Monk_(player_monster), Monster, Monsters_(by_size), Mood_ring, Moria, Naming_artifacts, NetHack_3.2.0, NetHack_3.2.1, NetHack_3.2.3, NetHack_3.3.0, NetHack_3.3.1, NetHack_3.4.0, NetHack_3.4.1, NetHack_3.4.2, NetHack_3.4.3, NetHack_units, Nickelpede, Non-teleport_level, Nymph, Offensive_item, Ogre_mage, Orcish_short_sword, Orcrist, Pacifist, Parrot, Perm, Pet, Phasing, Physical_size, Player_monster, Polymorph, Polymorph_trap, Potion_of_acid, Potion_of_blood, Potion_of_paralysis, Potion_of_polymorph, Prayer, Priest_(player_monster), Projectile, Quest, Ranger_(player_monster), Read, Religion, Riding, Ring_of_gain_dexterity, Ring_of_gain_intelligence, Ring_of_gain_wisdom, Ring_of_shock_resistance, Ring_of_sleeping, Rnl, Robe, Rock, Rogue_(player_monster), SLASH'EM_Artifacts, Samurai, Samurai_(player_monster), Scare, Scissors, Score, Scroll_origins, Shield, Shop, Short_sword, Silver_short_sword, Sink, Sling, Small_shield, Special_level_(SLASH'EM), Spellbook, Spellbook_of_drain_life, Stackable, Statue, Stealing_from_shops, Stormbringer, Studded_leather_armor, Talking_to_vampires, Telepathy, The_Magic_Mirror_of_Merlin, The_Mitre_of_Holiness, The_Sceptre_of_Might, The_Staff_of_Aesculapius, The_Sword_of_Balance, Throne, Tin_whistle, To-hit, Torch, Tourist_(player_monster), Towel, Trap, Trouble, UnNetHack, Unicorn_horn, Upgrading_objects, Valkyrie_(player_monster), Wallet_of_Perseus, Wand, Wand_of_create_horde, Wand_of_create_monster, Wand_of_digging, Wand_of_magic_missile, Wand_of_opening, Wand_of_secret_door_detection, Wand_of_striking, War_hammer, Weapon, Welcome_message, Whetstone, Wish, Wizard_(player_monster), Wizard_mode, Wizard_of_Yendor, Wizard_quest, Wraith, Yeenoghu, ^Z. --Tjr (talk) 16:44, 22 September 2012 (UTC)
Linking to /src
This needs to be removed due to some pages linking to the header files, which are not in /src. Mindless, for example. I don't know how this was set up before, but it wasn't necessary to specify the directory at all for vanilla 3.4.3 stuff. {{refsrc|foo.c|1234}} and {{refsrc|foo.h|1234}} both worked equally well. I think doing that again for 3.6.0 files would be the best, but if that isn't an option/feasible or whatever, it at least needs some way of linking to the header files, not just the source files. -- Qazmlpok (talk) 04:47, 6 January 2016 (UTC)
- Before it was going via some manually maintained redirects. Those redirects now have different targets (to 3.6.0 rather than 3.4.3; changing this back would apparently cause problems for many external tools that depend on nethackwiki), so all the non-src links were broken anyway (at the end of 2015). I was aware that this would be a problem but decided it was better to do a change that made things less broken and stopped them getting worse, than to leave things as-is and have people unbreak things in a way that would cause problems later on (most likely when we get a bot to fix references).
- If you specify a version explicitly (i.e. "version=NetHack 3.4.3" or "version=NetHack 3.6.0"), then you can (and must) give the src/ or include/ or whatever part within the first argument. That's a way to fix things that will work with both the old and the new version of the template, and doesn't lead to any confusion about which version the references are against. (That is, the automatic insertion of "src/" was only placed in an attempt to get some of the old, versionless links that were otherwise broken to work; I don't do it for any reference that includes a version. It won't have fixed all of them, and we should really be adding explicit versions to references anyway so that things don't break when 3.6.1 is released) Ais523 (talk)
And the original problem is now being fixed via a bot (thanks, User:DizzyBot!). "src/" isn't inserted automatically any more; rather we use redirects, which effectively form a list of filenames. Once the bot has finished its work, both src/ and non-src/ links will work fine. (There will be some redlinks while the bot is running.) Ais523 (talk) 07:48, 6 January 2016 (UTC)
- This is an issue again. The github links break if src or include aren't explicitly included in the refsrc. A good example is Giant - the eat.c link fails with a 404, the src/sounds.c link works. Is it possible to have a bot update all the existing references again? -- Qazmlpok (talk) 22:03, 8 April 2020 (UTC)
Citing variants
So, Ion's thrown together something for SporkHack, which doesn't deal with versions but is more than sufficient for current purposes. He did also note that "trying to modify the if-then-else flow of this thing overall is a nightmare, and there's only one vers of sporkhack we need anyway". How much of a nightmare are we talking exactly, and would there potentially be anyone who either knows A) how to wrangle said nightmare, or B) is capable of devising workaround besides the one Ion used for SporkHack (which, again, is probably going to be enough for the time being)? --Umbire the Phantom (talk) 20:56, 26 July 2025 (UTC)
- I'm curious about Ion's opinion on what part of it specifically is a nightmare, although I do understand that opinion. It was worse before I refactored it a couple of years ago, keeping as best as I could all the existing behavior. Looking at the history of the template shows people adding functionality over the years, which is probably how it became so complex. I think Template:Refsrc/link is not so bad; adding a new version just requires adding another case to the switch.
- The reason for code duplication in Template:Refsrc itself is that the
nameparameter requires{{#tag:ref}}to be used differently depending on whether it's blank or not, and I couldn't find a workaround that didn't require duplication. Moving the duplicated parts into Template:Refsrc/link greatly simplified the implementation. - I do think the
unnethackparameter (which apparently predates thenethackparameter) adds a bit of unnecessary complexity. If we use theversionparameter for variants like Ion did, that would be simpler than adding a parameter for each variant, which I think would cause the template code to become quite a mess and difficult to maintain. If we keep a sorted list of variants (and their versions) in the switch statement in Template:Refsrc/link, I think it would probably be maintainable even if the list gets very long. Cathartes (talk) 03:55, 27 July 2025 (UTC)