This is the template test cases page for the sandbox of Template:Chem2. to update the examples. If there are many examples of a complicated template, later ones may break due to limits in MediaWiki; see the HTML comment "NewPP limit report" in the rendered page. You can also use Special:ExpandTemplates to examine the results of template uses. You can test how this page looks in the different skins and parsers with these links: |
Proposal: add parameter checks
edit- -12:26, 6 March 2023 (UTC)
- Waiting for Template talk:Chem2 § Must preserve minus signs in subscripts to be finished -DePiep (talk) 09:24, 28 February 2023 (UTC)
- See talk Template talk:Chem2 § Proposal: add parameter checks
- Prepared in {{Chem2/sandbox2}}. -DePiep (talk) 09:24, 28 February 2023 (UTC)
- Tests (also by Preview)
- Example, by /sandbox2:
{{chem2/sandbox2|foo=H2O|1=A_{x}H_{1-x}}}
- → AxH_{−1x}
- to check (negative check expected): "A{B{Q}" -- error all right, but for other reason (unbalanced, & end-bracket). Effect is OK.
- → A{B{Q}
- → A{B
- pattern: ><
subscript hyphen (Feb 2023)
edit- {{Chem2/sandbox}} initially: now has Module:Chem2/sandbox (from live source code).
- Template styles: Module:Chem2/styles.css (Chem2/sandbox/styles.css diff)
- Bug reproduction:
- (A) code:
{{chem2|A_{''x''}H_{1-''x''}|}}
→ AxH1−x (current live result) - Hardcoded result from expanded live template (19:36, 27 February 2023): AxH1-x
- (B, {chem2/sandbox} live): AxH1−x
- Characters involved:
- (H) U+002D - HYPHEN-MINUS → AxH1−x
- (M) U+2212 − MINUS SIGN (−) → AxM1−x
- (A) code:
- Done /sandbox: L239, % not \ (tot test; errors from live code?)
- L250, L251
- what's with \s, \-
- whatwhen entering − ?
tests
edit- tst setup:
{{chem2|1=A^{1-''y''}B_{1-''x''}H|2=}}
(H, M) - test minus M>−< vs, hyphen H>-<:
- live, in:H>-<: A1−yB1−xH2−
- /sbx, in:H>-<: A1−yB1−xH2−
- live, in:M>−<: A1−yB1−xM2−
- /sbx, in:M>−<: A1−yB1−xM2−
- All sup/sub returns (8) are U+002d hyphen
- All (4) 2- charge returnsa are U+2212
- -DePiep (talk) 20:36, 27 February 2023 (UTC)
- tst setup:
- Entering
−
- live, in:>−<: A1−yB1−xM2− -- incidentally, returns as expected ..
- /sbx, in:>−<: A1−yB1−xM2−
- Entering
β
- live, in:>β<: A1βyB1βxM(2β)
- /sbx, in:>β<: A1βyB1βxM(2β)
- lol from doc: use \s, \-
- live, in:H>\-<: A1\−yB1\−xH(2-)
- /sbx, in:H>\-<: A1\−yB1\−xH(2-)
- live, in:M>\s<: A1\syB1\sxM(2−)
- /sbx, in:M>\s<: A1\syB1\sxM(2−)
talk: Must preserve minus signs in subscripts
edittalk: debugging & tests
edit- see /testcases at § subscript hyphen (Feb 2023)
- More research:
- Test string to be (rule: when final-} in formula input, end pipe }|}} is required):
- (A)
{{chem2|A_{''x''}H_{1-''x''}|}}
→ AxH1−x - Characters involved:
- (H) U+002D - HYPHEN-MINUS → AxH1−x
- (M) U+2212 − MINUS SIGN (−) → AxM1−x
- re MSGJ: by reading the code, none of the lines 277 (good replacement), 288 (good replacement), 294 (hyphen only) seem to make the wrong replacement.
- -DePiep (talk) 19:02, 27 February 2023 (UTC)
- code review:
- L239 (current live):
if not x then x = f:match('^\^{[^}]*}', i); t = T_CARET; end -- ^{...}
- L239 (current live):
^\^{[^}]*}
? expected^^{[^}]*}
(Lua pattern not regex; module preview reports Error: [239:42] invalid escape sequence near '\^'. (Errors from this, missed? hidden?) edited in sandboxDePiep (talk) 19:57, 27 February 2023 (UTC)
- code review:
- test code to be:
talk: Bug report
edit- See /testcases at § subscript hyphen (Feb 2023). module:Chem2, current live code.
- (H) U+002D - HYPHEN-MINUS
- (M) U+2212 − MINUS SIGN (−)
From original report (OP); B2-B
(demo/test inline) and (4-)
(charge) added as extra testcases (situations 1–4 now).
- In the tests here,
B2-B
is added and is not targeted (no changes claimed nor expected; ignored in conclsions){{chem2|1=HA^{''1-x''}B2-B_{3-''x''}(4-)}}
{{chem2|1=HA^{1-x}B2-B_{3-x}(4-)}}
- in H>-<: HA1−xB−2B3−x4− -- MINUS expected
- in M>−<: MA1−xB−2B3−x4− -- MINUS expected
- (A) Original complaint
- MINUS (−) not kept when in (topically correct) sub/supscripted formula is entered; shows hyphen (-) instead.
- Cause: {{Chem2}} early replaces NDASH and MINUS with HYPHEN, to be treatred similar (see code L250, 251).
- When as charge, the hyphen is changed into MINUS all right, but no such replacement in the supsubscripts.
- Proposed solution: in T_CARET and T_UNDERSCORE change any hyphen (from early replacement) into MINUS [1].
- live, in:H>-<: HA1−xB−2B3−x4−
- /sbx, in:H>-<: HA1−xB−2B3−x4−
- live, in:M>−<: MA1−xB−2B3−x4−
- /sbx, in:M>−<: MA1−xB−2B3−x4−
- Showing: current live version returns HYPHEN in subsuptexts; correct MINUS inline and in the "(2-)" charge). All irrespective of input character.
- (B) Handling of HTML entities (−)
- When entering like
−
(for character MINUS), it is not handled as the character. - Incidentally, this preserves the MINUS character as asked for in the OP (undocumented 'solution', hack).
- However, not documented and would give different results between input
−
vs.−
. Also, other codes entries could be affected. - Proposed solution: add early decoding
mw.text.decode()
[2].
- Entering HTML Entity
−
- live, in:>−<: EA1−xB−2B3−x4− -- incidentally, returns as expected
- /sbx, in:>−<: EA1−xB−2B3−x4−
- Entering
β
- live, in:>β<: EA1βxB2βB3βx(4β) -- as expected :/sbx, in:>β<: EA1βxB2βB3βx(4β) -- same result (returns decoded β to UA: decoded later)
- (C) Bad code
L239: if not x then x = f:match('^\^{[^}]*}', i); t = T_CARET; end -- ^{...}
- Parser gives error:
'^\^{[^}]*}'
has incorrect "\" (note: expected is Lua pattern not Regex). Saves with error (-warning). - No error effects (in pages) known, nor seen in testpage.
- From Lua documentation mw:Lua manual: "At other positions, '^' and '$' have no special meaning and represent themselves". That is: the second caret should represent the input character (to indicate superscript).
- Proposed solution: Remove the slash: [3]. No effects in tests seen.
- Testcases: see superscripts (CARET input) throughout.
- Late note 29 March 2023, from mw:Lua_reference_manual § string: the code
\^
is not required to escape the literal character in Lua code (as opposed to e.g.,\"
). -DePiep (talk) 05:04, 29 March 2023 (UTC)
- Late note 29 March 2023, from mw:Lua_reference_manual § string: the code
- (D) Escape codes limitations
- The /documentation mentions
\s
,\-
for input "single bond" (topical term) and "hyphen" when used in line. However, they don't work as expected when in sup/subscripted text (as in OP). - Proposed solution: the escape codes are not developed to function more widely. Instead, documentation to be improved (mention limitations).
- From doc: use
\s, \-
slashed escape code (note: "B2-B" as expected)
- live, in:>\s<: SsA1\sxB2−B3\sx(4−)
- /sbx, in:>\s<: SsA1\sxB2−B3\sx(4−)
- live, in:>\-<: ShA1\−B2-B3\−x(4-)
- /sbx, in:>\-<: ShA1\−B2-B3\−x(4-)
- -DePiep (talk) 00:06, 28 February 2023 (UTC)
(T) more tests: bare hyphen: input without no preceding number etc in text element (eg, charge "(-)"):
- HA−x−B−x−
- HA−x−B−x−
- MA−x−B−x−
- MA−x−B−x−
- EA−x−B−x− -- −
- EA−x−B−x−
- Adjustmensts, refining testcases, spell uc MINUS etc, create 4 numberred testsituations DePiep 05:41, 28 February 2023
- For more bare "-" input tests (not "2-" &tc;), see /testcases (UTC), -DePiep (talk) 06:36, 28 February 2023 (UTC)
(T2) added in /testcases
edit(T2) more bare tests FWIW: rm italice, (), use \s \-
- live
- HA−x−B−x−
- MA−x−B−x−
- SsA\sx−B\sx−
- ShA\−x-B\−x-
- SsA\sx−B\sx(−)
- ShA\−x-B\−x(-)
- /sbox
- HA−x−B−x−
- MA−x−B−x−
- SsA\sx−B\sx−
- ShA\−x-B\−x-
- SsA\sx−B\sx(−)
- ShA\−x-B\−x(-)
Proposal (code edit)
edit- From the Report above, I propose to oconsider: edit all code from module:Chem2/sandbox into module:Chem2 (diff).
- Note: the (B) may change behaviour (instances relying on undocumented effects). Conservation action needed? OTOH, when entering −, what else should be expected than MINUS?
- Also, I'd like to have chemicist eyes taking a look.
- More tests at the Template:Chem2/testcases.
- -DePiep (talk) 00:06, 28 February 2023 (UTC)
- ping|Christian75|Mikhail Ryazanov|MSGJ demos and tests stable & ok now, please take a look. -DePiep (talk) 06:41, 28 February 2023 (UTC)
doc input-code table (Feb 2023)
editFormula punctuation (Chem2 live)
editSymbol | Gives | Example | Output |
---|---|---|---|
\s |
− | {{chem2|CH3\sCH3}} |
CH3−CH3 |
\d |
= | {{chem2|CH2\dCH2}} |
CH2=CH2 |
\t |
≡ | {{chem2|HC\tCH}} |
HC≡CH |
\q |
≣ | {{chem2|[Cl4Re\qReCl4](2−)|}} |
[Cl4Re≣ReCl4]2− |
\- |
- | {{chem2|A\-B}} |
A-B |
\\ |
\ | {{chem2|C\\D}} |
C\D |
\h |
η | {{chem2|\h}} |
η |
\h{1} |
η1- | {{chem2|\h{1} |}} |
η1- |
\m{1} |
μ1- | {{chem2|\m{1} |}} |
μ1- |
-> |
→ | {{chem2|2H2 + O2 -> 2H2O}} |
2H2 + O2 → 2H2O |
<-> |
⇌ | {{chem2|K<->L}} |
K ⇌ L |
* |
· | {{chem2|CoCl2*6H2O}} |
CoCl2·6H2O |
\* |
* | {{chem2|Cp\*2Fe}} |
Cp*2Fe |
_{} |
subscript | {{chem2|CH4_{(g)} |}} * |
CH4(g) |
^{} |
superscript | {{chem2|^{13}CH4}} |
13CH4 |
∇ |
∇ | {{chem2|∇}} |
∇ |
( ) |
( ) | {{chem2|R\sCH(OH)CN}} |
R−CH(OH)CN |
^ If the last character of the template input is }
, MediaWiki will confuse it with the end-of-template tag }}
. Adding a space between the two resolves this ambiguity. Other options include instead inserting {{null}}
or <nowiki/>
.
Formula punctuation (Chem2/sandbox)
editSymbol | Gives | Example | Output |
---|---|---|---|
\s |
− | {{chem2/sandbox|CH3\sCH3}} |
CH3−CH3 |
\d |
= | {{chem2/sandbox|CH2\dCH2}} |
CH2=CH2 |
\t |
≡ | {{chem2/sandbox|HC\tCH}} |
HC≡CH |
\q |
≣ | {{chem2/sandbox|[Cl4Re\qReCl4](2−)}} |
[Cl4Re≣ReCl4]2− |
\- |
- | {{chem2/sandbox|A\-B}} |
A-B |
\\ |
\ | {{chem2/sandbox|C\\D}} |
C\D |
\h |
η | {{chem2/sandbox|\h}} |
η |
\h{1} |
η1- | {{chem2/sandbox|\h{1} |}} |
η1- |
\m{1} |
μ1- | {{chem2/sandbox|\m{1} |}} |
μ1- |
-> |
→ | {{chem2/sandbox|2H2 + O2 -> 2H2O}} |
2H2 + O2 → 2H2O |
<-> |
⇌ | {{chem2/sandbox|K<->L}} |
K ⇌ L |
* |
· | {{chem2/sandbox|CoCl2*6H2O}} |
CoCl2·6H2O |
\* |
* | {{chem2/sandbox|Cp\*2Fe}} |
Cp*2Fe |
_{} |
subscript | {{chem2/sandbox|CH4_{(g)} |}} * |
CH4(g) |
^{} |
superscript | {{chem2/sandbox|^{13}CH4}} |
13CH4 |
∇ |
∇ | {{chem2/sandbox|∇}} |
∇ |
( ) |
( ) | {{chem2/sandbox|R\sCH(OH)CN}} |
R−CH(OH)CN |
^ If the last character of the template input is }
, MediaWiki will confuse it with the end-of-template tag }}
. Adding a space between the two resolves this ambiguity. Other options include instead inserting {{null}}
or <nowiki/>
.
from Doc
edit- {{Chems}}
Symbol | Gives | Example | Output |
---|---|---|---|
\s |
− | {{chem2|CH3\sCH3}} |
CH3−CH3 |
\d |
= | {{chem2|CH2\dCH2}} |
CH2=CH2 |
\t |
≡ | {{chem2|HC\tCH}} |
HC≡CH |
\q |
≣ | {{chem2|[Cl4Re\qReCl4](2−)|}} |
[Cl4Re≣ReCl4]2− |
\- |
- | ||
\\ |
\ | ||
\h |
η | ||
\h{1} |
η1- | ||
\m{1} |
μ1- | ||
-> |
→ | {{chem2|2H2 + O2 -> 2H2O}} |
2H2 + O2 → 2H2O |
<-> |
⇌ | ||
* |
· | {{chem2|CoCl2*6H2O}} |
CoCl2·6H2O |
\* |
* | {{chem2|Cp\*2Fe}} |
Cp*2Fe |
_{} |
{{chem2|CH4_{(g)}|}} * |
CH4(g) | |
^{} |
{{chem2|^{13}CH4}} |
13CH4 | |
∇ |
∇ | {{chem2|∇}} |
∇ |
^ If the last character of the template input is }
, MediaWiki will confuse it with the end-of-template tag }}
. Adding |
between the two resolves this ambiguity. Other options include instead inserting
(space), {{null}}
or <nowiki/>
.
Formulas (without charge) are just written. Eg.:
{{chem2|CH3(CH2)5CH3}}
gives CH3(CH2)5CH3{{chem2|Fe3S2(CO)9}}
gives Fe3S2(CO)9{{chem2|C_{''n''}H_{2''n''+2}|}}
gives CnH2n+2
Charges are written inside parenthesis, otherwise its treated as +1 or −1, e.g.:
{{chem2|Na+}}
gives Na+{{chem2|O2-}}
gives O−2 but can be written as{{chem2|O2(-)}}
too.{{chem2|SO4(2-)}}
gives SO2−4{{chem2|S19(2+)}}
gives S2+19
Chemical equations can be written too. E.g.:
{{chem2|2 S + 3 O2 + 2 H2O -> 2 H2SO4}}
gives 2 S + 3 O2 + 2 H2O → 2 H2SO4{{chem2|2S + 3O2 + 2H2O -> 2H2SO4}}
gives 2S + 3O2 + 2H2O → 2H2SO4
The arrows can be written as ->
or just →
. All characters (and unicode markup) are valid input except \
, = (Mediawiki use it), _
and -
(endash etc.)
{{chem2|2 H2_{(g)} + O2_{(g)} -> 2H2O_{(g)}|}}
gives 2 H2(g) + O2(g) → 2H2O(g){{chem2|NH2RCHCO2H <-> NH3+RCHCO2-}}
gives NH2RCHCO2H ⇌ NH+3RCHCO−2
Hapticity and mu:
{{chem2|W(CO)3(PiPr3)2(\h{2}\-H2)}}
gives W(CO)3(PiPr3)2(η2--H2){{chem2|auto=yes|W(CO)3(PiPr3)2(\h{2}\-H2)}}
gives W(CO)3(PiPr3)2(η2--H2)
Links: Use link=
<wiki page> or ordinary wiki link ([[
and ]]
), e.g.:
{{chem2|link=Iron(III) chloride|FeCl3}}
gives FeCl3{{chem2|3[[hydrogen|H2]] + 2[[nitrogen|N2]] <-> 2[[ammonia|NH3]]}}
gives 3H2 + 2N2 ⇌ 2NH3
Auto links: Automatic link elements: Use auto=
<something> (e.g. yes
):
All /sandbox
edit- {{Chems/sandbox}}
Symbol | Gives | Example | Output |
---|---|---|---|
\s |
− | {{chem2/sandbox|CH3\sCH3}} |
CH3−CH3 |
\d |
= | {{chem2/sandbox|CH2\dCH2}} |
CH2=CH2 |
\t |
≡ | {{chem2/sandbox|HC\tCH}} |
HC≡CH |
\q |
≣ | {{chem2/sandbox|[Cl4Re\qReCl4](2−)|}} |
[Cl4Re≣ReCl4]2− |
\- |
- | ||
\\ |
\ | ||
\h |
η | ||
\h{1} |
η1- | ||
\m{1} |
μ1- | ||
-> |
→ | {{chem2/sandbox|2H2 + O2 -> 2H2O}} |
2H2 + O2 → 2H2O |
<-> |
⇌ | ||
* |
· | {{chem2/sandbox|CoCl2*6H2O}} |
CoCl2·6H2O |
\* |
* | {{chem2/sandbox|Cp\*2Fe}} |
Cp*2Fe |
_{} |
{{chem2/sandbox|CH4_{(g)}|}} * |
CH4(g) | |
^{} |
{{chem2/sandbox|^{13}CH4}} |
13CH4 | |
∇ |
∇ | {{chem2/sandbox|∇}} |
∇ |
^ If the last character of the template input is }
, MediaWiki will confuse it with the end-of-template tag }}
. Adding |
between the two resolves this ambiguity. Other options include instead inserting
(space), {{null}}
or <nowiki/>
.
/doc
edit- using /sandbox
/doc Formula punctuation
editSymbol | Gives | Example | Output |
---|---|---|---|
\s |
− | {{chem2|CH3\sCH3}} |
CH3−CH3 |
\d |
= | {{chem2|CH2\dCH2}} |
CH2=CH2 |
\t |
≡ | {{chem2|HC\tCH}} |
HC≡CH |
\q |
≣ | {{chem2|[Cl4Re\qReCl4](2−)}} |
[Cl4Re≣ReCl4]2− |
\- |
- | {{chem2|A\-B}} |
A-B |
\\ |
\ | {{chem2|C\\D}} |
C\D |
\h |
η | {{chem2|\h}} |
η |
\h{1} |
η1- | {{chem2|\h{1} |}} |
η1- |
\m{1} |
μ1- | {{chem2|\m{1} |}} |
μ1- |
-> |
→ | {{chem2|2H2 + O2 -> 2H2O}} |
2H2 + O2 → 2H2O |
<-> |
⇌ | {{chem2|K<->L}} |
K ⇌ L |
* |
· | {{chem2|CoCl2*6H2O}} |
CoCl2·6H2O |
\* |
* | {{chem2|Cp\*2Fe}} |
Cp*2Fe |
_{} |
subscript | {{chem2|CH4_{(g)} |}} * |
CH4(g) |
^{} |
superscript | {{chem2|^{13}CH4}} |
13CH4 |
∇ |
∇ | {{chem2|∇}} |
∇ |
( ) |
( ) | {{chem2|R\sCH(OH)CN}} |
R−CH(OH)CN |
^ If the last character of the template input is }
, MediaWiki will confuse it with the end-of-template tag }}
. Adding a space between the two resolves this ambiguity. Other options include instead inserting {{null}}
or <nowiki/>
.
/doc Formulas, charges, equations
editFormulas (without charge) are just written:
{{chem2|CH3(CH2)5CH3}}
→ CH3(CH2)5CH3{{chem2|Fe3S2(CO)9}}
→ Fe3S2(CO)9{{chem2|C_{''n''}H_{2''n''+2}|}}
→ CnH2n+2
Charges are written inside parentheses:
{{chem2|SO4(2-)}}
→ SO2−4{{chem2|S19(2+)}}
→ S2+19
Charges +1 and −1 can be written plain:
{{chem2|Na+}}
→ Na+{{chem2|O2-}}
→ O−2
- equals
{{chem2|O2(-)}}
Chemical equations:
{{chem2|2 S + 3 O2 + 2 H2O -> 2 H2SO4}}
→ 2 S + 3 O2 + 2 H2O → 2 H2SO4{{chem2|2S + 3O2 + 2H2O -> 2H2SO4}}
→ 2S + 3O2 + 2H2O → 2H2SO4
The arrows can be written as ->
or just →
. All characters (and unicode markup) are valid input except \
, = (Mediawiki use it), _
and -
(endash etc.)
{{chem2|2 H2_{(g)} + O2_{(g)} -> 2H2O_{(g)}|}}
→ 2 H2(g) + O2(g) → 2H2O(g){{chem2|NH2RCHCO2H <-> NH3+RCHCO2-}}
→ NH2RCHCO2H ⇌ NH+3RCHCO−2
Hapticity and mu:
{{chem2|W(CO)3(PiPr3)2(\h{2}H2)}}
→ W(CO)3(PiPr3)2(η2-H2){{chem2|auto=yes|W(CO)3(PiPr3)2(\h{2}H2)}}
→ W(CO)3(PiPr3)2(η2-H2)
/doc Wikilinks
edit/doc Whole formula link
editLink the whole formula with |link=<wiki pagename>
:
{{chem2|FeCl3|link=Iron(III) chloride}}
→ FeCl3
Or use wikilink brackets in input like [[ammonia|NH3]]
:
/doc Link each element (C, Hg) and generic element code (R, X)
edit- Use
|auto=yes
to link each element symbol once, as well as some others such as Ph
/doc Link functional groups
editSome common groups are recognized and linked if you wikilink them using [[ ]]
{{chem2|R\-[[COOH]]}}
→ R-COOH{{chem2|[[CH3]]C[[R]]2[[I]]}}
→ CH3CR2I- In particular H2O links to water of crystallization in
{{chem2|CuSO4 * 5 [[H2O]]}}
→ CuSO4 · 5 H2O, because a link to water is generally unnecessary.
You can link to any article even if chem2 is unaware of it:!-- same as |link=... then -->
{{chem2|[[C6H5NH2]]}}
→ C6H5NH2
To change the default link:
{{chem2|[[water|H2O]]}}
→ H2O
/doc All recognised symbols and codes
edit/doc Examples
edit{{chem2|[Cl4Re\qReCl4](2−)|}}
gives [Cl4Re≣ReCl4]2−{{chem2|[Cl4Re\qReCl4](2-)|}}
gives [Cl4Re≣ReCl4]2−{{chem2|NH2RCHCO2H <-> NH3+RCHCO2−}}
gives NH2RCHCO2H ⇌ NH+3RCHCO−2
{{chem2|\\hallo}}
gives \hallo{{chem2|H3CC\tCH <-> H2C\dC\dCH2}}
gives H3CC≡CH ⇌ H2C=C=CH2{{chem2|4 NH3 + 5 O2 -> 4 NO + 6 H2O}}
gives 4 NH3 + 5 O2 → 4 NO + 6 H2O
- "H2O → H2O" is H2O → H2O
- "H2O_{(l)} -> H2O_{(g)}" is H2O(l) → H2O(g)
- "4 NH3 + 5 O2 → 4 NO + 6 H2O" is 4 NH3 + 5 O2 → 4 NO + 6 H2O
- " 4 NH3 + 5 O2 → 4 NO + 6 H2O" is 4 NH3 + 5 O2 → 4 NO + 6 H2O
- " 4NH3 + 5O2 → 4NO + 6H2O" is 4NH3 + 5O2 → 4NO + 6H2O
- " 2Mn2(+)" is 2Mn+2
- " 2Mn2(+) + 3H2O" is 2Mn+2 + 3H2O
- Mn– is Mn−
- Mn2(2-) is Mn2−2
- Mn2☃+ is Mn2☃+, Mn2(2–) is Mn2−2, Mn2(2☃–) is Mn2(2☃−)
- Mn2(+) is Mn+2
- Mn2+ is Mn+2
- Mn2(-) is Mn−2
- Mn2- is Mn−2
- {{chem2|C_{''n''}H_{2''n'' + 2}|}} gives CnH2n + 2
- {{chem2|C_{abc}|}} gives Cabc
- (chem gives C
nH
2n + 2) - {{chem2|CoCl2*1.5H2O}} gives CoCl2·1.5H2O
- Mn22– is Mn−22
- Cu2C2*H2O is Cu2C2·H2O
- Special
- {{chem2|[Me2Al(\m{2}Me)]2}} gives [Me2Al(μ2-Me)]2
- {{chem2|^{13}CO2}} gives 13CO2
- {{chem2|auto=yes|^{13}CO2}} gives 13CO2
- {{chem2|\h{5}(C5H5)2TiCl2}} gives η5-(C5H5)2TiCl2
- {{chem2|\h{5}\s(C5H5)}} gives η5-−(C5H5)
- {{chem2|CH2\dCH2\sCH2\sC\tCH\qMn}} is CH2=CH2−CH2−C≡CH≣Mn
- {{chem2|RC(OR’)3}} gives RC(OR’)3
- {{chem2|C\\C}} gives C\C
- {{chem2|C2*NH3}} gives C2·NH3
- {{chem2|C2*2NH3}} gives C2·2NH3
- {{chem2|C1.2H3.5}} gives C1.2H3.5
- {{chem2|12|6|C}} is 12
- {{chem2|12|C}} is 12
- {{chem2|CH3\i{13}CH2CH3}} is CH3CH2CH3
- {{chem2|\{\{abc\}\}}} is AbC
- C2(μ\-C) is C2(μ-C)
- SO4(2-) is SO2−4
- 2Mn2(2+) is 2Mn2+2
- CH3-CH2-OH is CH−3CH−2OH
- [ZnCl4]- is [ZnCl4]−
- [ZnCl4](2-) is [ZnCl4]2−
- AUTO: ((H2O)5{CoCl2})2 is ((H2O)5{CoCl2})2
- Si(OH)4 is Si(OH)4
- AUTO: Cu2C2*H2O is Cu2C2·H2O
- Cu2C2*2H2O is Cu2C2·2H2O
- CuSO*2H2O is CuSO·2H2O
- CuSO4*15H2O is CuSO4·15H2O
- CuSO4(H2O)5 is CuSO4(H2O)5
- H+ + OH- → H2O is H+ + OH− → H2O
- H → O is H → O
- ZxPo4 is ZxPo4 Unknown element.
- ((Na)Cl is ((Na)Cl Too many "(".
- Si(OH))4 is Si(OH))4 Too many ")".
- Si&☃Si is Si&☃Si
- CH2=CH2
/doc More
edit- {{chem2|Cl2O6|link=dichlorine hexoxide}} is Cl2O6
- [Fe(Phen)(Phen)3](2+) is [Fe(Phen)(Phen)3]2+
- AUTO: [Fe(Phen)(Phen)3](2+) is [Fe(Phen)(Phen)3]2+
- {{chem2|[C2O2](2+)}} is [C2O2]2+
- {{chem2|link=Tomato|SI4}} is SI4
- H2SO4+ is H2SO+4
- Mn- is Mn−
- Mn22+ is Mn+22, Mn22- is Mn−22,
- Mn(2+) is Mn2+
- Mn2(+) is Mn+2
- Mn(22-) is Mn22−
- Mn3(22-) is Mn22−3
- Mn(22+) is Mn22+
- Mn2(22+) is Mn22+2
- Mn2(2+) is Mn2+2
- Mn22(2+) is Mn2+22
Predefined codes (groups etc.)
editPredefined codes | ||||
---|---|---|---|---|
code | target article | {{Chem2|code}}
|
type | note |
A. Groups etc with element-like names | ||||
Bz | Benzoyl group | Bz | A: wl |auto=yes
|
|
Et | Ethyl group | Et | A: wl |auto=yes
|
|
Ln | Lanthanide | Ln | A: wl |auto=yes
|
|
Nu | Nucleophile | Nu | A: wl |auto=yes
|
|
Ph | Phenyl group | Ph | A: wl |auto=yes
|
|
R | Substituent | R | A: wl |auto=yes
|
|
T | Tritium | T | A: wl |auto=yes
|
|
Tf | Trifluoromethylsulfonyl group | Tf | A: wl |auto=yes
|
|
X | Halogen | X | A: wl |auto=yes
|
|
B. Groups which are redirected from their normal target if wikilinked; never autolinked. | ||||
CH3 | Methyl group | CH3 | B: wl |..[[code]]..
|
|
CO3 | Carbonate | CO3 | B: wl |..[[code]]..
|
|
COOH | Carboxyl group | COOH | B: wl |..[[code]]..
|
|
ClO | Hypochlorite | ClO | B: wl |..[[code]]..
|
|
ClO2 | Chlorite | ClO2 | B: wl |..[[code]]..
|
|
ClO3 | Chlorate | ClO3 | B: wl |..[[code]]..
|
|
ClO4 | Perchlorate | ClO4 | B: wl |..[[code]]..
|
|
H2O | Water of crystallization | H2O | B: wl |..[[code]]..
|
|
H3O | Hydronium | H3O | B: wl |..[[code]]..
|
|
NH2 | Amine group | NH2 | B: wl |..[[code]]..
|
|
NH4 | Ammonium | NH4 | B: wl |..[[code]]..
|
|
NO3 | Nitrate | NO3 | B: wl |..[[code]]..
|
|
PO3 | Phosphite | PO3 | B: wl |..[[code]]..
|
|
PO4 | Phosphate | PO4 | B: wl |..[[code]]..
|
|
SH | Thiol group | SH | B: wl |..[[code]]..
|
|
SO3 | Sulfite | SO3 | B: wl |..[[code]]..
|
|
SO4 | Sulfate | SO4 | B: wl |..[[code]]..
|
|
SeH | Selenol group | SeH | B: wl |..[[code]]..
|
/doc Line wrapping
editTable 1: Incnis Mrsi original post demo (extended by DMacks) | ||
---|---|---|
Incnis Mrsi's original |
sandbox (nowrap) | current live (wraps) |
DMacks's additions |
||
Table 2 | |
---|---|
C2H5 OH
|
|
C2H5 OH
|
|
C2H5 OH
|
|
Attention! It is not {{chem2}}, it is HTML. |
Automated testcases
edit{{Chem2}} | {{Chem2/sandbox}} |
---|---|
H2O | H2O |
{{Chem2}} | {{Chem2/sandbox}} |
---|---|
H | H |
{{Chem2}} | {{Chem2/sandbox}} |
---|---|
H2O | H2O |
{{Chem2}} | {{Chem2/sandbox}} |
---|---|
CH3CH2OH | CH3CH2OH |
{{Chem2}} | {{Chem2/sandbox}} |
---|---|
[Fe(Phen)(Phen)3]2+ | [Fe(Phen)(Phen)3]2+ |
{{Chem2}} | {{Chem2/sandbox}} |
---|---|
[Fe(Phen)(Phen)3]2+ | [Fe(Phen)(Phen)3]2+ |
autodoc
edit{{#invoke:chem2|_autodoc}}
→
- Adds sections:
=== Elements and element-style symbols === === Groups ===
autodoc tables
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
(start of autodoc) Elements and element-style symbolsThese may be automatically linked or used as if they were redirects.
GroupsThese must be linked manually; they work as if they were redirects.
(end of autodoc) |