Template talk:Trim quotes

Wikimarkup interference
This needs to be able (always or at least optionally) to distinguish "foo" and 'bar' (to be trimmed) from baz, quux, baz quux, and quux baz (not to be trimmed). Ideally it would also detect quux 'yadda yadda!' (to output quux yadda yadda!) and "doodle doodle dee" baz (to output doodle doodle dee baz). Right now, this is breaking various uses of unless measures are taken on a case-by-case basis (which most editors will neither notice nor understand) to escape this behavior when the quoted material start and ends with bold or italic wikimarkup. There's really not a reason for this template to touch  or ' at all, unless specially told to do so by some parameter, since neither multi-apostrophe string is used for quotation, so we don't need to strip it. I can't Lua my way out of a paper bag, so someone who knows the language and its string-matching antics better than I do should tackle this. — SMcCandlish ☏ ¢ 😼  21:31, 30 January 2020 (UTC)
 * How would you handle "kevin's" or "'til" or "'til he went to kevin's"? Gonnym (talk) 22:04, 30 January 2020 (UTC)
 * As double-quotes aren't used in wiki-markup, the only changes needed are to scan for multi-quote scenarios ("Bah" he said, "Humbug") and to provide an "opt out" for when a person WANTS the quotation marks to appear, such as quoting computer code where the quotations are important, like
 * Here is the string that needs to be changed: ""Hello WOrld""
 * The bigger issue would be the Britsh quotation style, where "'til we meet at the Jones'" (meaning "Until we meet at the Jones' house") becomes til we meet at the Jones . Note the double-single-quote for a quotation mark and apostrophe at the beginning, and the reverse at the end. Of course, there could be a book titled  'Til we meet at the Jones'  as well. Or a British book which is a quotation:  Til we meet at the Jones   You can see that the issue of single quotes this is probably intractable without some sort of context-awareness.  An opt-out parameter to suppress stripping quotes solves this issue as well.
 * As an additional general solution, better advertising of the quotation mark templates listed here in the documentation of quotation-related templates may be the best we can do when it comes to single-quotation-mark issues. davidwr/ (talk)/(contribs)  23:23, 30 January 2020 (UTC)
 * Sorry if this wasn't clear. The double qutoes was to show here what text I'm referring to and not what text is sent to the template. --Gonnym (talk) 10:56, 31 January 2020 (UTC)
 * May I make a recommendation: Add an 1 parameter that makes trim quotes just return s or 1, so that existing templates that call it are easier to modify.  It's a lot easier to pass a suppresstrim parameter to you than it is to rewrite existing templates as a large if-then block of "if suppresstrim not present then do normal stuff else do normal stuff except don't call trim quotes".  Rewriting such templates can result in block-copied code which becomes hard to maintain - I know, I seriously considered this option with today's changes to Template:quote.  I went with the much simpler option of just throwing in if a newly-added parameter notrim was present.   Also, consider making the change at Module:Trim quotes.  davidwr/  (talk)/(contribs)  23:31, 30 January 2020 (UTC)
 * This version avoids trimming consecutive single quotes, but doesn't handle internal trimming like  →.
 * — Eru·tuon 04:13, 31 January 2020 (UTC)
 * This fails with . --Gonnym (talk) 11:02, 31 January 2020 (UTC)
 * Right, that's not very different from : there's a quotation and something else. The code relies on the assumption that the parameter contains a single quotation if any. It's a crappy draft, not good enough to be deployed in the template. — Eru·tuon 21:26, 31 January 2020 (UTC)
 * How about something like
 * That matches 'quote' where the first apostrophe is not preceded by a letter or another apostrophe but is followed by a letter, and the second apostrophe is preceded by a letter (or punctuation commonly found at the end of a quotation) but is not followed by a letter or another apostrophe.
 * It handles text like  but not  .  The latter, I think, is impossible to parse in general.  Certes (talk) 20:34, 31 January 2020 (UTC)