Module:Infobox/Composé chimique
Apparence
[voir] [modifier] [historique] [purger]
Cette page définit un module d'infobox. Pour les conseils sur l'usage de ce module, voyez Modèle:Infobox Composé chimique.
La documentation de ce module est générée par le modèle {{Documentation module}}.
Elle est incluse depuis la page Modèle:Documentation module d'infobox. Veuillez placer les catégories sur cette page-là.
Les éditeurs peuvent travailler dans le bac à sable (créer).
Voir les statistiques d'appel depuis le wikicode sur l'outil wstat et les appels depuis d'autres modules.
local helper = require "Module:InfoboxBuilder/Helpers"
function dispNFPA704( )
local wikidata = require "Module:Wikidata"
local data
local valHealth = wikidata._formatStatements({property= 'P993'})
local valFire = wikidata._formatStatements({property= 'P994'})
local valReactivity = wikidata._formatStatements({property= 'P995'})
local valOther = wikidata._formatStatements({property= 'P877'})
res = ''
if valFire and valFire ~= '' then
if valFire == '0' then
textFire = 'Produit incombustible.'
elseif valFire == '1' then
textFire = 'Produit ne pouvant s\'enflammer qu\'après chauffage.'
elseif valFire == '2' then
textFire = 'Produit qui ne peut s\'enflammer qu\'après un chauffage modéré ou une exposition à une source de chaleur relativement élevée. Point d\'éclair compris entre 38 °C et 93 °C.'
elseif valFire == '3' then
textFire = 'Liquides et solides susceptibles de s\'enflammer à température ambiante. Point d\'éclair compris entre 38 °C et 23 °C.'
elseif valFire == '4' then
textFire = 'Produit susceptible de se vaporiser rapidement ou complètement à température et pression ambiantes, ou de se disperser dans l\'air et de s\'enflammer facilement. Point d\'éclair inférieur à 23 °C.'
else
textFire = '? [[Catégorie:Valeur Wikidata inattendue]]'
end
res = res .. '<div style="width: 75px; height: 2em; text-align: center; vertical-align: middle; position: absolute; top: 12px; font-size: large;"><span style="color: black;" title="' .. textFire .. '">' .. valFire ..'</span></div>'
end
if valHealth and valHealth ~= '' then
if valHealth == '0' then
textHealth = 'Produit non toxique, pouvant être utilisé sans précautions particulières.'
elseif valHealth == '1' then
textHealth = 'Produit pouvant provoquer après une exposition une irritation ou des séquelles mineures.'
elseif valHealth == '2' then
textHealth = 'Produit pouvant provoquer après une exposition intense ou continue (mais non chronique), une incapacité temporaire ou une séquelle mineure résiduelle.'
elseif valHealth == '3' then
textHealth = 'Produit pouvant provoquer après une exposition de courte durée, des séquelles graves temporaires ou bien des séquelles modérées résiduelles.'
elseif valHealth == '4' then
textHealth = 'Produit pouvant provoquer après une exposition de très courte durée, un décès ou des séquelles graves.'
else
textHealth = '? [[Catégorie:Valeur Wikidata inattendue]]'
end
res = res .. '<div style="width: 37.5px; height: 2em; text-align: center; vertical-align: middle; position: absolute; top: 30px; font-size: large;"><span style="color: black;" title="' .. textHealth .. '">' .. valHealth .. '</span></div>'
end
if valReactivity and valReactivity ~= '' then
if valReactivity == '0' then
textReactivity = 'Produit généralement inerte.'
elseif valReactivity == '1' then
textReactivity = 'Produit stable, mais pouvant devenir instable à température et pression élevées.'
elseif valReactivity == '2' then
textReactivity = 'Produit pouvant subir une transformation chimique violente à température et pression élevées, ou susceptible d\'exploser au contact de l\'eau, ou de former un mélange explosif avec de l\'eau.'
elseif valReactivity == '3' then
textReactivity = 'Produit pouvant détoner ou exploser, mais nécessitant une forte source d\'allumage, ou un chauffage important en milieu confiné, ou susceptible d\'exploser au contact de l\'eau, ou capable d\'exploser par un choc important.'
elseif valReactivity == '4' then
textReactivity = 'Produit pouvant détoner ou exploser à température et pression ambiantes.'
else
textFire = '? [[Catégorie:Valeur Wikidata inattendue]]'
end
res = res .. '<div style="width: 37.5px; height: 2em; text-align: center; vertical-align: middle; position: absolute; top: 30px; left: 37.5px; font-size: large;"><span style="color: black;" title="' .. textReactivity .. '">' .. valReactivity .. '</span></div>'
end
if valOther and valOther ~= '' then
res = res .. '<div style="width: 75px; height: 2em; text-align: center; vertical-align: middle; position: absolute; top: 49px; font-size: small;">' .. valOther .. '</div>'
end
if res ~= '' then
res = '<div style="position: relative; height: 85px; width: 75px;margin: 0 auto"><div style="position: absolute; height: 75px; width: 75px;">[[Image:NFPA 704.svg|75px|Symbole NFPA 704]]</div>' .. res .. '</div>'
end
return res
end
function dispSGH()
local variable = ''
return variable
end
function dispADR()
local variable = ''
return variable
end
-- Main function
styleH = helper.buildStyleTable({'background', '#EEEEEE', 'text-indent', '3px', 'text-align', 'left', 'font-weight', 'normal', 'width', '45%', 'padding', '2px 7px'})
styleH1 = helper.buildStyleTable({'background', '#EEEEEE', 'text-align', 'center', 'font-weight', 'normal'})
return {
style = helper.buildStyleTable{'float', 'right', 'width', '300', 'border', '1px solid #AAA', 'clear', 'right', 'margin', '0 0 0.5em 1em', 'word-wrap', 'break-word', 'padding', '5px'},
class = 'drugInfoBox_infobox_v2',
parts = {
helper.title_n{
type = 'title',
params = 'nom',
style = helper.buildStyleTable({'background', '#ffdead','width', '100%', 'font-size', '130%', 'line-height', '50px', 'height', '50px', 'vertical-align', 'bottom', 'text-align', 'center', 'font-weight', 'bold', 'border', '2px solid #FFFFFF'}),
},
{
type = 'images',
images = {
{
params = 'images'
}
},
legendParams = 'legende'
},
helper.table_n{
text = 'Identification',
style = helper.buildStyleTable({'width', '100%', 'font-size', '95%'}),
styleCaption = helper.buildStyleTable({'background', '#ffdead', 'border', '2px solid #FFFFFF', 'font-weight', 'bold'}),
{ helper.mixed_n{label = '[[Dénomination commune internationale|DCI]]', params = 'DCI', styleHeader = styleH},
helper.mixed_n{label = '[[Nomenclature IUPAC|Nom IUPAC]]', params = 'nomIUPAC', styleHeader = styleH},
helper.mixed_n{label = '[[Numéro CAS|N° CAS]]', params = 'CAS', property = 'p231', styleHeader = styleH},
helper.mixed_n{label = '[[Numéro EINECS|N° EINECS]]', params = 'EINECS', property = 'p232', styleHeader = styleH},
helper.mixed_n{label = '[[Numéro RTECS|N° RTECS]]', params = 'RTECS', property = 'p657', styleHeader = styleH},
helper.mixed_n{label = '[[Classification anatomique, thérapeutique et chimique|Code ATC]]', params = 'ATC', property = 'p267', styleHeader = styleH},
helper.mixed_n{label = 'DrugBank', params = 'DrugBank', property = 'p715', styleHeader = styleH},
helper.mixed_n{label = '[[PubChem]]', params = 'PubChem', class = 'external text', property = 'p662', weblink = 'http://pubchem.ncbi.nlm.nih.gov/summary/summary.cgi?cid=', styleHeader = styleH},
helper.mixed_n{label = 'ChEBI', params = 'chEBI', property = 'p683', weblink = 'http://www.ebi.ac.uk/chebi/searchId.do?chebiId=', styleHeader = styleH},
helper.mixed_n{label = '[[Additif alimentaire|N° E]]', params = 'NrE', property = 'p628', styleHeader = styleH},
helper.mixed_n{label = '[[Generally recognized as safe|FEMA]]', params = 'FEMA', styleHeader = styleH},
helper.mixed_n{label = '[[Simplified Molecular Input Line Entry Specification|SMILES]]', params = 'SMILES', property = 'p233', hidden = 1, styleHeader = styleH},
helper.mixed_n{label = 'InChI', params = 'StdInChI', property = 'p234', hidden = 1, styleHeader = styleH},
helper.mixed_n{label = 'InChIKey', params = 'StdInChIKey', property = 'p235', hidden = 1, styleHeader = styleH},
helper.mixed_n{label = 'Apparence', params = 'apparence', styleHeader = styleH}
}
},
helper.table_n{
text = 'Propriétés chimiques',
style = helper.buildStyleTable({'width', '100%', 'font-size', '95%'}),
styleCaption = helper.buildStyleTable({'background', '#ffdead', 'border', '2px solid #FFFFFF', 'font-weight', 'bold'}),
{ helper.mixed_n{label = '[[Formule brute]]', params = 'formule', property = 'p274', styleHeader = styleH},
helper.mixed_n{label = '[[Masse molaire]]', params = 'masseMol', styleHeader = styleH},
helper.mixed_n{label = '[[Constante_d\'équilibre#.C3.89quilibres_acido-basiques_:_KA.2C_KB|pKa]]', params = 'pKa', styleHeader = styleH},
helper.mixed_n{label = '[[Dipôle_électrostatique#Moment_dipolaire|Moment dipolaire]]', params = 'momentDipolaire', styleHeader = styleH},
helper.mixed_n{label = '[[Susceptibilité magnétique]]', params = 'susceptibiliteMagnetique', styleHeader = styleH},
helper.mixed_n{label = '[[Diamètre moléculaire]]', params = 'diametreMoleculaire', styleHeader = styleH},
helper.mixed_n{label = '[[Indice d’iode]]', params = 'indiceIode', styleHeader = styleH},
helper.mixed_n{label = '[[Indice d’acide]]', params = 'indiceAcide', styleHeader = styleH},
helper.mixed_n{label = '[[Indice de saponification]]', params = 'indiceSaponification', styleHeader = styleH},
}
},
helper.table_n{
text = 'Propriétées physiques',
style = helper.buildStyleTable({'width', '100%', 'font-size', '95%'}),
styleCaption = helper.buildStyleTable({'background', '#f7efa8', 'border', '2px solid #FFFFFF', 'font-weight', 'bold'}),
{ helper.mixed_n{label = '[[Température de transition vitreuse|T° transition vitreuse]]', params = 'TTransitionVitreuse', styleHeader = styleH},
helper.mixed_n{label = '[[Point de fusion|T° fusion]]', params = 'fusion', styleHeader = styleH},
helper.mixed_n{label = '[[Point d\'ébullition|T° ébullition]]', params = 'ebullition', styleHeader = styleH},
helper.mixed_n{label = '[[Solubilité]]', params = 'solubilite', styleHeader = styleH},
helper.mixed_n{label = '[[Polymère_en_solution#Approche de Hildebrand, paramètre de solubilité|Paramètre de solubilité δ]]', params = 'parametreSolubilite', styleHeader = styleH},
helper.mixed_n{label = '[[Masse volumique]]', params = 'masseVolumique', styleHeader = styleH},
helper.mixed_n{label = '[[Point d\'auto-inflammation|T° d\'auto-inflammation]]', params = 'TAutoInflammation', styleHeader = styleH},
helper.mixed_n{label = '[[Point d’éclair]]', params = 'pointEclair', styleHeader = styleH},
helper.mixed_n{label = '[[Limite d\'explosivité|Limites d’explosivité dans l’air]]', params = 'limitesExplosivite', styleHeader = styleH},
helper.mixed_n{label = '[[Pression de vapeur saturante]]', params = 'pressionVapeur', styleHeader = styleH},
helper.mixed_n{label = '[[Viscosité dynamique]]', params = 'viscosite', styleHeader = styleH},
helper.mixed_n{label = '[[Point critique (thermodynamique)|Point critique]]', params = 'pointCritique', styleHeader = styleH},
helper.mixed_n{label = '[[Point triple]]', params = 'pointTriple', styleHeader = styleH},
helper.mixed_n{label = '[[Conductivité thermique]]', params = 'conductivitéThermique', styleHeader = styleH},
helper.mixed_n{label = '[[Conductivité électrique]]', params = 'conductivitéÉlectrique', styleHeader = styleH},
helper.mixed_n{label = '[[Vitesse du son]]', params = 'vitesseSon', styleHeader = styleH}
}
},
helper.table_n{
text = 'Thermochimie',
style = helper.buildStyleTable({'width', '100%', 'font-size', '95%'}),
styleCaption = helper.buildStyleTable({'background', '#ffdead', 'border', '2px solid #FFFFFF', 'font-weight', 'bold'}),
{ helper.mixed_n{label = '[[Entropie molaire standard|S°gaz, 1 bar]]', params = 'emsGaz', styleHeader = styleH},
helper.mixed_n{label = 'S°liquide, 1 bar', params = 'emsLiquide', styleHeader = styleH},
helper.mixed_n{label = 'S°solide', params = 'emsSolide', styleHeader = styleH},
helper.mixed_n{label = '[[Enthalpie standard de formation|ΔfH°gaz]]', params = 'esfGaz', styleHeader = styleH},
helper.mixed_n{label = 'ΔfH°liquide', params = 'esfLiquide', styleHeader = styleH},
helper.mixed_n{label = 'ΔfH°solide', params = 'esfSolide', styleHeader = styleH},
helper.mixed_n{label = '[[Enthalpie de fusion]]', params = 'enthFus', styleHeader = styleH},
helper.mixed_n{label = '[[Enthalpie de vaporisation]]', params = 'enthVap', styleHeader = styleH},
helper.mixed_n{label = '[[Capacité thermique]]', params = 'capaciteTherm', styleHeader = styleH},
helper.mixed_n{label = 'PCS', params = 'PCS', styleHeader = styleH},
helper.mixed_n{label = 'PCI', params = 'PCI', styleHeader = styleH},
}
},
helper.table_n{
text = 'Précautions',
style = helper.buildStyleTable({'width', '100%', 'font-size', '95%'}),
styleCaption = helper.buildStyleTable({'background', '#FFB4B4', 'border', '2px solid #FFFFFF', 'font-weight', 'bold'}),
{ helper.doubled_n{label = '[[NFPA 704]]', params = 'NFPA704', styleHeader = styleH1, value = function() return dispNFPA704( ) end},
helper.doubled_n{label = '[[Système général harmonisé|SGH]]', params = 'SGH', styleHeader = styleH1, value = function() return dispSGH( ) end},
helper.doubled_n{label = '[[Accord européen relatif au transport international des marchandises dangereuses par route|ADR]]', params = 'transport', styleHeader = styleH1, value = function() return dispADR( ) end},
}
},
helper.table_n{
style = helper.buildStyleTable({'width', '100%', 'font-size', '95%'}),
styleCaption = helper.buildStyleTable({'background', '#ffdead', 'border', '2px solid #FFFFFF'}),
text = 'Unités du [[Système international d\'unités|SI]] et [[Atmosphère normalisée|CNTP]], sauf indication contraire.',
},
}
}