Effects of the storage conditions on the stability of natural and synthetic cannabis in biological matrices for forensic toxicology analysis: An update from the literature
Appearance
![Documentation icon](https://upload.wikimedia.org/wikipedia/commons/thumb/4/43/Test_Template_Info-Icon_-_Version_%282%29.svg/50px-Test_Template_Info-Icon_-_Version_%282%29.svg.png)
local p = {}
match_tab = {
--["^[1-9]%d? +%a+ +[1-9]%d%d%d%a?$"] ="(%d%d*)%s*(%a+)%s*((%d%d%d%d)%a?)",
["^%d %a+ %d%d%d%d$"] ="(%d) (%a+) (%d%d%d%d)",
["^%d%d %a+ %d%d%d%d$"] ="(%d%d) (%a+) (%d%d%d%d)",
['^%d %d %d%d%d%d$']= '(%d) (%d) (%d%d%d%d)',
['^%d %d%d %d%d%d%d$']= '(%d) (%d%d) (%d%d%d%d)',
['^%d%d %d %d%d%d%d$']= '(%d%d) (%d) (%d%d%d%d)',
['^%d%d %d%d %d%d%d%d$']= '(%d%d) (%d%d) (%d%d%d%d)',
['^%d%-%d%-%d%d%d%d$']= '(%d)%-(%d)%-(%d%d%d%d)',
['^%d%-%d%d%-%d%d%d%d$']= '(%d)%-(%d%d)%-(%d%d%d%d)',
['^%d%d%-%d%-%d%d%d%d$']= '(%d%d)%-(%d)%-(%d%d%d%d)',
['^%d%d%-%d%d%-%d%d%d%d$']= '(%d%d)%-(%d%d)%-(%d%d%d%d)',
}
match_tab_en = {
['^%d%d%d%d %d %d$']= '(%d%d%d%d) (%d) (%d)$',
['^%d%d%d%d %d %d%d$']= '(%d%d%d%d) (%d) (%d%d)$',
['^%d%d%d%d %d%d %d$']= '(%d%d%d%d) (%d%d) (%d)$',
['^%d%d%d%d %d%d %d%d$']= '(%d%d%d%d) (%d%d) (%d%d)$',
['^%d%d%d%d%-%d%-%d$']= '(%d%d%d%d)%-(%d)%-(%d)$',
['^%d%d%d%d%-%d%-%d%d$']= '(%d%d%d%d)%-(%d)%-(%d%d)$',
['^%d%d%d%d%-%d%d%-%d$']= '(%d%d%d%d)%-(%d%d)%-(%d)$',
['^%d%d%d%d%-%d%d%-%d%d$']= '(%d%d%d%d)%-(%d%d)%-(%d%d)$',
}
--[[
tato = {"%d" , "%d%d"}
spaces = {" " , "%-"}
for _p, space in pairs(spaces) do
for o, k1 in ipairs(tato) do
for _, k2 in ipairs(tato) do
s_k = "^" .. k1 .. space .. k2 .. space .. "%d%d%d%d$"
s_v = "(" .. k1 .. ")".. space .. "(" .. k2 .. ")".. space .. "(" .. "%d%d%d%d)"
match_tab[s_k] = s_v
--mw.log("['" .. s_k .. "']= '" .. s_v .. "'")
s_k1 = "^%d%d%d%d" .. space .. k1 .. space .. k2 .. "$"
s_v1 = "(%d%d%d%d)" .. space .. "(" .. k1 .. ")".. space .. "(" .. k2 .. ")$"
match_tab_en[s_k1] = s_v1
--mw.log("['" .. s_k1 .. "']= '" .. s_v1 .. "'")
end
end
end
]]
local function get_month_number(month)
month2 = month:lower()
local long_months = {['january']=1, ['february']=2, ['march']=3, ['april']=4, ['may']=5, ['june']=6, ['july']=7, ['august']=8, ['september']=9, ['october']=10, ['november']=11, ['december']=12,
['يناير']=1, ['فبراير']=2, ['مارس']=3, ['أبريل']=4, ['مايو']=5, ['يونيو']=6, ['يوليو']=7, ['أغسطس']=8, ['سبتمبر']=9, ['أكتوبر']=10, ['نوفمبر']=11, ['ديسمبر']=12 };
local short_months = {['jan']=1, ['feb']=2, ['mar']=3, ['apr']=4, ['may']=5, ['jun']=6, ['jul']=7, ['aug']=8, ['sep']=9, ['oct']=10, ['nov']=11, ['dec']=12};
return long_months[month2] or -- if month is the long-form name
short_months[month2] or -- if month is the short-form name
0; -- misspelled, improper case, or not a month name
end
function p.check_date (date_string)
local year;
local month=0;
local day=0;
local faild = true;
local date_string2 = date_string
local day , month , year
--match_tab_en
if string.find(date_string,"[ا|أ|ب|ت|ث|ج|ح|خ|د|ذ|ر|ز|س|ش|ص|ض|ط|ظ|ع|غ|ف|ق|ك|ل|م|ن|ه|و|ي]")
--then date_string2 = date_string
then return date_string
else
for key, v in pairs(match_tab) do
if date_string:match( key ) and faild then
faild = false
day, month, year = string.match(date_string, v );
end
end
for key, v in pairs(match_tab_en) do
if date_string:match( key ) and faild then
faild = false
year, month, day = string.match(date_string, v );
end
end
end
fa = date_string2
--if faild then
--mw.log(date_string .. " faild")
if not faild then
if month:match("%a+") then
month = get_month_number(month)
end
date_string2 = day .. "-" .. month .. "-" .. year
--mw.log("day" .. day .. ", month" .. month .. ", year" .. year)
if 12 < tonumber(month) or 31 < tonumber(month) or 1 > tonumber(month) or 1582 > tonumber(year) or 0 == tonumber(day)
then
--mw.log(date_string .. " false")
return date_string
end
--fa = '{{#time:d F Y|' .. date_string .. '}}'
fa = mw.getCurrentFrame():callParserFunction( '#time:d F Y', '' .. date_string2 .. '' )
end
--cp = "* " .. date_string .. " : \n**" .. fa
return fa
end
function p.check (frame)
return p.check_date(frame.args[1])
end
return p