Module talk:TaxonItalics
Request to output log
[edit]Moved here from Module talk:TaxonItalics/testcases as per instructions there. Peter coxhead (talk) 15:13, 23 August 2018 (UTC)
Erutuon, due to some useful changes Peter coxhead made to the main module, all of the initially-unitalicized testcases [at Module talk:TaxonItalics/testcases] show as failed, but I assume this is due to HTML-ified spaces/multipliciations/etc., which render the same but fail a simple plain-text equivalency check. Would you be able to output a nowiki version of the log after the table and/or add 2 columns to the table (e.g. "Expected nowiki" & "Actual nowiki")? ~ Tom.Reding (talk ⋅dgaf) 14:48, 23 August 2018 (UTC)
- @Tom.Reding: I'm aware of this issue, but I'm still working on the module to get allow it to abbreviate taxon names when required – not needed in {{Taxonbar}} but needed in some autotaxoboxes.
- I think it's correct now, but Erutuon should wait a day before doing anything in case there are more changes. Peter coxhead (talk) 15:13, 23 August 2018 (UTC)
- See User:Peter coxhead/Test#Module:TaxonItalics#main for my work tests. Peter coxhead (talk) 15:16, 23 August 2018 (UTC)
- @Tom.Reding and Erutuon: I'm doubtful of the value of Module talk:TaxonItalics/testcases, because it's the visual appearance of the output that matters, not the exact HTML that achieves this. During development, I've changed the way the code de-italicizes components like the hybrid symbol and connecting terms more than once, partly to simplify the algorithm and partly for consistency. It could be changed again, e.g. depending on the discussion at Wikipedia talk:WikiProject Plants#Hybrid symbol ×, without changing the visual appearance of cases currently handled correctly. In development, I've relied on tests like those at User:Peter coxhead/Test#Module:TaxonItalics#main, just looking at the output. Peter coxhead (talk) 16:47, 24 August 2018 (UTC)
- @Peter coxhead: Well, I see your point, but I've updated them so that they all pass again. Perhaps they can serve as a demonstration of what the function does, since they are not very useful when editing the module. — Eru·tuon 20:54, 24 August 2018 (UTC)
- Well, if you're happy to do the work, I agree they are a good demonstration.
- Any thoughts about other cases, as per my question below? Peter coxhead (talk) 20:58, 24 August 2018 (UTC)
- Not right now, but I'll post there if any occur to me. — Eru·tuon 06:03, 25 August 2018 (UTC)
- @Peter coxhead: Well, I see your point, but I've updated them so that they all pass again. Perhaps they can serve as a demonstration of what the function does, since they are not very useful when editing the module. — Eru·tuon 20:54, 24 August 2018 (UTC)
- @Tom.Reding and Erutuon: I'm doubtful of the value of Module talk:TaxonItalics/testcases, because it's the visual appearance of the output that matters, not the exact HTML that achieves this. During development, I've changed the way the code de-italicizes components like the hybrid symbol and connecting terms more than once, partly to simplify the algorithm and partly for consistency. It could be changed again, e.g. depending on the discussion at Wikipedia talk:WikiProject Plants#Hybrid symbol ×, without changing the visual appearance of cases currently handled correctly. In development, I've relied on tests like those at User:Peter coxhead/Test#Module:TaxonItalics#main, just looking at the output. Peter coxhead (talk) 16:47, 24 August 2018 (UTC)
Work remaining
[edit]The module seems to handle ICNafp-style names (i.e. those with connecting terms) correctly, both straightforward italicization and abbreviation. However, it doesn't yet handle "GENUS (SUBGENUS)" style names:
Peter coxhead (talk) 17:12, 23 August 2018 (UTC)
The module now handles "GENUS (SUBGENUS)" style names correctly:
- Genus (Subgenus) → Genus (Subgenus)
- Genus (Subgenus) species → Genus (Subgenus) species
- Genus (Subgenus) [abbreviated] → G. (Subgenus)
- Genus (Subgenus) species [abbreviated] → G. (S.) species
Are there any more cases that the code should handle? Peter coxhead (talk) 16:41, 24 August 2018 (UTC)
Handling disambiguation terms
[edit]By default, the code assumes that a parenthesized term is a subgenus and italicizes it:
- {{#invoke:TaxonItalics |main |Varanus (Hapturosaurus)}} → Varanus (Hapturosaurus)
However, this is wrong if it is actually a disambiguation term:
- {{#invoke:TaxonItalics |main |Caia (plant)}} → Caia (plant)
I've just added a parameter |dab=
to treat a parenthesized part as a disambiguation term:
- {{#invoke:TaxonItalics |main |Caia (plant) |dab=yes}} → Caia (plant)