polytypo 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +21 -0
  3. data/README.md +109 -0
  4. data/lib/polytypo/data/README.md +20 -0
  5. data/lib/polytypo/data/UNICODE +1 -0
  6. data/lib/polytypo/data/VERSION +1 -0
  7. data/lib/polytypo/data/fixtures/de-CH.json +501 -0
  8. data/lib/polytypo/data/fixtures/de-DE.json +547 -0
  9. data/lib/polytypo/data/fixtures/el.json +239 -0
  10. data/lib/polytypo/data/fixtures/en-GB.json +1274 -0
  11. data/lib/polytypo/data/fixtures/en-US.json +1807 -0
  12. data/lib/polytypo/data/fixtures/fi.json +1306 -0
  13. data/lib/polytypo/data/fixtures/fr-CA.json +268 -0
  14. data/lib/polytypo/data/fixtures/fr.json +603 -0
  15. data/lib/polytypo/data/fixtures/locale-resolution.json +209 -0
  16. data/lib/polytypo/data/fixtures/ru.json +688 -0
  17. data/lib/polytypo/data/fixtures/sv.json +1290 -0
  18. data/lib/polytypo/data/locales/de-CH.json +77 -0
  19. data/lib/polytypo/data/locales/de-DE.json +76 -0
  20. data/lib/polytypo/data/locales/el.json +90 -0
  21. data/lib/polytypo/data/locales/en-GB.json +115 -0
  22. data/lib/polytypo/data/locales/en-US.json +133 -0
  23. data/lib/polytypo/data/locales/fi.json +136 -0
  24. data/lib/polytypo/data/locales/fr-CA.json +78 -0
  25. data/lib/polytypo/data/locales/fr.json +84 -0
  26. data/lib/polytypo/data/locales/registry.json +9 -0
  27. data/lib/polytypo/data/locales/ru.json +112 -0
  28. data/lib/polytypo/data/locales/sv.json +124 -0
  29. data/lib/polytypo/data/rules/dashes.md +1238 -0
  30. data/lib/polytypo/data/rules/order.json +78 -0
  31. data/lib/polytypo/data/schema/fixtures.schema.json +79 -0
  32. data/lib/polytypo/data/schema/locale.schema.json +235 -0
  33. data/lib/polytypo/data/schema/registry.schema.json +29 -0
  34. data/lib/polytypo/data/schema/resolution.schema.json +50 -0
  35. data/lib/polytypo/engine/codepoints.rb +24 -0
  36. data/lib/polytypo/engine/edits.rb +64 -0
  37. data/lib/polytypo/engine/locale.rb +138 -0
  38. data/lib/polytypo/engine/pipeline.rb +61 -0
  39. data/lib/polytypo/engine/registry.rb +47 -0
  40. data/lib/polytypo/engine/rules/apostrophe.rb +127 -0
  41. data/lib/polytypo/engine/rules/dash_shared.rb +342 -0
  42. data/lib/polytypo/engine/rules/dashes.rb +125 -0
  43. data/lib/polytypo/engine/rules/ellipsis.rb +100 -0
  44. data/lib/polytypo/engine/rules/hyphen.rb +207 -0
  45. data/lib/polytypo/engine/rules/nbsp.rb +616 -0
  46. data/lib/polytypo/engine/rules/quote_ambiguity.rb +241 -0
  47. data/lib/polytypo/engine/rules/quotes.rb +420 -0
  48. data/lib/polytypo/engine/rules/ranges.rb +124 -0
  49. data/lib/polytypo/engine/rules/spaces.rb +232 -0
  50. data/lib/polytypo/engine/rules/symbols.rb +291 -0
  51. data/lib/polytypo/engine/rules.rb +19 -0
  52. data/lib/polytypo/engine/sentinels.rb +23 -0
  53. data/lib/polytypo/engine/unicode_util.rb +390 -0
  54. data/lib/polytypo/errors.rb +24 -0
  55. data/lib/polytypo/modes/html.rb +233 -0
  56. data/lib/polytypo/modes/markdown.rb +187 -0
  57. data/lib/polytypo/modes/parse_error.rb +19 -0
  58. data/lib/polytypo/modes/runner.rb +57 -0
  59. data/lib/polytypo/modes/spans.rb +132 -0
  60. data/lib/polytypo/version.rb +5 -0
  61. data/lib/polytypo.rb +91 -0
  62. data/polytypo.gemspec +37 -0
  63. metadata +122 -0
@@ -0,0 +1,136 @@
1
+ {
2
+ "locale": "fi",
3
+ "name": "Finnish",
4
+ "quotes": {
5
+ "primary": {
6
+ "open": "”",
7
+ "close": "”",
8
+ "innerSpace": "none"
9
+ },
10
+ "secondary": {
11
+ "open": "’",
12
+ "close": "’",
13
+ "innerSpace": "none"
14
+ },
15
+ "elisionIdioms": []
16
+ },
17
+ "dash": {
18
+ "parenthetical": "en-spaced",
19
+ "range": "en-tight"
20
+ },
21
+ "ellipsis": {
22
+ "abbreviatedAfterTerminal": false
23
+ },
24
+ "hyphen": {
25
+ "prefixes": [],
26
+ "suffixes": [],
27
+ "compounds": []
28
+ },
29
+ "nbsp": {
30
+ "beforePunctuation": [],
31
+ "narrowBeforePunctuation": [],
32
+ "afterShortWords": [],
33
+ "abbreviations": ["fil. maist."],
34
+ "beforeUnits": [
35
+ "%",
36
+ "‰",
37
+ "§",
38
+ "kg",
39
+ "g",
40
+ "mg",
41
+ "km",
42
+ "m",
43
+ "cm",
44
+ "mm",
45
+ "l",
46
+ "dl",
47
+ "cl",
48
+ "ml",
49
+ "h",
50
+ "min",
51
+ "s",
52
+ "ms",
53
+ "°C",
54
+ "kW",
55
+ "kWh"
56
+ ],
57
+ "beforeNumber": [],
58
+ "beforeWord": [],
59
+ "afterSymbols": ["§"],
60
+ "initialBinding": "none"
61
+ },
62
+ "sources": [
63
+ {
64
+ "rule": "quotes",
65
+ "cite": "Kotimaisten kielten keskus (Kotus), Kielitoimiston ohjepankki: “Lainausmerkit”",
66
+ "url": "https://kielitoimistonohjepankki.fi/ohje/lainausmerkit/",
67
+ "note": "Verbatim: “Suomenkielisessä tekstissä käytettävät kokolainausmerkit ovat kaarevat ”, ja ne ovat samanmuotoiset lainatun jakson alussa ja lopussa.” Both the opening and the closing mark are U+201D. The page notes that books and newspapers sometimes use angle marks (»…») as a design choice; the Kotus recommendation for Finnish text is ”…”."
68
+ },
69
+ {
70
+ "rule": "quotes",
71
+ "cite": "Kotimaisten kielten keskus (Kotus), Kielitoimiston ohjepankki: “Puolilainausmerkki”",
72
+ "url": "https://kielitoimistonohjepankki.fi/ohje/puolilainausmerkki/",
73
+ "note": "Verbatim: “Puolilainausmerkkiä käytetään myös lainausmerkkinä kokolainausmerkkien sisällä”, and “Suomenkielisissä teksteissä käytettävä puolilainausmerkki on ’, ei ‛ eikä '.” The page gives the Windows input sequence Alt+0146, which is U+2019, confirming the code point for both the opening and the closing secondary mark."
74
+ },
75
+ {
76
+ "rule": "dashes",
77
+ "cite": "Kotimaisten kielten keskus (Kotus), Kielitoimiston ohjepankki: “Ajatusviiva virkkeen välimerkkinä”",
78
+ "url": "https://kielitoimistonohjepankki.fi/ohje/ajatusviiva-virkkeen-valimerkkina/",
79
+ "note": "Verbatim: “Tällaisen virkkeen välimerkkinä käytetyn ajatusviivan molemmin puolin tulee välilyönti.” Hence `parenthetical: en-spaced` — Finnish uses the en dash (ajatusviiva, n-viiva), not an em dash."
80
+ },
81
+ {
82
+ "rule": "dashes",
83
+ "cite": "Kotimaisten kielten keskus (Kotus), Kielitoimiston ohjepankki: “Ajanilmaukset: aikavälit (1.1.–31.1.)”, citing standard SFS 4175",
84
+ "url": "https://kielitoimistonohjepankki.fi/ohje/ajanilmaukset-aikavalit-1-1-31-1/",
85
+ "note": "Verbatim: “Numero- ja merkkistandardi SFS 4175 suosittaa rajakohdan merkkinä lyhempää ajatusviivaa eli ns. n-viivaa”, set tight against the endpoints (ma–pe). Known exception not expressible in this schema: when the endpoints are themselves multi-word, Kotus spaces the dash (“ma 10.4. – pe 21.4.”). `range: en-tight` therefore describes the numeric case only."
86
+ },
87
+ {
88
+ "rule": "ellipsis",
89
+ "cite": "Kotimaisten kielten keskus (Kotus), Kielitoimiston ohjepankki: “Kolme pistettä”",
90
+ "url": "https://kielitoimistonohjepankki.fi/ohje/kolme-pistetta/",
91
+ "note": "`abbreviatedAfterTerminal` is false. Kotus describes the mark as three dots marking an unfinished sentence, a missing element or a continuing list; the two-dot form after `!`/`?` is a Russian convention and appears in no Kotus guidance."
92
+ },
93
+ {
94
+ "rule": "nbsp",
95
+ "cite": "Kotimaisten kielten keskus (Kotus), Kielitoimiston ohjepankki: “Prosenttimerkki (%)”",
96
+ "url": "https://kielitoimistonohjepankki.fi/ohje/prosenttimerkki/",
97
+ "note": "Finnish writes a space between the numeral and the percent sign (10,5 %), unlike English, which sets it closed up. This attests membership: `%` is a Finnish unit-like sign that follows a numeral after a space, which is what `beforeUnits` expresses. `‰` is included on the same reading."
98
+ },
99
+ {
100
+ "rule": "nbsp",
101
+ "cite": "Kotimaisten kielten keskus (Kotus), Kielitoimiston ohjepankki: “Pykälät ja pykälämerkki (§)”",
102
+ "url": "https://kielitoimistonohjepankki.fi/ohje/pykalat-ja-pykalamerkki/",
103
+ "note": "Kotus gives **three** notations as alternatives, not two: `6. §` (general language, with the ordinal full stop), `§ 6`, and `6 §` (legal language, where the ordinal stop is conventionally dropped). An earlier revision of this note named only the last two and read as though Finnish never sets the sign before the number; that was wrong. A space separates the number and the sign in all three. Because Kotus attests both orders, `§` is a member of **both** lists: `beforeUnits` covers `6 §` (N5, binds to a preceding number) and `afterSymbols` covers `§ 6` (N6, binds to a following number). The two sub-rules are disjoint by their own left/right tests, so the double membership is safe rather than contradictory. The third form, `6. §`, binds under neither — N5 requires a digit immediately before the space and there is an ordinal full stop there — which is an algorithmic gap held with the spec author, not something this file can express. Contrast Finnish with Swedish, where Språkrådet’s example is `§ 7` and only the sign-first order is attested."
104
+ },
105
+ {
106
+ "rule": "nbsp",
107
+ "cite": "Oikeusministeriö, Lainkirjoittajan opas §24.4 “Merkeistä ja taivutusmuodoista lakikielessä”",
108
+ "url": "https://lainkirjoittaja.finlex.fi/24-lakikieli/24-4/",
109
+ "note": "Second source for the legal form: statutory drafting sets `2 §` and inflects it with a colon (`3–5 §:ssä`). Corroborates the number-first notation Kotus gives, and with it `§`’s membership of `beforeUnits`."
110
+ },
111
+ {
112
+ "rule": "nbsp",
113
+ "cite": "BIPM, The International System of Units (SI), 9th ed. (2019), concise summary, “The language of science: using the SI to express the values of quantities”; Kotus, Kielitoimiston ohjepankki: “Prosenttimerkki (%)” and “Pykälät ja pykälämerkki (§)”",
114
+ "url": "https://www.bipm.org/documents/20126/41483022/SI-Brochure-9-concise-EN.pdf",
115
+ "note": "Membership claim, per nbsp.md §2.1: these tokens are units of measurement in Finnish and are written after a numeral with a space. BIPM verbatim: “A single space is always left between the number and the unit.” Kotus supplies the Finnish-specific members that SI does not cover — the percent sign takes a space (10,5 %), unlike English, and the section sign follows the number (6 §). That is the whole of what this list can express: which tokens are units. Whether the space is then made non-breaking is N5’s mechanism, fixed for every locale by the rule and not variable per locale, so no citation is owed for it. **Correction kept on the record, because it was real:** an earlier revision of this file justified the list with the sentence “Numeron ja lyhenteen väliin tulee välilyönti”, attributed to the Kotus page on numeroiden ryhmittely. That sentence is not on that page — it came from a search-engine summary and was never checked against the source. What that page’s “Sitova välilyönti” section actually says is “Tekstinkäsittelyohjelmissa pitkät luvut saa pysymään samalla rivillä käyttämällä sitovaa eli yhdistävää välilyöntiä”, which is about holding the digit groups of one long number together (100 000) — the class nbsp.md §7.11 declines to implement — and not about a number and a following unit. The page is no longer cited here. Kielikello and the rest of the ohjepankki were searched for a Finnish number+unit line-breaking statement and none was found; SFS 4175 may contain one, but it is a paid standard whose text was not read, and it is not cited on the strength of a secondary summary."
116
+ },
117
+ {
118
+ "rule": "nbsp",
119
+ "cite": "Kotimaisten kielten keskus (Kotus), Kielitoimiston ohjepankki: “Lyhenteet: pisteelliset”",
120
+ "url": "https://kielitoimistonohjepankki.fi/ohje/lyhenteet-pisteelliset/",
121
+ "note": "Verbatim: “Yhdyssanan lyhennettyjen osien väliin ei tule välilyöntiä, toisin kuin sanaliiton osien väliin” — a compound word abbreviates closed up (sos.dem., dipl.ins.) while a word-group abbreviation keeps the space (fil. maist.). The `abbreviations` list is therefore deliberately minimal: only the one form quoted verbatim on that page is included. Kotus’s full Lyhenneluettelo contains further space-bearing academic-title abbreviations (fil. tri, valt. maist. and similar); they are omitted rather than guessed at, and should be added by whoever can transcribe that list directly. The membership claim here is precise: `fil. maist.` is **one abbreviation that contains a space**, and Kotus states its internal shape directly. A form that a source merely shows adjacent to another token would not qualify."
122
+ },
123
+ {
124
+ "rule": "nbsp",
125
+ "cite": "Kotimaisten kielten keskus (Kotus), Kielitoimiston ohjepankki: välimerkit and lyhenteet, read for membership in each remaining list",
126
+ "url": "https://kielitoimistonohjepankki.fi/asiasana/valimerkit/",
127
+ "note": "`beforePunctuation` and `narrowBeforePunctuation` are empty because Finnish sets no space before a punctuation mark — there are no members to list. `afterShortWords` is empty because Finnish has no closed class of short words that may not end a line; its function words are inflectional suffixes rather than separate particles, so the list has no candidates. `beforeWord` is empty for want of an attested membership claim: no Kotus page shows titles such as hra or prof. as forms that bind to a following name. `beforeNumber` is a genuine open question rather than a settled empty: Kotus does write s. 12 and kuva 3, which under nbsp.md §2.1 is a membership claim of the right shape, and the earlier justification for leaving it empty (that Kotus does not require the space to be non-breaking) is no longer a valid reason. It is left empty here only because populating it is a live behaviour change that belongs in its own round with N9’s false-positive surface reviewed. `initialBinding` is \"none\" (spec 0.6.0: the field used to be the boolean bindInitials, false), and §2.1 makes plain that this field is unciteable in principle — it expresses nothing but mechanism, and no typographic authority states it in terms of a code point. Kotus attests the space in J. K. Paasikivi and says nothing further. The value is therefore a judgement, held at \"none\" to match the same call made for en-GB, and it should be settled by the operator across all locales at once rather than per file."
128
+ },
129
+ {
130
+ "rule": "hyphen",
131
+ "cite": "Kotimaisten kielten keskus (Kotus), Kielitoimiston ohjepankki: “Yhdysmerkki eli yhdysviiva”",
132
+ "url": "https://kielitoimistonohjepankki.fi/ohje/yhdysmerkki-eli-yhdysviiva/",
133
+ "note": "`prefixes`, `suffixes` and `compounds` are empty. Kotus’s hyphen guidance is entirely about when to write a hyphen (compounds with numerals or abbreviations, identical adjoining vowels, word-group compounds such as “avaimet käteen -sopimus”), never about forbidding a line break at one. Finnish compounding is productive, so there is no closed normative list to encode — unlike Russian, where кое-, -таки and из-под are a fixed inventory. Nothing here, and no Kotus page found, prescribes U+2011."
134
+ }
135
+ ]
136
+ }
@@ -0,0 +1,78 @@
1
+ {
2
+ "locale": "fr-CA",
3
+ "name": "French (Canada)",
4
+ "quotes": {
5
+ "primary": {
6
+ "open": "«",
7
+ "close": "»",
8
+ "innerSpace": "nbsp"
9
+ },
10
+ "secondary": {
11
+ "open": "“",
12
+ "close": "”",
13
+ "innerSpace": "none"
14
+ },
15
+ "elisionIdioms": []
16
+ },
17
+ "dash": {
18
+ "parenthetical": "em-spaced",
19
+ "range": "none"
20
+ },
21
+ "ellipsis": {
22
+ "abbreviatedAfterTerminal": false
23
+ },
24
+ "hyphen": {
25
+ "prefixes": [],
26
+ "suffixes": [],
27
+ "compounds": []
28
+ },
29
+ "nbsp": {
30
+ "beforePunctuation": [":"],
31
+ "narrowBeforePunctuation": [],
32
+ "afterShortWords": [],
33
+ "abbreviations": ["p. ex."],
34
+ "beforeUnits": ["%", "‰", "€", "°C", "km", "cm", "mm", "kg", "km/h", "kWh"],
35
+ "beforeNumber": ["art.", "fig."],
36
+ "beforeWord": ["M.", "MM.", "Mme", "Mmes", "Mlle", "Mlles"],
37
+ "afterSymbols": ["§"],
38
+ "initialBinding": "single"
39
+ },
40
+ "sources": [
41
+ {
42
+ "rule": "nbsp",
43
+ "cite": "Office québécois de la langue française, Banque de dépannage linguistique, « Espacement avant et après les signes de ponctuation et les symboles » : « L'Office québécois de la langue française opte pour l'absence d'espace devant le point-virgule, le point d'exclamation et le point d'interrogation », l'espace fine restant admise « lorsqu'elle est disponible » ; le deux-points est précédé d'une espace insécable",
44
+ "url": "https://vitrinelinguistique.oqlf.gouv.qc.ca/22039/la-typographie/espacement/espacement-avant-et-apres-les-signes-de-ponctuation-et-les-symboles",
45
+ "note": "C'est le point qui distingue fr-CA de fr (France) : l'usage de France, documenté dans spec/locales/fr.json à partir de Jacques André, insère une espace fine insécable (U+202F) avant « ; », « ! » et « ? ». L'OQLF choisit explicitement l'absence d'espace pour l'usage québécois ; l'espace fine n'est mentionnée que comme variante disponible, pas comme la règle par défaut. Le champ narrowBeforePunctuation est donc vide : la règle « spaces » retire toute espace ordinaire tapée devant ces signes (comportement indépendant de la locale, spec/rules/spaces.md), et aucune espace n'est réinsérée ici — le résultat net est « Bonjour! », sans espace, ce qui correspond au choix explicite de l'OQLF plutôt qu'à un oubli. Le deux-points reste précédé d'une espace insécable ordinaire (U+00A0), comme en France : les deux sources OQLF consultées s'accordent sur ce point avec Jacques André."
46
+ },
47
+ {
48
+ "rule": "nbsp",
49
+ "cite": "Jacques André, Petites leçons de typographie, éd. du jobet, § 5.1.3 « Autres emplois de l'espace insécable » — voir spec/locales/fr.json pour la citation complète",
50
+ "url": "http://jacques-andre.fr/faqtypo/lessons.pdf",
51
+ "note": "beforeUnits, beforeNumber, beforeWord, abbreviations et initialBinding (spec 0.6.0 : le champ s'appelait auparavant le booléen bindInitials ; fr conserve \"single\", cité au § 5.1.3 d'André pour « N. Bourbaki ») sont repris tels quels de spec/locales/fr.json : aucune source spécifiquement québécoise n'a été consultée pour ces cas (seuls le point-virgule/point d'exclamation/point d'interrogation et le deux-points ont été vérifiés séparément auprès de l'OQLF, voir l'entrée précédente). L'OQLF confirme par ailleurs, sur la même page que l'entrée précédente, une espace insécable devant les symboles d'unités SI et le pourcentage, ce qui corrobore — sans le prouver intégralement — le maintien de ces listes pour fr-CA."
52
+ },
53
+ {
54
+ "rule": "quotes",
55
+ "cite": "Office québécois de la langue française, Banque de dépannage linguistique, « Généralités sur les guillemets » : « Les guillemets français (« »), appelés chevrons à cause de leur forme, sont ceux que l'on utilise normalement dans un texte français » ; « Une espace insécable sépare les guillemets ouvrants et fermants du texte » ; pour une citation à l'intérieur d'une citation, « on utilise successivement les guillemets anglais doubles, puis anglais simples »",
56
+ "url": "https://vitrinelinguistique.oqlf.gouv.qc.ca/23363/la-ponctuation/guillemets/generalites-sur-les-guillemets",
57
+ "note": "Chevrons, second niveau et espace intérieure identiques à fr (France) ; aucun écart québécois trouvé. La largeur exacte de l'espace intérieure (U+00A0 ordinaire vs U+202F fine) n'est pas non plus tranchée ici — l'OQLF emploie le terme générique « espace insécable » ; la valeur « nbsp » est reprise de fr.json en attendant que ce point soit résolu pour les deux locales."
58
+ },
59
+ {
60
+ "rule": "dashes",
61
+ "cite": "Jacques André, Petites leçons de typographie, § 2.2 et tableau 1 — voir spec/locales/fr.json pour la citation complète ; corroboré par l'OQLF, « Tiret : mise en valeur » : « Les tirets sont précédés et suivis d'un espacement. »",
62
+ "url": "https://vitrinelinguistique.oqlf.gouv.qc.ca/index.php?id=23378",
63
+ "note": "Repris de fr : tiret cadratin espacé pour l'incise, aucune valeur de plage vérifiée (range: none). L'OQLF confirme l'espacement mais ne distingue pas le cadratin du demi-cadratin ; aucun écart québécois trouvé sur ce point."
64
+ },
65
+ {
66
+ "rule": "ellipsis",
67
+ "cite": "Jacques André, Petites leçons de typographie, § 5.1.2 et tableau 2 — voir spec/locales/fr.json pour la citation complète",
68
+ "url": "http://jacques-andre.fr/faqtypo/lessons.pdf",
69
+ "note": "Repris tel quel de fr ; aucune source québécoise consultée séparément pour ce point, aucun écart identifié dans les sources OQLF lues."
70
+ },
71
+ {
72
+ "rule": "hyphen",
73
+ "cite": "Jacques André, Petites leçons de typographie, tableau 1 — voir spec/locales/fr.json pour la citation complète",
74
+ "url": "http://jacques-andre.fr/faqtypo/lessons.pdf",
75
+ "note": "Repris tel quel de fr : aucune source consultée n'impose un trait d'union insécable pour une classe fermée de formes morphologiques françaises, en France comme au Québec."
76
+ }
77
+ ]
78
+ }
@@ -0,0 +1,84 @@
1
+ {
2
+ "locale": "fr",
3
+ "name": "French",
4
+ "quotes": {
5
+ "primary": {
6
+ "open": "«",
7
+ "close": "»",
8
+ "innerSpace": "nbsp"
9
+ },
10
+ "secondary": {
11
+ "open": "“",
12
+ "close": "”",
13
+ "innerSpace": "none"
14
+ },
15
+ "elisionIdioms": []
16
+ },
17
+ "dash": {
18
+ "parenthetical": "em-spaced",
19
+ "range": "none"
20
+ },
21
+ "ellipsis": {
22
+ "abbreviatedAfterTerminal": false
23
+ },
24
+ "hyphen": {
25
+ "prefixes": [],
26
+ "suffixes": [],
27
+ "compounds": []
28
+ },
29
+ "nbsp": {
30
+ "beforePunctuation": [":"],
31
+ "narrowBeforePunctuation": [";", "!", "?"],
32
+ "afterShortWords": [],
33
+ "abbreviations": ["p. ex."],
34
+ "beforeUnits": ["%", "‰", "€", "°C", "km", "cm", "mm", "kg", "km/h", "kWh"],
35
+ "beforeNumber": ["art.", "fig."],
36
+ "beforeWord": ["M.", "MM.", "Mme", "Mmes", "Mlle", "Mlles"],
37
+ "afterSymbols": ["§"],
38
+ "initialBinding": "single"
39
+ },
40
+ "sources": [
41
+ {
42
+ "rule": "nbsp",
43
+ "cite": "Jacques André, Petites leçons de typographie, éd. du jobet, révision du 1er juin 2025, § 5.1.1 note 21 et § 5.2.3 : l'espace insécable employée devant les ponctuations doubles « c'est la fine des typographes, en première approximation (contre-exemple : l'espace avant le deux-points est en fait une espace normale insécable) » ; « il faut une espace fine insécable avant le point-virgule »",
44
+ "url": "http://jacques-andre.fr/faqtypo/lessons.pdf",
45
+ "note": "C'est le point qui tranche la question posée par docs/PLAN.md §7 : « ; », « ! » et « ? » prennent U+202F ; « : » prend U+00A0. La distinction est donc confirmée, et non simplement répétée. Le tableau 1 (p. 32) donne la saisie complète des signes. Recoupé avec l'article « Espace fine insécable » de la Wikipédia francophone, qui attribue la même règle au Lexique des règles typographiques en usage à l'Imprimerie nationale, 3e éd., 2002 (fine devant ; ? !, « sauf devant deux-points, en France »)."
46
+ },
47
+ {
48
+ "rule": "nbsp",
49
+ "cite": "Jacques André, Petites leçons de typographie, § 2.5 et § 5.1.3 « Autres emplois de l'espace insécable » : espace insécable entre un prénom abrégé et le nom (« N. Bourbaki »), entre une abréviation et le mot qui la suit (« Mme Hugo », « le R.P. Durand »), entre un nombre et ce qu'il quantifie (« 14 francs », « 2 € », « 98 % », « art. 237 »)",
50
+ "url": "http://jacques-andre.fr/faqtypo/lessons.pdf",
51
+ "note": "La liste beforeUnits est volontairement courte et exclut les symboles d'une seule lettre (m, g, l, s, A), qui ne peuvent pas être désambiguïsés sans contexte. La liaison « abréviation + mot suivant » (M. Dupont, Mme Hugo) n'est pas exprimable dans ce schéma : afterSymbols lie un symbole à un NOMBRE suivant, pas à un mot ; elle passe par nbsp.initialBinding = \"single\" (spec 0.6.0 : le champ s'appelait auparavant le booléen bindInitials), qui conserve la liaison sur une seule initiale citée ici (« N. Bourbaki »). Contrairement à \"chain\" (en-US, de-DE, de-CH, ru — Chicago exige « two or more initials »), \"single\" ne peut pas distinguer structurellement un prénom abrégé authentique d'une collision de fin de phrase (une initiale isolée suivie d'un mot capitalisé qui commence en fait une nouvelle phrase) ; voir spec/rules/nbsp.md §7."
52
+ },
53
+ {
54
+ "rule": "quotes",
55
+ "cite": "Imprimerie nationale, Lexique des règles typographiques en usage à l'Imprimerie nationale, 3e éd., 2002, entrée « Guillemets » : les guillemets français « … » sont séparés du texte qu'ils encadrent par une espace insécable",
56
+ "url": "https://fr.wikipedia.org/wiki/Espace_fine_ins%C3%A9cable",
57
+ "note": "Le Lexique n'est pas consultable en ligne ; la règle a été vérifiée par recoupement de deux articles de la Wikipédia francophone qui la citent (« Espace fine insécable » : « à l'intérieur des guillemets français […] il est recommandé d'insérer des espaces insécables », attribué au Lexique 2002 ; « Ponctuation », tableau des espacements) et du tableau 1 de Jacques André, qui note une insécable après « « » et avant « » ». Désaccord assumé avec docs/PLAN.md §7, qui annonçait U+202F à l'intérieur des guillemets : la source normative dit espace insécable (U+00A0). L'usage web contemporain, et JoliTypo, emploient souvent U+202F ; le choix retenu ici est celui de la citation, pas celui de l'usage."
58
+ },
59
+ {
60
+ "rule": "quotes",
61
+ "cite": "Jacques André, Petites leçons de typographie, § 2.2 : « en français, les guillemets sont les doubles chevrons « … » et non les (double-)quotes anglaises “…” ni ‘…’ » ; les guillemets anglais “ ” servent de guillemets de second niveau",
62
+ "url": "http://jacques-andre.fr/faqtypo/lessons.pdf",
63
+ "note": "Le second niveau est le point le moins solidement établi de ce fichier : l'usage français admet aussi la répétition des chevrons ou les chevrons simples ‹ ›. Les guillemets anglais sont retenus parce qu'ils sont la solution la plus couramment attribuée au Lexique, mais cette ligne mérite d'être revue si la 3e édition papier dit autre chose."
64
+ },
65
+ {
66
+ "rule": "dashes",
67
+ "cite": "Jacques André, Petites leçons de typographie, § 2.2 et tableau 1 (p. 32) : le tiret marquant les incises est le tiret cadratin « — », précédé et suivi d'une espace (« mmm —_mmm … mmm_— mmm »)",
68
+ "url": "http://jacques-andre.fr/faqtypo/lessons.pdf",
69
+ "note": "Le même paragraphe signale que « la tendance est d'utiliser à sa place le tiret moyen « – » ». La valeur em-spaced suit la règle citée, pas la tendance ; docs/PLAN.md §7 supposait en-spaced. Aucune valeur de plage n'est vérifiée : les exemples de l'Imprimerie nationale et de Jacques André impriment un trait d'union dans les intervalles de pages (« p. 123-125 »), et l'énumération se fait plutôt « de … à … ». Le schéma a donc reçu la valeur « none » (ne rien substituer), retenue ici tant que le point n'est pas tranché sur le Lexique papier — une citation manquante n'autorise jamais à deviner."
70
+ },
71
+ {
72
+ "rule": "nbsp",
73
+ "cite": "Jacques André, Petites leçons de typographie, § 5.1.3 « Autres emplois de l'espace insécable », liste « Coupure entre les mots » : « entre une abréviation et le mot qui la suit, exemples : “Mme_Hugo, D._Knuth, le R.P._Durand” » ; « entre un nombre et ce qu'il quantifie, par exemple : “14_francs, 2_€, 1_A, t._vii, art._237, fig._3, pages_23 à_25, 98_%” » — le caractère « _ » note l'espace insécable",
74
+ "url": "http://jacques-andre.fr/faqtypo/lessons.pdf",
75
+ "note": "Texte relu directement dans le PDF. Cette entrée lève la limitation signalée plus haut dans ce fichier (« la liaison abréviation + mot suivant n'est pas exprimable dans ce schéma ») : le schéma a depuis reçu beforeNumber et beforeWord. beforeNumber ne retient que « art. » et « fig. », cités littéralement devant un nombre ; « t. vii » est suivi d'un chiffre romain et n'a pas été retenu. beforeWord est volontairement réduit à la classe fermée des titres de civilité : la règle citée vaut pour toute abréviation, mais l'énumérer intégralement produirait des faux positifs (« etc. », « p. ex. », « cf. »). « Mme » est cité mot pour mot ; « M., MM., Mmes, Mlle, Mlles » sont les autres membres de la même classe et relèvent donc de la même règle, ce qui reste une inférence de classe et non une citation littérale. Un « M. » qui serait en réalité une initiale de prénom reçoit de toute façon l'espace insécable prescrite au § 5.1.3 pour « N. Bourbaki » : la liaison est correcte dans les deux lectures."
76
+ },
77
+ {
78
+ "rule": "hyphen",
79
+ "cite": "Jacques André, Petites leçons de typographie, tableau 1 (p. 32), ligne « trait d'union » : la saisie est « mmm-mmm », sans espace ni marque d'insécabilité, alors que le même tableau note explicitement l'insécable pour les ponctuations doubles, les guillemets et les tirets d'incise",
80
+ "url": "http://jacques-andre.fr/faqtypo/lessons.pdf",
81
+ "note": "Justification des trois listes vides. Aucune source normative consultée n'impose un trait d'union insécable pour une classe fermée de formes morphologiques françaises ; le § 5.1.3, qui énumère les cas d'insécabilité, ne mentionne aucun trait d'union. Le champ hyphen est donc sans objet en français."
82
+ }
83
+ ]
84
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "spec": "1.0.0",
3
+ "$comment": "Locale resolution input. Algorithm is specified in spec/rules/locale-resolution.md and is identical in every runtime — never delegate it to a platform locale-negotiation library. \"spec\" here must track spec/VERSION exactly — it is not itself the global version source; scripts/validate-spec.mjs enforces the match.",
4
+ "locales": ["en-US", "en-GB", "de-DE", "de-CH", "fr", "fr-CA", "ru", "fi", "sv", "el"],
5
+ "aliases": {
6
+ "en": "en-US",
7
+ "de": "de-DE"
8
+ }
9
+ }
@@ -0,0 +1,112 @@
1
+ {
2
+ "locale": "ru",
3
+ "name": "Russian",
4
+ "quotes": {
5
+ "primary": {
6
+ "open": "«",
7
+ "close": "»",
8
+ "innerSpace": "none"
9
+ },
10
+ "secondary": {
11
+ "open": "„",
12
+ "close": "“",
13
+ "innerSpace": "none"
14
+ },
15
+ "elisionIdioms": []
16
+ },
17
+ "dash": {
18
+ "parenthetical": "em-spaced",
19
+ "range": "em-tight"
20
+ },
21
+ "ellipsis": {
22
+ "abbreviatedAfterTerminal": true
23
+ },
24
+ "hyphen": {
25
+ "prefixes": ["кое-", "кой-"],
26
+ "suffixes": ["-то", "-либо", "-нибудь", "-таки", "-ка"],
27
+ "compounds": ["из-за", "из-под"]
28
+ },
29
+ "nbsp": {
30
+ "beforePunctuation": [],
31
+ "narrowBeforePunctuation": [],
32
+ "afterShortWords": [
33
+ "а",
34
+ "в",
35
+ "и",
36
+ "к",
37
+ "о",
38
+ "с",
39
+ "у",
40
+ "во",
41
+ "до",
42
+ "за",
43
+ "из",
44
+ "ко",
45
+ "на",
46
+ "об",
47
+ "от",
48
+ "по",
49
+ "со"
50
+ ],
51
+ "abbreviations": ["и т. д.", "и т. п.", "т. е.", "и др."],
52
+ "beforeUnits": [
53
+ "%",
54
+ "‰",
55
+ "₽",
56
+ "°C",
57
+ "км",
58
+ "см",
59
+ "мм",
60
+ "кг",
61
+ "г.",
62
+ "гг.",
63
+ "в.",
64
+ "вв.",
65
+ "тыс.",
66
+ "млн",
67
+ "млрд"
68
+ ],
69
+ "beforeNumber": [],
70
+ "beforeWord": ["ул.", "пл."],
71
+ "afterSymbols": ["№", "§"],
72
+ "initialBinding": "chain"
73
+ },
74
+ "sources": [
75
+ {
76
+ "rule": "quotes",
77
+ "cite": "Правила русской орфографии и пунктуации. Полный академический справочник / под ред. В. В. Лопатина. М., 2006, раздел «Знаки препинания при прямой речи и цитатах»: в печатном тексте внешние кавычки — «ёлочки», внутренние — „лапки“",
78
+ "url": "https://gramota.ru/journal/stati/pravila-i-normy/elochki-ili-lapki-kak-pravilno-ispolzovat-kavychki",
79
+ "note": "Страница «Грамоты» отдаёт 403 автоматическому клиенту; правило подтверждено по её индексируемому изложению и совпадает с рекомендацией Мильчина и Чельцовой («Справочник издателя и автора»). Номер параграфа не указан, поскольку сверить его по бумажному изданию не удалось — приводить непроверенный номер было бы хуже, чем его отсутствие."
80
+ },
81
+ {
82
+ "rule": "ellipsis",
83
+ "cite": "Правила русской орфографии и пунктуации (1956), раздел «Многоточие»: после вопросительного или восклицательного знака ставятся не три точки, а две (третья точка стоит под одним из названных знаков) — «Сколько жить ещё на свете?..», «А как вы вчера играли!..»",
84
+ "url": "https://gramota.ru/biblioteka/spravochniki/pravila-russkoj-orfografii-i-punktuacii/mnogotochie",
85
+ "note": "То же правило приводит Д. Э. Розенталь, «Справочник по русскому языку. Пунктуация», раздел «Сочетание знаков препинания»."
86
+ },
87
+ {
88
+ "rule": "dashes",
89
+ "cite": "Мильчин А. Э., Чельцова Л. К. «Справочник издателя и автора» и Д. Э. Розенталь, «Справочник по русскому языку»: если интервал передаётся цифрами, между числами ставится тире без отбивки — «5—6 лет», «в XV—XVII веках», «1941—1945 гг.»; тире в предложении отбивается пробелами с обеих сторон",
90
+ "url": "https://gramota.ru/journal/stati/pravila-i-normy/defis-i-tire-kak-vybrat-i-postavit-pravilnyy-znak-v-tekste",
91
+ "note": "В русской типографике интервал набирается длинным тире (U+2014) без отбивки; короткое тире (U+2013) в этой роли не используется. Перечисление schema.dash.range изначально допускало только en-*, что не позволяло выразить норму; перечисление расширено значением em-tight, и оно здесь и стоит."
92
+ },
93
+ {
94
+ "rule": "nbsp",
95
+ "cite": "Мильчин А. Э., Чельцова Л. К. «Справочник издателя и автора»: неразрывный пробел ставится между инициалами и между инициалами и фамилией («А. С. Пушкин»), после однобуквенных предлогов и союзов, между знаками № и § и относящимися к ним числами, между числом и относящейся к нему единицей измерения или счётным словом («1981 г.», «5 млн»), а также внутри сокращений «и т. д.», «и т. п.», «т. е.»",
96
+ "url": "https://orfogrammka.ru/%D1%82%D0%B8%D0%BF%D0%BE%D0%B3%D1%80%D0%B0%D1%84%D0%B8%D0%BA%D0%B0/%D0%BF%D1%80%D0%BE%D0%B1%D0%B5%D0%BB_%D0%B8_%D0%B8%D0%BD%D0%B8%D1%86%D0%B8%D0%B0%D0%BB%D1%8B/",
97
+ "note": "Список afterShortWords сознательно ограничен однобуквенными предлогами и союзами (а, в, и, к, о, с, у) и однозначными двухбуквенными предлогами (во, до, за, из, ко, на, об, от, по, со). Частицы и союзы «не», «ни», «но», «же», «ли», «бы» не включены: правило для них — рекомендация вёрстки, а не норма, и связывание их даёт заметный риск ложных срабатываний. Префиксные сокращения «г. Москва», «ул. Ленина» (docs/PLAN.md §7) выразить нельзя: afterSymbols по описанию схемы связывает символ со следующим ЧИСЛОМ, а не со словом; «г.» здесь помещено в beforeUnits в значении «год» после числа («2020 г.»)."
98
+ },
99
+ {
100
+ "rule": "nbsp",
101
+ "cite": "«Технические правила набора», раздел «Общие требования к набору», п. 5: «Отбиваются слова от имен собственных, к которым они относятся (ул. Советская)»; раздел «Переносы», п. 4: «Не должны быть отделены при переносе из одной строки в другую: а) фамилии от инициалов или один инициал от другого; б) сокращенные слова имен собственных, к которым они относятся, например: тов. Сергеева, г. Гомель, пл. Ленина; … г) арабские или римские цифры от их сокращенных или полных наименований, например: 2010 г., 800 руб., 50 куб. см, XX век; д) знаки и обозначения (№, §, % и т. п.) от следующих за ними цифр»",
102
+ "url": "https://old.gsu.by/pages/izdat/2023/tehnicheskie_pravila_nabora.pdf",
103
+ "note": "Текст сверен по самому PDF; это издательский свод технических правил набора (Гомельский госуниверситет), то есть опубликованное изложение отраслевых правил (Мильчин, ОСТ 29.115-88), а не первоисточник: главу «Технические правила набора и вёрстки» у Мильчина проверить онлайн не удалось (доступное издание 1998 г. содержит только части 1—3 без этой главы). Пункт 4б — единственное найденное нормативное основание для beforeWord. «г.» в этот список сознательно НЕ включено: «г.» нормативно связывается и влево как «год» (п. 4г, «2010 г.», уже отражено в beforeUnits), и вправо как «город» (п. 4б, «г. Гомель»), а литеральный список без контекста эти два случая не различает — во фразе «в 1147 г. Москва была основана» правило beforeWord склеило бы «г.» с «Москва» через границу оборота. Различить их можно, только посмотрев влево на цифру и вправо на топоним, то есть по контексту, чего декларативный список не выражает. По той же причине не включены «гг.», «в.», «вв.». Оставлены «ул.» и «пл.» — однозначные топонимические сокращения, и обе формы процитированы дословно: «пл. Ленина» в «Переносах» п. 4б, «ул. Советская» в «Общих требованиях к набору» п. 5. «д.», «стр.», «корп.», «кв.» относятся к следующему ЧИСЛУ, а не к слову, поэтому в beforeWord им не место. beforeNumber пуст, и это подтверждённое отсутствие правила, а не ненайденная цитата: перечень «Переносов» п. 4 закрытый и исчерпывающий, он содержит обратное направление (п. 4г, «2010 г.») и знаки (п. 4д, «№ 75»), но конструкции «сокращение + следующее число» в нём нет. Мильчин, «Справочник издателя и автора», § 9.1.1 («Употребление в ссылках сокращений слов и условных сокращений»: «Книговедческие термины при цифровых номерах или литерах рекомендуется для экономии места сокращать») нормирует, КАКОЕ сокращение писать перед числом, но о пробеле не говорит ничего. Страница «Орфограммки» с примером «гл. IV» отвергнута: она ссылается только на Википедию и Хабр."
104
+ },
105
+ {
106
+ "rule": "hyphen",
107
+ "cite": "Правила русской орфографии и пунктуации. Полный академический справочник / под ред. В. В. Лопатина. М., 2006: § 135 — пишутся через дефис местоименные слова с начальной частью (приставкой) кое- (кой-) и с конечными частями (постфиксами) -либо, -нибудь, -то; § 141 п. 2 — сложные предлоги из-за, из-под (а также диалектные по-за, по-над); § 141 п. 3 и § 143 — частицы -де, -ка, -те, -то, -с и -таки (всё-таки, опять-таки, прямо-таки, так-таки)",
108
+ "url": "https://orthographia.ru/orf.php?paragraph=pp135.php",
109
+ "note": "Тексты §§ 135, 141, 143 и 219 прочитаны по онлайн-изданию справочника. Эти параграфы нормативны для СОСТАВА форм, но не для запрета переноса, и это важно не смешивать: § 219 («не подлежат переносу») называет только аббревиатуры из прописных букв, графические сокращения (б-ка, ж.-д.) и наращения (20-й); слов с дефисом там нет, а правило повторять дефис в начале перенесённой части (военно-/-морской) справочник даёт как факультативное. Значит, связывание дефиса неразрывным U+2011 — решение проекта (docs/PLAN.md §3.3), а не орфографическая норма; его практическое обоснование то же, что у факультативного правила: при переносе по дефису теряется различие слитного и дефисного написания. Диалектные и просторечные по-за, по-над, для-ради, за-ради не внесены как непродуктивные. Класс графических сокращений из § 219 (б-ка, ж.-д., р/сч) нормативно неразрывен, но перечислить его литеральным списком нельзя, поэтому он здесь не отражён. Из § 143 взята также частица -ка; -де, -с, -те опущены как архаичные и редкие."
110
+ }
111
+ ]
112
+ }
@@ -0,0 +1,124 @@
1
+ {
2
+ "locale": "sv",
3
+ "name": "Swedish",
4
+ "quotes": {
5
+ "primary": {
6
+ "open": "”",
7
+ "close": "”",
8
+ "innerSpace": "none"
9
+ },
10
+ "secondary": {
11
+ "open": "’",
12
+ "close": "’",
13
+ "innerSpace": "none"
14
+ },
15
+ "elisionIdioms": []
16
+ },
17
+ "dash": {
18
+ "parenthetical": "en-spaced",
19
+ "range": "en-tight"
20
+ },
21
+ "ellipsis": {
22
+ "abbreviatedAfterTerminal": false
23
+ },
24
+ "hyphen": {
25
+ "prefixes": [],
26
+ "suffixes": [],
27
+ "compounds": []
28
+ },
29
+ "nbsp": {
30
+ "beforePunctuation": [],
31
+ "narrowBeforePunctuation": [],
32
+ "afterShortWords": [],
33
+ "abbreviations": [],
34
+ "beforeUnits": [
35
+ "%",
36
+ "‰",
37
+ "kr",
38
+ "€",
39
+ "kg",
40
+ "g",
41
+ "mg",
42
+ "km",
43
+ "m",
44
+ "cm",
45
+ "mm",
46
+ "l",
47
+ "dl",
48
+ "cl",
49
+ "ml",
50
+ "kW",
51
+ "kWh",
52
+ "min",
53
+ "sek",
54
+ "tim",
55
+ "h",
56
+ "°C"
57
+ ],
58
+ "beforeNumber": [],
59
+ "beforeWord": [],
60
+ "afterSymbols": ["§"],
61
+ "initialBinding": "none"
62
+ },
63
+ "sources": [
64
+ {
65
+ "rule": "quotes",
66
+ "cite": "Språkrådet (Institutet för språk och folkminnen), Snabba skrivregler – i skolan och på jobbet, red. Ola Karlsson, §1.13 “Citattecken (”)”",
67
+ "url": "https://www.diva-portal.org/smash/get/diva2:1829117/FULLTEXT04.pdf",
68
+ "note": "Verbatim: “Normala svenska citattecken ser ut som två små upphöjda nior och har samma form i början och slutet, alltså ”ord”. Men citattecken kan ha olika utseende i olika typsnitt och i olika språk, som i “engelska”, „tyska“ och «norska». Använd svenska citattecken i svensk text, även om det du citerar är på ett annat språk.” This settles the ❓ in PLAN.md §7: »…» is attested in Swedish book typography and older practice, but Språkrådet’s current recommendation is ”…” (U+201D on both sides), so that is what this file encodes."
69
+ },
70
+ {
71
+ "rule": "quotes",
72
+ "cite": "Språkrådet, Snabba skrivregler, §1.14 “Apostrof (’)”",
73
+ "url": "https://www.diva-portal.org/smash/get/diva2:1829117/FULLTEXT04.pdf",
74
+ "note": "Verbatim: “En apostrof ser ut som en liten upphöjd nia (’). … Apostrof används även vid citat inuti ett citat, se ▶ 6.1.1.” Hence the secondary pair is U+2019 on both sides. Isof’s Frågelådan phrases the same rule as “enkla citattecken … när du har ett citat i ett citat”."
75
+ },
76
+ {
77
+ "rule": "dashes",
78
+ "cite": "Språkrådet, Snabba skrivregler, §1.10 “Tankstreck (–)”",
79
+ "url": "https://www.diva-portal.org/smash/get/diva2:1829117/FULLTEXT04.pdf",
80
+ "note": "Range, verbatim: “Det används framför allt mellan siffror och mellan ortnamn för att visa till exempel tidsperioder, avstånd och intervall. Du har då inget mellanslag före eller efter tankstrecket.” (öppet 9–18, åren 2026–2028, s. 3–5). Parenthetical, verbatim: “Tankstreck kan ibland användas före paus eller tillägg. På samma sätt används det vid mer självständiga inskott … Då har du mellanslag före och efter tankstrecket.” Swedish uses the en dash (tankstreck) in both roles; there is no em dash in the recommendation."
81
+ },
82
+ {
83
+ "rule": "ellipsis",
84
+ "cite": "Språkrådet, Snabba skrivregler, kap. 1 “Skiljetecken och skrivtecken” (tre punkter)",
85
+ "url": "https://www.diva-portal.org/smash/get/diva2:1829117/FULLTEXT04.pdf",
86
+ "note": "`abbreviatedAfterTerminal` is false. The guide treats “tre punkter” as an ordinary mark alongside utropstecken and frågetecken; no two-dot form after `!`/`?` exists in Swedish. That form is Russian-only."
87
+ },
88
+ {
89
+ "rule": "nbsp",
90
+ "cite": "Språkrådet, Snabba skrivregler, §1.16 “Tecken och mellanslag”",
91
+ "url": "https://www.diva-portal.org/smash/get/diva2:1829117/FULLTEXT04.pdf",
92
+ "note": "Verbatim: “Tecken som ersätter ord, som & för och, + för plus och % för procent, skrivs helst med mellanslag före och efter, precis som när du skriver ut orden: 5 % eftersom du skriver fem procent.” Examples given: “Ek & Lund (Ek och Lund), 3 € (tre euro), § 7 (paragraf sju), 2 + 3 (två plus tre)”. And: “För att de tecken och siffror som hör ihop ska hamna på samma rad och inte på olika rader, kan du använda så kallat fast mellanslag.” This is the authority for `%`, `€` and `§`. Note the direction: Språkrådet’s own example is “§ 7”, the sign before the number, so `§` is in `afterSymbols`, the opposite of Finnish. Swedish legal citation also writes “5 §”; that order is not covered by the cited example and is deliberately not encoded. `&` and `+` are omitted because they take a space on both sides and do not fit this schema’s bind-to-a-number model."
93
+ },
94
+ {
95
+ "rule": "nbsp",
96
+ "cite": "Språkrådet, Snabba skrivregler, §4.3.4 “Förkortningar för måttenheter”; BIPM, The International System of Units (SI), 9th ed. (2019), concise summary",
97
+ "url": "https://www.bipm.org/documents/20126/41483022/SI-Brochure-9-concise-EN.pdf",
98
+ "note": "Språkrådet verbatim: “Internationella förkortningar för måttenheter går alltid bra att skriva som förkortningar, som cm (centimeter), kg (kilo), kWh (kilowattimme) och ml (milliliter). Dessa skriver du alltid utan punkt. Så skriver du också svenska förkortningar som liknar måttenheter, som kr (kronor), min (minut), sek (sekund) och tim (timme).” BIPM verbatim: “A single space is always left between the number and the unit.” The unit list is restricted to forms named by one of these two sources."
99
+ },
100
+ {
101
+ "rule": "nbsp",
102
+ "cite": "Språkrådet, Snabba skrivregler, §4.3.1 and §4.5 “Vanliga förkortningar”",
103
+ "url": "https://www.diva-portal.org/smash/get/diva2:1829117/FULLTEXT04.pdf",
104
+ "note": "`abbreviations` is empty because Swedish multi-word abbreviations are written closed up, with no internal space: the guide’s own list gives bl.a., dvs., e.d., fr.o.m., f.d., f.ö., m.a.o., m.fl., m.m., obs., osv., p.g.a., s.k., t.ex., t.o.m. There is therefore no internal space to make non-breaking. (Older typographic practice spaced these — “t. ex.” — but that is not the current recommendation.)"
105
+ },
106
+ {
107
+ "rule": "nbsp",
108
+ "cite": "No Språkrådet guidance found for short-word binding or for initials; values deliberately conservative",
109
+ "note": "`afterShortWords`, `beforePunctuation` and `narrowBeforePunctuation` are empty by design. §1.16 states the general rule plainly — “När du använder vanliga skiljetecken sätter du inget mellanslag före tecknet, men efter tecknet ska du ha mellanslag” — which rules out any before-punctuation space, and Swedish has no rule against short words at line end. `initialBinding` is \"none\" (spec 0.6.0: the field used to be the boolean bindInitials, false): §1.16 recommends fast mellanslag only for “de tecken och siffror som hör ihop”, i.e. signs and digits, not personal initials."
110
+ },
111
+ {
112
+ "rule": "nbsp",
113
+ "cite": "Språkrådet, Snabba skrivregler, §1.16 “Tecken och mellanslag” and §4.5 “Vanliga förkortningar”",
114
+ "url": "https://www.diva-portal.org/smash/get/diva2:1829117/FULLTEXT04.pdf",
115
+ "note": "`beforeNumber` and `beforeWord` are empty, and this was the closest call in this file. Språkrådet does write kl. 8–16, nr 3 and s. 3–5, and §1.16 recommends fast mellanslag so that “de tecken och siffror som hör ihop ska hamna på samma rad”. But that sentence is scoped to tecken — the sign-and-digit pairs of §1.16 (%, €, §, &, +) — and the guide nowhere extends it to abbreviations such as kl., nr or s. Encoding them would convert a plausible reading into a normative claim the source does not make, so the lists stay empty. `beforeWord` likewise: no Swedish authority consulted requires binding a title (dr, prof.) to a following name."
116
+ },
117
+ {
118
+ "rule": "hyphen",
119
+ "cite": "Språkrådet, Snabba skrivregler, §4.4 (sammansättningar med förkortningar) and kap. 7 (avstavning)",
120
+ "url": "https://www.diva-portal.org/smash/get/diva2:1829117/FULLTEXT04.pdf",
121
+ "note": "`prefixes`, `suffixes` and `compounds` are empty. The guide’s hyphen material states when to insert a bindestreck in compounds (e-post, EU-länderna, FN-arbete, satellit-tv-program, lan-spel) and treats avstavning as a separate topic; it never forbids a line break at an existing hyphen. Swedish compounding is productive, so there is no closed inventory to list — the field exists for the Russian кое- / -таки / из-под case. No U+2011 requirement found in any Språkrådet material consulted."
122
+ }
123
+ ]
124
+ }