MediaWiki talk:Gadget-Easy LST.js

From Wikisource
Jump to navigation Jump to search

Proposal[edit]

{{edit protected|}}

There is a logic error in function restore_lst() exhibited e.g. here. The line currently reading

if( title && content.substring(0,2)=='{|' ) content = '\n' + content;

might be better if replaced by

if( title &&
    content.substring(0,2)=='{|' ||
    content.substring(0,1)=='|' ){
        content = '\n' + content;
}

—on the basis there are pretty much no cases where maintaining a new-line immediately before a pipe will cause harm; yet at the same time several where deleting a necessary one cases problems as shown in the sample quoted above. AuFCL (talk) 03:30, 13 January 2016 (UTC)[reply]

Possibly(?) related: https://phabricator.wikimedia.org/T123174 -- George Orwell III (talk) 22:40, 18 January 2016 (UTC)[reply]
Yep. T123174 describes precisely the same situation which originally drew my attention. What I propose (should I hope) address both this as a special case and a few more hypothetical situations. AuFCL (talk) 00:01, 19 January 2016 (UTC)[reply]
I have my doubts about special:diff/6074161/next (I lean more toward script caching as culprit) but the end result works fine here, as proven by special:diff/prev/6074194. AuFCL (talk) 00:37, 19 January 2016 (UTC)[reply]
Yes -- I just realized my caching had not caught up to the current at the time and have reverted to [pretty much] the same as you provided above since. I see the same desired results either way too but we'll stick to your correction above regardless. Shall I point to the appropriate diff in T123174 or can you? -- George Orwell III (talk) 00:46, 19 January 2016 (UTC)[reply]
Hey wait a second - @AuFCL: you patched the example Page: illustrating the problem in the interim? So the .js modification still did not fix this? Don't know what to do next? Revert completely? Reapply my change? Neither? -- George Orwell III (talk) 00:53, 19 January 2016 (UTC)[reply]
@George Orwell III: Panic not. All is correct. Being a pedant I have re-re-checked the latest level of patch works correctly. Tested here: special:diff/prev/6074194—worst case the (untouched) easy_lst() routine inserts an extra newline upon conversion to #### form. In any case the "error illustration" is a permalink and so should be immutable. Have I missed anything else concerning you? AuFCL (talk) 01:09, 19 January 2016 (UTC)[reply]
Well yes -- I don't use Easy LST so now I'm stuck with the extra line insertion for section end... tags that (I believe) should be removed upon the actual save like they seem to be [now] for section begin... tags "manipulated" by those editors using Easy LST.

And I'm not sure this would fix the example given in the task unless the ## and the |- were on the same line ( |-## foo ##).

In other words, yes this fixes one type of Easy LST disparity with using straight section tags but will [possibly} break other instances of certain Easy LST usage and/or not correct all the other [possible] similar uses out there concerning tables. --George Orwell III (talk) 01:18, 19 January 2016 (UTC)[reply]

Likewise my personal preference is not to use this aberrant gadget. However, decision time: shall we abandon the patch altogether (back it out), or shall we put in the extra research to prevent easy_lst() inserting an unnecessary newline; thus restoring symmetry to the process at least from the point of view of single edit sessions? I'll let you make the call. (I shall proceed pending your decision as if you wanted me to make the latter choice.) AuFCL (talk) 01:29, 19 January 2016 (UTC)[reply]
You're missing the point - at the very core of all these na-nah, na-nah, boo-boo, no [correctly] embedded page: link for you you happenstances is the fact that most issues are to be expected symptoms when relying on the wiki-mark-up's symbol based reincarnation of html table element tags. In short: Can you reproduce the behavior when traditional HTML table element tags are used instead of wiki-mark-up table symbols? I suspect not but I will endeavor to prove that shortly on Test2 by example using the same 3 page table used here.

That said, I'm not inclined to patch something unless we can further replication of the already crippled (see nop workarounds) section tag behavior when it comes to tables spanning more than a page. I have no idea how to stop the additional line under Easy LST but am willing to see if you can.

If you can't, we'll revert to back to simply mirroring what old.ws has in its Base.js [except in Gadget form] here on en.WS. Agreed? -- George Orwell III (talk) 02:00, 19 January 2016 (UTC)[reply]

You are right. Please rip it back out down to special:permalink/5184549. Trying to figure out the execrable state of some of those regexps is giving me a headache anyway. Sorry to have wasted both of our time. AuFCL (talk) 02:09, 19 January 2016 (UTC)[reply]