Bach khoa toan th? m? Wikipedia
Tai li?u mo đun
[
t?o
]
local
p
=
{}
function
p
.
main
(
frame
)
local
result
=
""
local
title
=
mw
.
title
.
new
(
mw
.
text
.
trim
(
frame
.
args
[
1
]),
6
)
if
(
title
~=
nil
and
title
.
fileExists
)
then
local
image
=
title
.
file
local
w
=
image
.
width
local
h
=
image
.
height
local
ratio
=
w
/
h
-- N?u t? l? w/h > 2.5 ho?c < 0.5 thi bao l?i
if
(
ratio
<
0.5
or
ratio
>
2.5
)
then
local
span
=
mw
.
html
.
create
(
"span"
):
attr
(
"class"
,
"error"
):
wikitext
(
"Hinh ?nh ch?n l?c ph?i co t? l? chi?u r?ng/chi?u cao t? 0.5 đ?n 2.5. Hinh nay đang co t? l? la "
..
math.floor
(
ratio
*
100
)
/
100
..
" [= "
..
w
..
"/"
..
h
..
"]."
)
result
=
tostring
(
span
)
end
end
return
result
end
return
p