Module talk:CR: Difference between revisions

From MTG Wiki
Jump to navigation Jump to search
>Corveroth
m (Corveroth moved page Module talk:CR/doc to Module talk:CR: get this off the damned subpage)
>Jerodast
m (→‎Bug Reports: case correction to avoid redirect)
 
(46 intermediate revisions by 10 users not shown)
Line 1: Line 1:
== Prepare for Launch ==
'''Please use the module indirectly via [[Template:CR]].'''
I think the module is good enough that further work on the code is largely stalling on my part. Here are my goals for the implementation of the module:
Using the module directly is more likely to break in the future.
* Affect all pages currently using [[Template:Rules]], [[Template:Comprehensive Rules]], [[Template:CR]], and those explicitly listed on [[UserWiki:RuleUpdateBot]].
* Avoid directly using [[Module:CR]] in the article namespace.
* Implement invocation of [[Module:CR]] within [[Template:CR]].
:* Later editors should be able to utilize the template without worrying about changes to the underlying module or how the template generates the correct wikitext.
* Retire [[Template:Rules]] and [[Template:Comprehensive Rules]] entirely, either via deletion or redirect to [[Template:CR]] (currently, CR redirects to Comprehensive Rules).
* Accomplish all of this transparently from the visitor's perspective - no broken pages at any point during the process.
I'll be sleeping on it and get started tomorrow morning. [[User:Corveroth|Corveroth]] ([[User talk:Corveroth|talk]]) 04:25, 24 July 2015 (UTC)


== Intro ==
== Bug Reports ==
Going by my test page over here ([[User:Corveroth/TestPage2]]), this module seems to be a drop-in replacement for the old [[Template:CR]], and I intend to perform that replacement in the near future. If anyone has a suggestion for improving the module and lacks the capacity to code it, please, let me know! [[User:Corveroth|Corveroth]] ([[User talk:Corveroth|talk]]) 04:51, 15 July 2015 (UTC)
* '''lookup=Effects''' returns the heading "6. Spells, Abilities, and Effects" rather than rule 609, "Effects". Affected page: [[Effects]]
: Great, looks good! (you're missing the right parenthesis after the expansion-name, I think) --[[User:LegacymtgsalvationUser620|Hunter]] ([[User talk:LegacymtgsalvationUser620|talk]]) 05:24, 15 July 2015 (UTC)
* '''lookup=Prevention Effects''' extends to the next heading (same bug as above). Affected page: [[Prevention effect]]
:: Nope, the date is in nested parens, so there are two closing parens at the very end. [[User:Corveroth|Corveroth]] ([[User talk:Corveroth|talk]]) 05:29, 15 July 2015 (UTC)
::: Ah, yes :-) --[[User:LegacymtgsalvationUser620|Hunter]] ([[User talk:LegacymtgsalvationUser620|talk]]) 05:54, 15 July 2015 (UTC)
: I suppose, every page that still has linked text in the rules text should have its main text adjusted? --[[User:LegacymtgsalvationUser620|Hunter]] ([[User talk:LegacymtgsalvationUser620|talk]]) 05:24, 15 July 2015 (UTC)
:: In other words - we'd like rules topics within the transcluded rules text to be wikilinked? [[User:Corveroth|Corveroth]] ([[User talk:Corveroth|talk]]) 05:29, 15 July 2015 (UTC)
:: As an example, are you suggesting something like the following?
:::: '''112.12.''' An [[effect]] that sets an [[object]]’s [[characteristic]], or simply states a [[quality]] of that object, is different from an [[ability]] granted by an effect. When an object “gains” or “has” an ability, that ability can be removed by another effect. If an effect defines a characteristic of the object (“[[permanent|[permanent]]] is [characteristic value]”), it’s not granting an ability. (See [[rule 604.3]].) Similarly, if an effect states a quality of that object (“[[creature|[creature]]] can’t be [[blocked]],” for example), it’s neither granting an ability nor setting a characteristic. [[User:Corveroth|Corveroth]] ([[User talk:Corveroth|talk]]) 05:43, 15 July 2015 (UTC)
::: Not necessarily, I think it may get too messy. Just trying to get clear what kind of work will be involved --[[User:LegacymtgsalvationUser620|Hunter]] ([[User talk:LegacymtgsalvationUser620|talk]]) 05:53, 15 July 2015 (UTC)
:::: The work involved should be visiting each page that uses one of the older templates and swapping out the entire template block for a single #invoke. Yes, it's a reasonable amount of manual labor (assisted by "What links here" from each template), and I'm prepared to do all of it, because from now on, we'll only need to make roughly one edit per set, to this module, and everything will update across the site automatically. That's a goal I like and I want to do that. =)
:::: Also, I like the ''idea'' of linking at least the rule indices ("see also rule 604.3"), but that might require a properly dressed up mirror of the CR here? Not sure if that's a ''good'' idea. [[User:Corveroth|Corveroth]] ([[User talk:Corveroth|talk]]) 06:21, 15 July 2015 (UTC)
: Also, shouldn't Template:Comprehensive Rules and Template:Rules now be phased out? --[[User:LegacymtgsalvationUser620|Hunter]] ([[User talk:LegacymtgsalvationUser620|talk]]) 05:24, 15 July 2015 (UTC)
:: Seems reasonable. I'm also looking at the apparently stalled [[User:RuleUpdateBot]] for tips. [[User:Corveroth|Corveroth]] ([[User talk:Corveroth|talk]]) 05:29, 15 July 2015 (UTC)
Also, damnit, this is on the /doc page. Welp. [[User:Corveroth|Corveroth]] ([[User talk:Corveroth|talk]]) 05:30, 15 July 2015 (UTC)


== bug with only ==
== To-do list (coding changes to the module) ==
* Allow title-based lookups to be case independent. At the moment, '''lookup=Creatures''' works, but '''lookup=creatures''' does not.
* Build a list of common names for rules that are not titled as such in the CR, but which would be accepted by the module.
** For example, the module might allow '''<nowiki>{{CR|lookup=Legend Rule}}</nowiki>''', despite no title in the CR named "Legend Rule", and use an internal list of such faux-titles to equate that lookup with the correct index (in this case, at the moment, 704.5k).
* Look into a means of allowing lookups for the General titles without using indices. The TOC output appends the title of the section, but this doesn't currently work on input.
=== External rule references ("see rule...") ===
Have references to other rules ("see rule DDD.Da") link to the other rule, or provide a tooltip summary of it, for ease of understanding. For example, the [[Emperor]] rules are 809, but references 801, 804 and 104, and no easy way to navigate in the wiki to those pages. <small>—The preceding unsigned comment was added by [[User:MidnightLightning|MidnightLightning]] ([[User talk:MidnightLightning|talk]] • [[Special:Contributions/MidnightLightning|contribs]]){{#if:|&#32;{{{2}}}|}}.</small><!-- Template:Unsigned -->
: It's something I've thought about in the past. I don't think it can be as simple as linking to another page, because there's no guarantee such a page exists. Even if we built redirects for every numeric codepoint in the CR, that would be very heavy maintenance (and very silly in a lot of cases). Tooltips, though, are a maybe, via <code>CR.only</code>. I'll give others a chance to weigh in first, but I expect we can have this running in short order. --[[User:Corveroth|Corveroth]] ([[User talk:Corveroth|talk]]) 23:31, 6 September 2017 (UTC)


there is a bug with only,  only|107.8 it does show 107.8b but it should show 107.8 without sub sections.
== Visual styling requests ==
same for only|702 or only|702.1 shows 702.109b
''Feel free to use this heading to contribute and debate any suggestions or requests for alterations to the visual style of output from the module.''


also TOC|702 does show this: {{#invoke:CR|TOC|702}} but i want to have it look like this: [[Keywords#List]]
== 701.5 Counter ==
I just found this: I think on [[Keyword action#Rules]] the "701.5. Counter" part should link to [[Counter (keyword action)]] instead of [[Counter]]. --[[User:Psion1C|Psion1C]] ([[User talk:Psion1C|talk]]) 15:22, 26 September 2018 (UTC)
: Good point. I will see if I can dig through the code and find how these links are created. - [[User:Yanderesliver|Yandere Sliver]] [[File:H09 symbol.png|16px|link=User talk:Yanderesliver]] 23:27, 26 September 2018 (UTC)
:: The module just guesses that any line in the rules that's shorter than five words is actually a title, rather than meaningful rules text, and it attempts to turn that line into a link to an article of the same name. (This works out just fine on the article in question, because a self-referential link gets bolded instead.) There's not a really ''good'' way to code the module to identify the difference from context, aside from shoving a one-time exception into mostly unrelated code specifically for this.
:: However, I have an alternate proposal. In the CR, the subjects in question appear as: <code>121. Counters</code> (the markers), <code>"701.5. Counter"</code> (the keyword action). Should the article for the markers be pluralized, sacrificing some consistency with general wiki practices in exchange for consistency with the CR and within Module:CR? --[[User:Corveroth|Corveroth]] ([[User talk:Corveroth|talk]]) 00:22, 27 September 2018 (UTC)
::: I just noticed that [[counters]] links to [[counter (marker)]]. We could make counter the article for the keyword action and create an article named [[counter (disambiguation)]] for the disambiguation page. We did that in other cases as well so that would be consistent with our wiki practices.
::: This way the CR would actually always link to the proper page and we would not need to change much. - [[User:Yanderesliver|Yandere Sliver]] [[File:H09 symbol.png|16px|link=User talk:Yanderesliver]] 01:43, 27 September 2018 (UTC)
:::: I moved the respective pages. [[Counter]] is now about counterspells, [[Counters]] links to [[Counter (marker)]], and [[Counter (disambiguation)]] is the disambiguation page. The CR links are now looking always at the correct article. - [[User:Yanderesliver|Yandere Sliver]] [[File:H09 symbol.png|16px|link=User talk:Yanderesliver]] 17:35, 10 October 2018 (UTC)


--[[User:Hanmac|Hanmac]] ([[User talk:Hanmac|talk]]) 05:47, 15 July 2015 (UTC)
== Under consideration ==
: Good catches! Looks like ''only'' started picking out the last subrule within that index, I'll see what's up. As for the TOC problem, I'll think about the best way to handle that. [[User:Corveroth|Corveroth]] ([[User talk:Corveroth|talk]]) 06:07, 15 July 2015 (UTC)
* Linking key phrases within the transcluded text - key words like "trample" and rules titles like "end step".
: Okay, got the ''only'' bug fixed. As for the request for rule 702, how about something like '''{{#invoke|only|702|1}}''' ("get me only rule 702, with one extra level of subrules")? TOC is currently scanning the actual table of contents at the top of the CR, and I can't see at a glance any rule structured like 702, so I'm hesitant to make a single-case exception in TOC just for that. An "extra level" rule in ''only'' could at least, in theory, be used elsewhere. [[User:Corveroth|Corveroth]] ([[User talk:Corveroth|talk]]) 06:21, 15 July 2015 (UTC)
* Replacing {W}, {1}, {S}, etc with their symbols
:: Extra line rule implemented. [[User:Corveroth|Corveroth]] ([[User talk:Corveroth|talk]]) 00:16, 17 July 2015 (UTC)
** ''Why'': Looks pretty.
** ''Why not'': The official CR documents use the text representations of those symbols. I want both an honest quote and to reinforce that those representations are canonical.
* Adding a way to specify multiple rules that are printed in the same rulebox for use-cases like [[Untap#Untap_symbol]] --[[User:Hanmac|Hanmac]] ([[User talk:Hanmac|talk]]) 15:23, 5 August 2015 (UTC)
** Why should two separate rules occupy the same box, rather than be separate quotes? Is it simply due to the space taken by the extra title, padding, margin? [[User:Corveroth|Corveroth]] ([[User talk:Corveroth|talk]]) 18:42, 5 August 2015 (UTC)


== Text Replacement ==
== Mobile update ==
first i would like to have a way to add links into it like: [[Keywords#List]] ... imo a replacement might be to complicated and need to be done per hand (or better idea?)
At long long last, the rules modules are now readable on mobile. In the process, other things may have broken or look odd. Please keep an eye out for any issues, and check out the new hotness on your phone or tablet! --[[User:Corveroth|Corveroth]] ([[User talk:Corveroth|talk]]) 07:30, 14 January 2017 (UTC)


second i want to have {W/P} be replaced with {{W!}} and so on, that might be done with a dictionary replacement
== Pre-release content ==
--[[User:Hanmac|Hanmac]] ([[User talk:Hanmac|talk]]) 09:00, 15 July 2015 (UTC)
I'm open to ideas on how to handle, if at all, rules text for mechanics for which the CR has not yet been updated. I don't really want to lean on educated guesses from the community, but I wish there was something we could offer for the pre-release. --[[User:Corveroth|Corveroth]] ([[User talk:Corveroth|talk]]) 07:36, 14 January 2017 (UTC)
: Wikilinking title-like rules is definitely on the to-do list. For mana symbols, though, I'm hesitant. The idea had occurred to me, as well, and should be relatively simple to implement. However, even the image-capable versions of the Comp Rules (both docx and pdf) use text, rather than image, depictions of mana symbols. I'm inclined to leave the symbols in their text form so as not to alter the quotation, and to convey that those text forms are, in fact, canonical. [[User:Corveroth|Corveroth]] ([[User talk:Corveroth|talk]]) 00:17, 16 July 2015 (UTC)
:: Auto-wikilinked titles implemented, see [[User:Corveroth/TestPage2#702.2C_one_extra]]. Think that'll work for you? [[User:Corveroth|Corveroth]] ([[User talk:Corveroth|talk]]) 00:17, 17 July 2015 (UTC)


== Auto-linked titles ==
== Glossary Glitches==
I've updated the module to automatically wikilink anything that looks like a title, visible on the same test page as before ([[User:Corveroth/TestPage2]]). If you'd like to check or improve the logic for the autolinking, see the StylizeRule function. My biggest concern is the missed links in the final section. Are we satisfied with its performance on TOC and ready to manually redirect or create those pages? Or do we need more work done within the module to correctly link plural rules titles to singular page names? (this isn't quite a trivial task, e.g. by cutting off the trailing "s" on the link, due to rules like "The Magic Golden Rules", which should not direct to [[The magic golden rule]].) [[User:Corveroth|Corveroth]] ([[User talk:Corveroth|talk]]) 00:23, 17 July 2015 (UTC)
For the following 3 terms the Glossary glitches out:
: I'm very impressed by what you can do! I think we're almost ready to implement, and I' don't mind that we have sometimes have to create manual redirects. One thing, though. For example [[Casual Variants]] directs to [[Casual variants]] instead to the existing page with all capitals. Do we have to make manual redirects for those as well? Otherwise, the red links are nice pointers for what we are missing. --[[User:LegacymtgsalvationUser620|Hunter]] ([[User talk:LegacymtgsalvationUser620|talk]]) 05:00, 17 July 2015 (UTC)
*[[Mana]]
:: In such a case, I think the correct change would be to move the page to [[Casual variants]] and leave a redirect at the previous location. This is backed by Wikipedia naming conventions[https://en.wikipedia.org/wiki/Wikipedia:Naming_conventions_(capitalization)] and by [[Talk:+1/+1 Counter|our own previous discussion]] on the subject. =) [[User:Corveroth|Corveroth]] ([[User talk:Corveroth|talk]]) 05:27, 17 July 2015 (UTC)
*[[Object]]
::: OK, you've convinced me. I'm game. --[[User:LegacymtgsalvationUser620|Hunter]] ([[User talk:LegacymtgsalvationUser620|talk]]) 07:03, 17 July 2015 (UTC)
*[[Damage]]
Seeing now an issue: Each heading on the TOC has a "General" rule which links simply to [[General]]. Fix is probably to check for that specific phrase and link it to [[General_(Parts of a Card)]], etc. [[User:Corveroth|Corveroth]] ([[User talk:Corveroth|talk]]) 05:31, 17 July 2015 (UTC)
- [[User:Yanderesliver|Yandere Sliver]] [[File:H09 symbol.png|16px|link=User talk:Yanderesliver]] 01:52, 27 September 2018 (UTC)
: Fixed. Rule 100, Game Concepts > General, now links to [[General (Game concepts)]]. [[User:Corveroth|Corveroth]] ([[User talk:Corveroth|talk]]) 16:09, 17 July 2015 (UTC)


== Comp Rules updated for Origins ==
== Ikoria Companion Update ==
I realize that Wizards has now updated the CR on their website, with an effective date of tomorrow. I'd like to refrain from updating that section of the module for now, to utilize for a field test at a later date. [[User:Corveroth|Corveroth]] ([[User talk:Corveroth|talk]]) 03:18, 17 July 2015 (UTC)
 
: Good luck! I'll lend a hand where needed. --[[User:LegacymtgsalvationUser620|Hunter]] ([[User talk:LegacymtgsalvationUser620|talk]]) 05:56, 24 July 2015 (UTC)
The Comprehensive Rules were updated on Wizards' website to include the new rules for Companion, due to them being functionally changed. Despite that, the Comp Rules here on MTG Wiki still seem to be outdated and not include this new update. How do we get it in sync? --[[User:GoldenSandslash15|GoldenSandslash15]] ([[User talk:GoldenSandslash15|talk]]) 04:37, 3 June 2020 (UTC)
*I've updated the module. That should have done it. --[[User:Hunterofsalvation|Hunter]] ([[User talk:Hunterofsalvation|talk]]) 05:32, 3 June 2020 (UTC)

Latest revision as of 19:45, 15 January 2021

Please use the module indirectly via Template:CR. Using the module directly is more likely to break in the future.

Bug Reports

  • lookup=Effects returns the heading "6. Spells, Abilities, and Effects" rather than rule 609, "Effects". Affected page: Effects
  • lookup=Prevention Effects extends to the next heading (same bug as above). Affected page: Prevention effect

To-do list (coding changes to the module)

  • Allow title-based lookups to be case independent. At the moment, lookup=Creatures works, but lookup=creatures does not.
  • Build a list of common names for rules that are not titled as such in the CR, but which would be accepted by the module.
    • For example, the module might allow {{CR|lookup=Legend Rule}}, despite no title in the CR named "Legend Rule", and use an internal list of such faux-titles to equate that lookup with the correct index (in this case, at the moment, 704.5k).
  • Look into a means of allowing lookups for the General titles without using indices. The TOC output appends the title of the section, but this doesn't currently work on input.

External rule references ("see rule...")

Have references to other rules ("see rule DDD.Da") link to the other rule, or provide a tooltip summary of it, for ease of understanding. For example, the Emperor rules are 809, but references 801, 804 and 104, and no easy way to navigate in the wiki to those pages. —The preceding unsigned comment was added by MidnightLightning (talkcontribs).

It's something I've thought about in the past. I don't think it can be as simple as linking to another page, because there's no guarantee such a page exists. Even if we built redirects for every numeric codepoint in the CR, that would be very heavy maintenance (and very silly in a lot of cases). Tooltips, though, are a maybe, via CR.only. I'll give others a chance to weigh in first, but I expect we can have this running in short order. --Corveroth (talk) 23:31, 6 September 2017 (UTC)

Visual styling requests

Feel free to use this heading to contribute and debate any suggestions or requests for alterations to the visual style of output from the module.

701.5 Counter

I just found this: I think on Keyword action#Rules the "701.5. Counter" part should link to Counter (keyword action) instead of Counter. --Psion1C (talk) 15:22, 26 September 2018 (UTC)

Good point. I will see if I can dig through the code and find how these links are created. - Yandere Sliver 23:27, 26 September 2018 (UTC)
The module just guesses that any line in the rules that's shorter than five words is actually a title, rather than meaningful rules text, and it attempts to turn that line into a link to an article of the same name. (This works out just fine on the article in question, because a self-referential link gets bolded instead.) There's not a really good way to code the module to identify the difference from context, aside from shoving a one-time exception into mostly unrelated code specifically for this.
However, I have an alternate proposal. In the CR, the subjects in question appear as: 121. Counters (the markers), "701.5. Counter" (the keyword action). Should the article for the markers be pluralized, sacrificing some consistency with general wiki practices in exchange for consistency with the CR and within Module:CR? --Corveroth (talk) 00:22, 27 September 2018 (UTC)
I just noticed that counters links to counter (marker). We could make counter the article for the keyword action and create an article named counter (disambiguation) for the disambiguation page. We did that in other cases as well so that would be consistent with our wiki practices.
This way the CR would actually always link to the proper page and we would not need to change much. - Yandere Sliver 01:43, 27 September 2018 (UTC)
I moved the respective pages. Counter is now about counterspells, Counters links to Counter (marker), and Counter (disambiguation) is the disambiguation page. The CR links are now looking always at the correct article. - Yandere Sliver 17:35, 10 October 2018 (UTC)

Under consideration

  • Linking key phrases within the transcluded text - key words like "trample" and rules titles like "end step".
  • Replacing {W}, {1}, {S}, etc with their symbols
    • Why: Looks pretty.
    • Why not: The official CR documents use the text representations of those symbols. I want both an honest quote and to reinforce that those representations are canonical.
  • Adding a way to specify multiple rules that are printed in the same rulebox for use-cases like Untap#Untap_symbol --Hanmac (talk) 15:23, 5 August 2015 (UTC)
    • Why should two separate rules occupy the same box, rather than be separate quotes? Is it simply due to the space taken by the extra title, padding, margin? Corveroth (talk) 18:42, 5 August 2015 (UTC)

Mobile update

At long long last, the rules modules are now readable on mobile. In the process, other things may have broken or look odd. Please keep an eye out for any issues, and check out the new hotness on your phone or tablet! --Corveroth (talk) 07:30, 14 January 2017 (UTC)

Pre-release content

I'm open to ideas on how to handle, if at all, rules text for mechanics for which the CR has not yet been updated. I don't really want to lean on educated guesses from the community, but I wish there was something we could offer for the pre-release. --Corveroth (talk) 07:36, 14 January 2017 (UTC)

Glossary Glitches

For the following 3 terms the Glossary glitches out:

- Yandere Sliver 01:52, 27 September 2018 (UTC)

Ikoria Companion Update

The Comprehensive Rules were updated on Wizards' website to include the new rules for Companion, due to them being functionally changed. Despite that, the Comp Rules here on MTG Wiki still seem to be outdated and not include this new update. How do we get it in sync? --GoldenSandslash15 (talk) 04:37, 3 June 2020 (UTC)

  • I've updated the module. That should have done it. --Hunter (talk) 05:32, 3 June 2020 (UTC)