User talk:Izno/Archive 8: Difference between revisions

Content deleted Content added
Line 642:
::::Oh, I see it now, <code>local classes = {'hatnote', 'navigation-not-searchable'}</code>. Not sure what's the best way around this without forking a bunch more code back into [[Module:Hatnote inline]]. Was thinking maybe it could be something like <code>function p._hatnote(s, options, baseClass)</code> in Module:Hatnote, with local default definition of <code>baseClass</code> with a value of <code>hatnote</code>, then have Module:Hatnote_inline pass a value of <code>hatnote-inline</code> with its own /styles.css that does the italics stuff without the spacing tweaks, and have Module:Hatnote have <code>local classes = {baseClass, 'navigation-not-searchable'}</code>. Or something like that. I can't Lua my way out of a paper bag; the odds of me getting this right the first time are low, and I'm probably picking the least efficient solution. :-/ <span style="white-space:nowrap;font-family:'Trebuchet MS'"> — [[User:SMcCandlish|'''SMcCandlish''']] [[User talk:SMcCandlish|☏]] [[Special:Contributions/SMcCandlish|¢]] 😼 </span> 07:07, 12 July 2021 (UTC)
:::::Yeah, I'm leaning toward similar modularity. I have slightly more success with paper bags, but I'm going to bed for now and will look in the morning. I think the current point is Good Enough for some respite. [[User:Izno|Izno]] ([[User talk:Izno#top|talk]]) 07:19, 12 July 2021 (UTC)
::::::The ''simplest'' option would be to just do a string-replace <code><nowiki>class="hatnote </nowiki></code> to <code><nowiki>class="hatnote-inline"</nowiki></code> and then handle the differences in the (shared) stylesheet; it's ''probably'' safe to assume that "hatnote" will always be the first class name in the list. Where it's a simple tweak for ultimately the same code, we shouldn't reinvent the wheel or duplicate code unless we have to. SMcCandlish's <code>baseClass</code> idea isn't ''bad'', but it does beg the question of whether we ''want'' the code to be easily reusable that way; inline navigational notes aren't ''really'' "hatnotes". "Midnotes"? Murky ontological issues, gross. It's in working order for now; I made [[Special:Diff/1033275263|one small tweak]] so that <code><nowiki><div></nowiki></code> elements ''inside'' hatnotes shouldn't be affected. <span style="white-space:nowrap;">{&#123;[[User:Nihiltres|<span style="color:#233D7A;">Nihiltres</span>]]&#8202;&#124;[[User talk:Nihiltres|talk]]&#8202;&#124;[[Special:Contributions/Nihiltres|edits]]}&#125;</span> 17:44, 12 July 2021 (UTC)