Bản mẫu:GHS phrases/doc

The templates GHS phrases (/tests), H-phrases and P-phrases all format and present GHS hazard and precaution statements as defined by the UN.annex=3
The template requires one or more phrase codes as input:-  → H230-  → H230-  →  P230-  → H302  + 312 -- (Predefined combination, recognised)
Pages with errors or warnings show a Preview message. Articles are then listed in pages, pages.

**Usage**
While one can use GHS phrases stand-alone in text, more common use is in Chembox, section Chembox Hazards:

**Synonyms: HPhrases**
For ease of working in Chembox, the templates have synonyms (redirects) same as the Chembox parameter name:


**Parameters**
 The number of phrase code one can enter is practically unlimited. The codes are ordered alphanumeric.
Best practice: add prefix H or P to the number: , not .
One template call can only show one prefix set. That is, H- and  P-phrases cannot be mixed.-  (H or P) can be set to prevent ambiguity in generic GHS phrases.
For backward compatability, the code prefix "H" or "P" is not required. So  equals  → H220. However. Since GHS phrases covers both H and P, adding the prefix is better.

**Code checks added**

**Omit Rules**
 GHS phrases/list omit rules
true (default)-  → H318

**Remove Doubles**
Repeated phrase codes are removed (hidden):-  → H401

**Other functions**
 GHS phrases/inline -- inline, with full phrase text- GHS phrases/list_all -- table, by H, P- GHS phrases/number of phrases -- by H, P- GHS phrases/list omit rules -- table, documentation-  -- See List options

**List options**
 Using list, GHS phrases can be presented in various list formats:
2=abbr, inline, bulleted, unbulleted, horizontal, ordered, horizontal_ordered
 abbr (default)
listtype=abbr
 inline
listtype=inline
 bulleted
listtype=bulleted
 unbulleted
listtype=unbulleted
 horizontal
listtype=horizontal
 ordered
listtype=ordered
 horizontal_ordered
listtype=horizontal_ordered- Except for abbr, inline, these list formats are defined in :Module:List

**Errors and warnings**
Phrase codes that are unknown get an inline marker like , give a warning in preview and are categorised in GHS errors when in article space.
For example (One can see the warning when previewing this page or section):-  → H999

**Templates**

**H-phrases**
 → 241
 → H302+H312

**P-phrases**
 → P263
 → P306+P360

**GHS phrases**
  → H220-  → P220

**GHS inline**
 GHS phrases/inline lists the phrases inline, to be used in regular sentences.
 → H401
 → P501
See also List options.

**Errors and warnings**
Unknown phrase code-  → H999
Set id missing
:Set id is entered as , (default in H-phrases, P-phrases), or when setid is absent, is sought in the code list entered:  H from  → H341-  → H341
Could not find a set id-  → 302  + 312 -- (missing prefix H/P may leave undecided results (ambiguity))

**Overview**
Some settings are available to present an overview of the phrases. They are article-ready.

**Number of phrases**
  → setid=P-  → setid=H

**Complete list (table)**
GHS phrases/list_all returns a wikitable that lists all available phrase codes per prefix.
. Required.
title Optional. Default is: see Number of phrases.
collapsed Optional. Default is: uncollapsed.

**Tracking**
Help/documentation page: :Template:GHS phrases
pages
pages

**Template data**
{
	"params": {
		"1": {
			"description": "Phrase code",
			"example": "H220, P431",
			"type": "string",
			"suggested": true
		},
		"2": {},
		"3": {},
		"4": {},
		"5": {},
		"6": {},
		"7": {},
		"8": {},
		"9": {},
		"10": {},
		"setid": {
			"label": "set ID",
			"description": "Defined plain numbers to be \"H\" or \"P\"; better add prefix to number: \"H220\"",
			"type": "string",
			"suggestedvalues": 
				"H, P"
			
		},
		"omit": {
			"label": "Omit Rules",
			"description": "Apply Omit Rules like \"omit (remove) P203 when P103 is present\"",
			"example": "yes",
			"type": "boolean",
			"default": "true"
		},
		"listtype": {
			"label": "List type",
			"description": "List format of the result",
			"example": "listtype=bulleted",
			"type": "string",
			"suggestedvalues": 
				"abbr, inline, bulleted, unbulleted, horizontal, ordered, horizontal ordered"
			,
			"default": "abbr"
		}
	},
	"description": "Formats and presents predefined GHS hazard statements.",
	"paramOrder": 
		"1",
		"2",
		"3",
		"4",
		"5",
		"6",
		"7",
		"8",
		"9",
		"10",
		"setid",
		"omit",
		"listtype"
	
}

**See also**
 Main Globally Harmonized System of Classification and Labelling of Chemicals

**Development**

**Errors and warnings (newdoc)**
Errors
All errors show a preview-message in Preview.
Categorisation is in GHS errors, articles only (mainspace).- H, P,  missing- XYZ not recognised
:When entered: in GHS phrases, a setid check is enforced. Is present by default in H-phrases etc. 
:When setid is missing, any first setid in the codes-list is used. So  → H.
:This also occurs when setid=H and a P-phrase is entered.
:In certain listings, like GHS phrases/list all, a blank setid returns the full list (all H- and P-phrases). No error.
:Catsort: H, P, - Phase codes that are not in the list (like ) generate an error → error- Parameter unknown foo: catsort under U
Warnings
All warnings show a preview-message in Preview.
Categorisation in GHS warnings, articles only (mainspace).- When Omit Rules is applied, a warning is made mentioning the two involved phrase codes. Catsort=O- When Redundancy is present,  a warning is made mentioning the involved phrase code. Catsort=D

**dev links**
Subtemplates:- GHS phrases/list all- GHS phrases/inline- GHS phrases/number of phrases- GHS phrases/list omit rules -- documentation- GHS2021 -- Cite web
Source: annex=3
Chembox
Definition of phrases- :Module:GHS phrases/data- :de:Vorlage:H-Sätze, :de:Vorlage:P-Sätze

**Developments**
 Chembox- Chembox Hazards- pages- Chembox tracking categories- GHS phrases
GHSPictograms = 
GHSSignalWord = 
HPhrases      = 
PPhrases      = 
GHS_ref       = 
See also- H-phrases- P-phrases- GHS templates