Mô tổ:Chemicals
Ngoại quan
Mô khối văn đương[Tra khán] [Biên tập] [Lịch sử] [Thanh trừ hoãn tồn]
Thử mô khối bị dẫn dụng ôƯớc 24,000 cá hiệt diện. Vi liễu tị miễn tạo thành đại quy mô đích ảnh hưởng, sở hữu đối thử mô khối đích biên tập ứng tiên ôSa hạpHoặcTrắc thí dạng lệThượng trắc thí. Trắc thí hậu vô ngộ đích bản bổn khả dĩ nhất thứ tính địa gia nhập thử mô khối trung, đãn thị tu cải tiền thỉnh vụ tất ôThảo luận hiệtPhát khởi thảo luận. Mô bản dẫn dụng sổ lượng hội tự động canh tân. |
Module:Chemicals(Biên tập|Thảo luận|Lịch sử|Liên tiếp|Giam thị|Nhật chí)
Bổn mô tổ trung bao hàm nhất ta dữ hóa học tương quan đích hàm thức
formula
Bổn hàm thức công năng vi tra tuânModule:Element/dataTư liêu tịnh sản sinh hóa học thức
Usage:
{{#invoke:Chemicals|formula|<template-argument>}}
Parameters:
- <template-argument>
- Yếu kiến cấuHóa học thứcĐích tư liêu, tất tu sử dụng mô bản dẫn dụng truyện đệ tham sổ
- Lệ như mô bản trung tả:
{{#invoke:Chemicals|formula}}
- Khiếu dụng mô bản:
{{ mô bản danh xưng |H|2|O}}
→ H2O
- Lệ như mô bản trung tả:
reaction
Bổn hàm thức công năng vi tra tuânModule:Element/dataTư liêu tịnh sản sinhPhản ứng thức
Usage:
{{#invoke:Chemicals|reaction|<template-argument>}}
Parameters:
- <template-argument>
- Yếu kiến cấu hóa họcPhản ứng thứcĐích tư liêu, tất tu sử dụng mô bản dẫn dụng truyện đệ tham sổ
check_CAS
- Hàm sổ nguyên hình ( dĩ C ngữ ngôn biểu kỳ ):
boolean_stringMô khối::Chemicals::check_CAS(conststringcas_no );
Bổn hàm thức công năng vi tra tuân kiểm tra CAS hào đích cách thức dữ giáo nghiệm mã thị phủ chính xác, cận năng do kỳ tha mô tổ hô khiếu.
Datatype:
- boolean_string
- Biểu kỳBố lâm trịĐích tự xuyến, kỳ trị cận hội hữu
"true"
Hoặc"false"
Parameters:
- cas_no
- Yếu phán đoạn đích CAS hào tự xuyến
check_CAS_test
Bổn hàm thức công năng vi tra tuân kiểm tra CAS hào đích cách thức dữ giáo nghiệm mã thị phủ chính xác, khả do mô bản hô khiếu.
Usage:
{{#invoke:Chemicals|check_CAS_test|1=<CAS_Number>}}
Parameters:
- <CAS_Number>
- Yếu phán đoạn CAS hào thị phủ chính xác đích CAS hào tự xuyến
- Lệ như:
{{#invoke:Chemicals|check_CAS_test|1=12-35-1}}
→ true- Thông thường hội đáp phối
{{#ifeq:...|true}}
Hoặc{{#ifeq:...|false}}
Sử dụng
- Thông thường hội đáp phối
- Lệ như:
{{#ifeq:{{#invoke:Chemicals|check_CAS_test|1=12-35-4}}|true| chính xác | thác ngộ }}
→ thác ngộ{{#ifeq:{{#invoke:Chemicals|check_CAS_test|1=12-35-1}}|false|{{Nay}} kiểm tra mã giáo nghiệm thất bại |{{Aye}} kiểm tra mã giáo nghiệm thành công }}
→ Kiểm tra mã giáo nghiệm thành công
- Lệ như:
Thượng thuậtVăn đươngKhảm nhậpTựModule:Chemicals/doc.(Biên tập|Lịch sử) Biên giả khả dĩ tại bổn mô khối đích sa hạp(Sang kiến|Kính tượng)Hòa trắc thí dạng lệ(Sang kiến)Hiệt diện tiến hành thật nghiệm. Bổn mô khối đích tử hiệt diện. |
localp={}
localorigArgs
localerror=require('Module:Error')
localelement={}
locallib_arg={}
localstrings=require('Module:String')
localelement_data={}
functionp.formula(frame)
-- For calling from #invoke.
localargs
ifframe==mw.getCurrentFrame()then
-- We're being called via #invoke. The args are passed through to the module
-- from the template page, so use the args that were passed into the template.
iflib_arg.getArgs==nilthenlib_arg=require('Module:Arguments')end
args=lib_arg.getArgs(frame)--frame.args
else
-- We're being called from another module or from the debug console, so assume
-- the args are passed in directly.
args=frame
end
returnp._formula(args)
end
functionp.reaction(frame)
-- For calling from #invoke.
localargs
ifframe==mw.getCurrentFrame()then
-- We're being called via #invoke. The args are passed through to the module
-- from the template page, so use the args that were passed into the template.
iflib_arg.getArgs==nilthenlib_arg=require('Module:Arguments')end
args=lib_arg.getArgs(frame)--frame.args
else
-- We're being called from another module or from the debug console, so assume
-- the args are passed in directly.
args=frame
end
returnp._reaction(args)
end
functionp.check_CAS(cas_no)
arrs=strings.split(cas_no,'-',true,false)
split_num=tonumber(table.getn(arrs))
--avoid nil
if(split_numandsplit_num~='')then
if(split_num==3)then
--cas no have 3 pattern
else
return'false'
end
else
--if nil
return'false'
end
cas_without_desh=arrs[1]..arrs[2]
check_length={}-- new array
forseq_it=1,3do
check_length[seq_it]=mw.ustring.len(arrs[seq_it])
end
if(check_length[1]<2orcheck_length[1]>7)thenreturn'false'end
if(check_length[2]~=2)thenreturn'false'end
if(check_length[3]~=1)thenreturn'false'end
cas_check=tonumber(arrs[3])
if(cas_checkandcas_check~='')then
else
return'false'
end
cas_len=mw.ustring.len(cas_without_desh)
cas_sum=0
fori=1,cas_lendo
index=cas_len+1-i
cas_symbol=tonumber(cas_without_desh:sub(index,index))
if(cas_symbolandcas_symbol~='')then
cas_sum=cas_sum+(cas_symbol*i)
else
return'false'
end
end
if((cas_sum%10)==cas_check)then
return'true'
else
return'false'
end
return'false'
end
functionp.check_CAS_test(frame)
-- For calling from #invoke.
localload_args
ifframe==mw.getCurrentFrame()then
-- We're being called via #invoke. The args are passed through to the module
-- from the template page, so use the args that were passed into the template.
iflib_arg.getArgs==nilthenlib_arg=require('Module:Arguments')end
load_args=lib_arg.getArgs(frame)--frame.args
else
-- We're being called from another module or from the debug console, so assume
-- the args are passed in directly.
load_args=frame
end
args={}
fork,vinpairs(load_args)do
args[k]=v;
end
returnp._check_CAS_test(args)
end
functionp._check_CAS_test(args)
-- For calling from #invoke.
if(args[1]andargs[1]~='')then
casid=args[1]
else
casid="000-00-0"
end
returnp.check_CAS(casid)
end
functionput_elements(element_name,count)
body=''
ifelement._element_symbol==nilthenelement=require('Module:Element')end
localcheck_group=mw.ustring.gsub(element_name,"< quan năng cơ />","")
ifelement_name~=check_groupthen
if(tonumber(count)~=nilandtonumber(count)>1)then
body=body..'('..check_group..')'.."<sub>"..tostring(count).."</sub>"
elsebody=body..check_groupend
else
localnumber=1iftonumber(count)~=nilthennumber=tonumber(count)end
if(linkandlink~=''orlink=='nolink')then
body=body..element._element_symbol({element_name,number})
else
body=body..element._elementlink({element_name,number})
end
end
returnbody
end
functionp._formula(args)
localbody=''
if(args['link']andargs['link']~='')thenlink=args['link']end
last=''
ifelement._element_symbol==nilthenelement=require('Module:Element')end
forv,xinipairs(args)do
number=tonumber(x)
lastn=tonumber(last)
if(number)then
if((not(lastn))andlast~='')then
body=body..put_elements(last,x)
elseif(body==''andlast=='')then
body=x..body
elseif(lastn)then
if(number==1)then
body=body..'<sup>+</sup>'
elseif(number==-1)then
body=body..'<sup>-</sup>'
elseif(number>0)then
body=body..'<sup>'..number..'+</sup>'
elseif(number<0)then
body=body..'<sup>'..-number..'−</sup>'
endendendend
endendend
else
if((not(lastn))andlast~='')then
body=body..put_elements(last,1)
end
end
last=x
end
lastn=tonumber(last)
if((not(lastn))andlast~='')then
body=body..put_elements(last,1)
end
if(linkandlink~=''orlink=='nolink')then
if(link~='#'andlink~='nolink')then
body='[['..link..'|'..body..']]'
end
end
returnbody
end
functionp._reaction(args)
localbody=''
last=''
ifelement._elementlink==nilthenelement=require('Module:Element')end
forv,xinipairs(args)do
number=tonumber(x)
lastn=tonumber(last)
localcheck_text=mw.ustring.gsub(last,"< văn tự />","")
if(number)then
if((not(lastn))andlast~='')then
feq=''
if(number>1)thenfeq=feq..numberend
if(last=='+')then
body=body..' + '..feq
elseif(last=='eq'orlast=='→')then
body=body..' → '..feq
elseif(last=='↑')then
body=body..'↑ '..feq
elseif(last=='↓')then
body=body..'↓ '..feq
elseif(last=='eqm')then
body=body..' [[File:Equilibrium.svg|15px| hóa học bình hành phù hào ]] '..feq
elseif(last~=check_text)then
body=body..check_text..feq
else
body=body..put_elements(last,x)
end
elseif(body==''andlast=='')then
body=x..body
elseif(lastn)then
if(number==1)then
body=body..'<sup>+</sup>'
elseif(number==-1)then
body=body..'<sup>-</sup>'
elseif(number>0)then
body=body..'<sup>'..number..'+</sup>'
elseif(number<0)then
body=body..'<sup>'..-number..'−</sup>'
end
else
body=last..x..body
endendend
else
if((not(lastn))andlast~='')then
if(last=='+')then
body=body..' + '
elseif(last=='eq'orlast=='→')then
body=body..' → '
elseif(last=='↑')then
body=body..'↑ '
elseif(last=='↓')then
body=body..'↓ '
elseif(last=='eqm')then
body=body..' [[File:Equilibrium.svg|15px| hóa học bình hành phù hào ]] '
elseif(last~=check_text)then
body=body..check_text
else
body=body..put_elements(last,1)
end
end
end
last=x
end
lastn=tonumber(last)
if((not(lastn))andlast~='')then
localcheck_text=mw.ustring.gsub(last,"< văn tự />","")
if(last=='+')then
body=body..' + '
elseif(last=='eq'orlast=='→')then
body=body..' → '
elseif(last=='↑')then
body=body..'↑ '
elseif(last=='↓')then
body=body..'↓ '
elseif(last=='eqm')then
body=body..' [[File:Equilibrium.svg|15px| hóa học bình hành phù hào ]] '
elseif(last~=check_text)then
body=body..check_text
else
body=body..put_elements(last,1)
end
end
returnbody
end
-- bổn mô khối đích sa hạp ( trắc thí ) hàm sổ
functionp.sandbox(frame)
-- For calling from #invoke.
localargs
ifframe==mw.getCurrentFrame()then
-- We're being called via #invoke. The args are passed through to the module
-- from the template page, so use the args that were passed into the template.
iflib_arg.getArgs==nilthenlib_arg=require('Module:Arguments')end
args=lib_arg.getArgs(frame)--frame.args
else
-- We're being called from another module or from the debug console, so assume
-- the args are passed in directly.
args=frame
end
returnp._reaction(args)
end
functionp._sandbox(args)
ifelement.getListID==nilthenelement=require('Module:Element')end
ifelement_data[1]==nilthenelement_data=mw.loadData('Module:Element/data')end
returnelement_data[element.getListID(args[1])].name
end
returnp