Module talk:italics

Name
Since this module concerns italics specifically in the context of taxonomic names, do you think it might be better named Module:taxonomy? That way, we can include other taxonomy-related stuff in there too. —CodeCat 23:13, 31 October 2016 (UTC)
 * I considered that possibility, but decided against it because the same italicization function can be used for other article names that have a parenthesized disambiguator after them, like Antigone (Sophocles play). I'm not sure if such articles are currently linked to on Wiktionary (I didn't find any examples when I briefly looked), but I decided to name the module so that such links wouldn't be excluded. — Eru·tuon 23:17, 31 October 2016 (UTC)
 * That makes sense. We may still want to create Module:taxonomy in any case, though. —CodeCat 23:18, 31 October 2016 (UTC)

Use in "quote-meta/source"
Hi,. The recent discussion and use of this module at got me thinking about whether this module can be used to adjust italicization in the titles of works at  and. Currently, the title of a work is italicized using tags. However, when a title is long it is sometimes desirable to use ellipses to omit parts of it. These ellipses should, ideally, not be italicized:
 * Not so good: A Voyage around the World. [...] In Two Volumes.
 * Much better: A Voyage around the World. [...] In Two Volumes.

At the moment, the only way to achieve the second result is to use the following ugly hack: A Voyage around the World. [...] In Two Volumes. Would it be possible to create another function in this module to search for occurrences of " [...] ", "" and "" and turn off the italicization? If so, I'd also be grateful if you would assist in updating and  (or explain to me how to do so) so that they invoke this module. Thanks. — SGconlaw (talk) 15:14, 30 July 2017 (UTC)

In fact, just thinking about it, perhaps italicization should be turned off for any use of the left or right brackets within the title of a work, as that would indicate an editorial interpolation not originally in the title, like this: A Response to a Scurrilous Libel by J[onathan] S[wift]. [...] In Two Volumes. — SGconlaw (talk) 15:18, 30 July 2017 (UTC)

, what do you think? Any chance you can look into it? — SGconlaw (talk) 22:08, 10 August 2017 (UTC)
 * It should be possible. However, handling will be a little more complicated than the literal , because the module will be searching the wikitext that it generates. — Eru·tuon 22:15, 10 August 2017 (UTC)
 * I'm not sure how often or  occurs in titles. Maybe we can start with handling [...] and [ and ] first? — SGconlaw (talk) 01:51, 11 August 2017 (UTC)
 * Okay, I've done that. See the documentation page. — Eru·tuon 02:38, 11 August 2017 (UTC)
 * Thanks! However, I modified (see this diff), but it doesn't seem to work. See the 1666 quotation in . Have I invoked it wrongly? — SGconlaw (talk) 06:54, 11 August 2017 (UTC)
 * Yeah, it appears to be because the template uses html tags to produce italics, while I am using html, which translates to html tags. Anyway, the function needs more testing before it can be used, and I am not sure how to get a representative selection of titles to test it with. — Eru·tuon 20:21, 11 August 2017 (UTC)
 * Actually, when I tried updating the template I removed all the html tags entirely and replaced them with . Was this incorrect? Here are some entries that you can test with: (1793, 1825 and 1845 quotes),  (etymology 2, 1666 quote), . — SGconlaw (talk) 12:31, 12 August 2017 (UTC)

, any chance you have time to look into this again? — SGconlaw (talk) 02:33, 29 November 2017 (UTC)
 * I have time, but have to consider how best to implement deitalicization within cite tags. I don't think removing the cite tags and replacing them with  is the right solution. It might be better to leave the tag, because it is semantically valid, but add inline CSS around the text to be deitalicized: html. In response to your previous post, the module isn't ready to use. — Eru·tuon 02:52, 29 November 2017 (UTC)
 * OK, thanks for looking into this! Let me know when it's ready for implementation in and . — SGconlaw (talk) 04:15, 29 November 2017 (UTC)
 * A beta version is available. You can invoke it thus: . — Eru·tuon 07:04, 13 January 2018 (UTC)
 * : thanks! However, it doesn't seem to work as predicted. I edited to add the module to the parameters chapter, trans-chapter, title, and trans-title, but it seems to have removed italicization from the title altogether if the title contains brackets. See, for example,  and . Italicization was done using   tags, but it doesn't make a difference whether I use that or  . Also, the remainder of the reference after the title (publication place, name of publisher, etc.) is now italicized. — SGconlaw (talk) 13:18, 14 January 2018 (UTC)
 * However, strangely enough, it works properly at . Could it be because the title in is within a wikilink? — SGconlaw (talk) 16:20, 14 January 2018 (UTC)
 * Yes, it was the wikilink. The function was simply looking for brackets and didn't care to distinguish wikilinks from brackets that couldn't be wikilinks. There are probably other cases that won't be handled correctly, so let me know if you notice any. — Eru·tuon 21:21, 14 January 2018 (UTC)
 * Thanks for fixing it! Will do. — SGconlaw (talk) 02:08, 15 January 2018 (UTC)

Hi,. I noticed that in the 1850 quotation at, the text within the brackets is no longer in italics. I think only the brackets themselves should not be italicized; the text within them should be: — SGconlaw (talk) 19:12, 18 January 2018 (UTC)
 * Current: Rev. R[alph] R[andolph] Gurley
 * Preferred: Rev. R[alph] R[andolph] Gurley
 * Ah. And should ellipses not be italicized? Not that it matters visually. — Eru·tuon 19:17, 18 January 2018 (UTC)
 * Done. And I also fixed external links, mentioned in . — Eru·tuon 22:27, 18 January 2018 (UTC)
 * Thanks! Sure, ellipses should remain unitalicized, but as you said it's probably not visually detectable either way. — SGconlaw (talk) 03:11, 19 January 2018 (UTC)

Changes to Template:... and Template:nb...
Hi,, could you please update this module so that it recognizes the changes that have been made to and  to avoid Lint errors? Thanks, and merry Christmas! — SGconlaw (talk) 08:12, 25 December 2018 (UTC)
 * What do you mean by "missing span" in this example ? Are you referring to the fact that the second of the closing brackets isn't enclosed in ? — Eru·tuon 19:07, 25 December 2018 (UTC)


 * Yes. The missing span is a Linter Error. It typically means the parser is getting confused about where the 'end' of something is. In this instance I think it's confusing the end ] of the with the end of a link, and mismatching the opening/closing brackets of what it thinks is a link (wrapped by an enclosing span.) ShakespeareFan00 (talk) 19:10, 25 December 2018 (UTC)
 * Okay. Well, that can be fixed by changing some of the brackets to HTML character references, but I don't know if the module should do it, unless there is some clear way to determine which brackets belong to the external link syntax. — Eru·tuon 19:16, 25 December 2018 (UTC)
 * I changed the brackets in and  to HTML character references. If any bracket that is not supposed to be interpreted as link syntax is given as HTML character reference (html) or enclosed in nowiki tags, that keeps the parser from misidentifying the start and end of the link. — Eru·tuon 19:33, 25 December 2018 (UTC)
 * However, the module is no longer working the way it used to – now if or  are used in a quotation, the brackets are appearing italicized. See, for example,  (which appears in ). Also,  has failed entirely in the Wilson quotation under sense 1.17 in, producing " […] ". (Frankly, I'm beginning to wonder why is it necessary to avoid Lint errors at all, since they do not seem to affect anything.) — SGconlaw (talk) 21:35, 25 December 2018 (UTC)
 * Right. Should've thought of that. Lua can't easily identify HTML character references for matching brackets (without LPeg). I've undone my edits. — Eru·tuon 22:02, 25 December 2018 (UTC)

Fails when portion to de-italicized is at the start of the parameter with no proceeding italic portion
Test case :

In this instance the function should be moving the start of the italic portion until after the x or other de-italicized portion.ShakespeareFan00 (talk) 08:28, 25 December 2018 (UTC)
 * Modified the code to remove quadruple single quotes. — Eru·tuon 19:22, 25 December 2018 (UTC)