Jump to content

Template talk:Resratio

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
(Redirected from Template talk:Resratio/doc)

Expression error

[edit]

@Crissov: List of common resolutions is showing "Expression error: Unrecognized punctuation character ":".∶Expression error: Unexpected / operator". I suspect that is due to recent edits at this template but I haven't had time to confirm that. At any rate, the article contains the following which shows the error if previewed in a sandbox.

{{resrow
|2960
|1440
|Infinity Display
|u=[[Samsung Galaxy S8]], [[Samsung Galaxy S8+]], [[Samsung Galaxy S9]], [[Samsung Galaxy S9+]], [[Samsung Galaxy Note 8]]
|s=18.5:9
|p=1:1
}}

Perhaps it's the ".5" in s=18.5:9? I'm hoping you can fix it, thanks. Johnuniq (talk) 06:14, 5 November 2019 (UTC)[reply]

Indeed. The template only expects ratios of integers. I have fixed it in the article, but will also have a look at the template code. — Christoph Päper 21:01, 8 November 2019 (UTC)[reply]

use of u+2236 ratio symbol

[edit]

The use of this template in the article has lead to a discussion at Talk:Paper_size#use_of_u+2236_ratio_symbol. It appears that the output of this template contravenes MOS:FRAC by using u+2236 rather than a colon in its output. Martin of Sheffield (talk) 19:39, 28 October 2022 (UTC)[reply]

MOS:FRAC calls for a colon and the ratio symbol is a kind of colon, so I don't think this template violates the guideliones.
I agree with the comment that browsers should use a normalized form in their in-page search. — Christoph Päper 14:02, 3 November 2022 (UTC)[reply]
I do not think this is a helpful reply. Many browsers, and possibly other systems do not necessarily normalise in this way, so it would be helpful to change the character to the normal one. (I believe this is a standard MOS guideline.) Imaginatorium (talk) 18:34, 12 April 2023 (UTC)[reply]

Float output does not work for unknown aspect ratios

[edit]

{{Resratio|5|4|f=true}} outputs 1.25 as it should, because f=true is specified. Removing f=true would make it output 5:4.

{{Resratio|4|5|f=true}} however, outputs 4:5 rather than 0.8. f=true in this case makes no difference.

The first example works because it is a known ratio. Unknown ratios do not change their behaviour when f is specified. This causes an issue within Template:Resrow which requires float output so that it can use the result in an expression. Using 4:5 in an expression makes #expr throw an error because it does not recognise the : character.

The issue can currently be seen on List_of_common_resolutions under "Samsung feature phones".

I am currently trying to rewrite the default case over in the sandbox in order to fix this. However, it seems there is already another error in it, namely that it contains code that never runs because of a condition that is always true: an expression that is guarded by #iferror contains a single ) closing bracket but no opening one, meaning there is always an error. Said dead code doesn't even work anymore because it calls to Template:gcd which has since been removed. Beeans r swag nerds (talk) 01:02, 15 June 2023 (UTC)[reply]