Module talk:CR

From MTG Wiki
Revision as of 18:20, 4 August 2015 by >Hunterofsalvation (→‎Prepare for Launch)
Jump to navigation Jump to search

Prepare for Launch

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:

  • 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. Corveroth (talk) 04:25, 24 July 2015 (UTC)

Good luck! I'll lend a hand where needed. --Hunter (talk) 05:56, 24 July 2015 (UTC)
Update: Pages currently using Template:CR will be rewritten to use Template:CRTemp so as not to break them when the former template is updated. Afterwards, the new template will redirect back to the updated version of CR, and any pages using CRTemp can optionally be converted to use CR directly at leisure. Pages using Template:CR are top priority for conversion so as to open up that template for editing. Other templates can wait. For now though, I'm off to FNM to play some janky Standard Izzet ETB thing. Corveroth (talk) 00:42, 25 July 2015 (UTC)
First 50 down, 200+ Template:CR uses to go! One small issue I noticed along the way is that the module is dropping the examples that should be in the transcluded text. That's easy enough to address in a later update. Corveroth (talk) 08:09, 25 July 2015 (UTC)
Another hiccup. This doesn't show the complete text (apart from the example) --Hunter (talk) 18:20, 4 August 2015 (UTC)

From the Comprehensive Rules (June 7, 2024—Modern Horizons 3)

  • 509.1b The defending player checks each creature they control to see whether it’s affected by any restrictions (effects that say a creature can’t block, or that it can’t block unless some condition is met). If any restrictions are being disobeyed, the declaration of blockers is illegal.
    A restriction may be created by an evasion ability (a static ability an attacking creature has that restricts what can block it). If an attacking creature gains or loses an evasion ability after a legal block has been declared, it doesn’t affect that block. Different evasion abilities are cumulative.

    Example: An attacking creature with flying and shadow can’t be blocked by a creature with flying but without shadow.

Intro

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! Corveroth (talk) 04:51, 15 July 2015 (UTC)

Great, looks good! (you're missing the right parenthesis after the expansion-name, I think) --Hunter (talk) 05:24, 15 July 2015 (UTC)
Nope, the date is in nested parens, so there are two closing parens at the very end. Corveroth (talk) 05:29, 15 July 2015 (UTC)
Ah, yes :-) --Hunter (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? --Hunter (talk) 05:24, 15 July 2015 (UTC)
In other words - we'd like rules topics within the transcluded rules text to be wikilinked? 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] is [characteristic value]”), it’s not granting an ability. (See rule 604.3.) Similarly, if an effect states a quality of that object (“[creature] can’t be blocked,” for example), it’s neither granting an ability nor setting a characteristic. 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 --Hunter (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. Corveroth (talk) 06:21, 15 July 2015 (UTC)
Also, shouldn't Template:Comprehensive Rules and Template:Rules now be phased out? --Hunter (talk) 05:24, 15 July 2015 (UTC)
Seems reasonable. I'm also looking at the apparently stalled User:RuleUpdateBot for tips. Corveroth (talk) 05:29, 15 July 2015 (UTC)

Also, damnit, this is on the /doc page. Welp. Corveroth (talk) 05:30, 15 July 2015 (UTC)

Fixed. Corveroth (talk) 00:42, 25 July 2015 (UTC)

bug with only

there is a bug with only, only|107.8 it does show 107.8b but it should show 107.8 without sub sections. same for only|702 or only|702.1 shows 702.109b

also TOC|702 does show this: Lua error in Module:CR at line 356: Invalid table of contents index!. but i want to have it look like this: Keywords#List

--Hanmac (talk) 05:47, 15 July 2015 (UTC)

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. Corveroth (talk) 06:07, 15 July 2015 (UTC)
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. Corveroth (talk) 06:21, 15 July 2015 (UTC)
Extra line rule implemented. Corveroth (talk) 00:16, 17 July 2015 (UTC)

Text Replacement

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?)

second i want to have {W/P} be replaced with Template:W! and so on, that might be done with a dictionary replacement --Hanmac (talk) 09:00, 15 July 2015 (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. 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? Corveroth (talk) 00:17, 17 July 2015 (UTC)

Auto-linked titles

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.) Corveroth (talk) 00:23, 17 July 2015 (UTC)

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. --Hunter (talk) 05:00, 17 July 2015 (UTC)
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[1] and by our own previous discussion on the subject. =) Corveroth (talk) 05:27, 17 July 2015 (UTC)
OK, you've convinced me. I'm game. --Hunter (talk) 07:03, 17 July 2015 (UTC)

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. Corveroth (talk) 05:31, 17 July 2015 (UTC)

Fixed. Rule 100, Game Concepts > General, now links to General (Game concepts). Corveroth (talk) 16:09, 17 July 2015 (UTC)

Comp Rules updated for Origins

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. Corveroth (talk) 03:18, 17 July 2015 (UTC)

Live fire complete, update propagated successfully. We have automation. Corveroth (talk) 00:42, 25 July 2015 (UTC)