polytypo 1.6.3 → 1.8.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 (54) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +25 -0
  3. data/lib/polytypo/data/.not-vendored +11 -0
  4. data/lib/polytypo/data/README.md +16 -11
  5. data/lib/polytypo/data/VERSION +1 -1
  6. data/lib/polytypo/data/fixtures/cs.json +1 -1
  7. data/lib/polytypo/data/fixtures/de-CH.json +1 -1
  8. data/lib/polytypo/data/fixtures/de-DE.json +14 -1
  9. data/lib/polytypo/data/fixtures/el.json +1 -1
  10. data/lib/polytypo/data/fixtures/en-GB.json +1 -1
  11. data/lib/polytypo/data/fixtures/en-US.json +521 -1
  12. data/lib/polytypo/data/fixtures/es.json +1 -1
  13. data/lib/polytypo/data/fixtures/fi.json +1 -1
  14. data/lib/polytypo/data/fixtures/fr-CA.json +1 -1
  15. data/lib/polytypo/data/fixtures/fr.json +68 -1
  16. data/lib/polytypo/data/fixtures/it.json +1 -1
  17. data/lib/polytypo/data/fixtures/locale-resolution.json +1 -1
  18. data/lib/polytypo/data/fixtures/nl.json +1 -1
  19. data/lib/polytypo/data/fixtures/pl.json +1 -1
  20. data/lib/polytypo/data/fixtures/pt-BR.json +1 -1
  21. data/lib/polytypo/data/fixtures/pt-PT.json +1 -1
  22. data/lib/polytypo/data/fixtures/ru.json +1 -1
  23. data/lib/polytypo/data/fixtures/sv.json +1 -1
  24. data/lib/polytypo/data/fixtures/tr.json +1 -1
  25. data/lib/polytypo/data/fixtures/uk.json +1 -1
  26. data/lib/polytypo/data/locales/cs.json +56 -37
  27. data/lib/polytypo/data/locales/de-CH.json +43 -34
  28. data/lib/polytypo/data/locales/de-DE.json +47 -32
  29. data/lib/polytypo/data/locales/el.json +51 -1
  30. data/lib/polytypo/data/locales/en-GB.json +56 -4
  31. data/lib/polytypo/data/locales/en-US.json +68 -4
  32. data/lib/polytypo/data/locales/es.json +66 -29
  33. data/lib/polytypo/data/locales/fi.json +77 -7
  34. data/lib/polytypo/data/locales/fr-CA.json +63 -36
  35. data/lib/polytypo/data/locales/fr.json +70 -41
  36. data/lib/polytypo/data/locales/it.json +65 -22
  37. data/lib/polytypo/data/locales/nl.json +61 -29
  38. data/lib/polytypo/data/locales/pl.json +61 -28
  39. data/lib/polytypo/data/locales/pt-BR.json +53 -28
  40. data/lib/polytypo/data/locales/pt-PT.json +55 -28
  41. data/lib/polytypo/data/locales/registry.json +1 -1
  42. data/lib/polytypo/data/locales/ru.json +45 -30
  43. data/lib/polytypo/data/locales/sv.json +63 -4
  44. data/lib/polytypo/data/locales/tr.json +72 -32
  45. data/lib/polytypo/data/locales/uk.json +55 -27
  46. data/lib/polytypo/data/rules/modes.md +430 -11
  47. data/lib/polytypo/data/rules/order.json +1 -1
  48. data/lib/polytypo/data/schema/fixtures.schema.json +12 -1
  49. data/lib/polytypo/engine/pipeline.rb +29 -0
  50. data/lib/polytypo/modes/markdown.rb +256 -31
  51. data/lib/polytypo/modes/runner.rb +33 -3
  52. data/lib/polytypo/version.rb +1 -1
  53. data/lib/polytypo.rb +27 -12
  54. metadata +2 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f6776ba2390f63971edcd4f09cd84dbb3f1fc3e9678feee541a7f1667694fdbf
4
- data.tar.gz: 7a6657ca0e43963c3c9f8509a0727a6dc9bbaed2f648b3fd4f295aca1c7bdf03
3
+ metadata.gz: ccb6d56b095a38220c09cb15089edea24d1805b97a2db708f2d9528f5496d563
4
+ data.tar.gz: e3302e7bc38ffaa8605de7b46bec1160dd0fab40013179eec5fe4423458c0c2f
5
5
  SHA512:
6
- metadata.gz: 33d644b27e332aef05d2857a9e95598ab05ef5ff56b29a81ba077b5c1d32f0538a8e0d5718a9e5109710227e3559ad67081d3a418910e8cab9a4bc8c242b14c0
7
- data.tar.gz: e8b828b749cfe12d719590ace28fb24a5f296bc52b14c959c74f24176921eca9c4ba583509198f56a4d9e4f684e3878dcb577add5c554a5c8b593a5680530fe9
6
+ metadata.gz: fe0ecd00e6252bc23a36c198b8320a23eb031b85ab418ef40f482afb4ae888ee9bb0e4b858a0d4d97cda2ed5f263152478e028d0162e4dd8be3a1162c8e95244
7
+ data.tar.gz: e464ca53c2c8f4d7e15bcb3209520ca68e30b2237fd7994aad179dc50a6a691b6363780718d4c15f3c184e6eba4d7e6d67bde3594502d2b44ddc7757ee2f0f19
data/README.md CHANGED
@@ -85,6 +85,31 @@ chomping indicator are never decoded and rewritten — the file is located, not
85
85
  trailing newlines of a `|+` block come back exactly as you wrote them. An empty `keys:` array is
86
86
  legal and processes nothing, and `yaml` mode needs no parser at all.
87
87
 
88
+ In `markdown` mode frontmatter is skipped whole by default, delimiters included — it is a
89
+ machine-read block, and `fr` would put a narrow no-break space in front of the colon of every
90
+ field in it. On a site whose frontmatter carries the headline that leaves the most visible string
91
+ on the page untouched, so name the keys you want processed:
92
+
93
+ ```ruby
94
+ Polytypo.transform(
95
+ %(---\ntitle: He said "hello" once\nslug: "he-said-hello"\n---\n\nThe body was typeset all along.\n),
96
+ locale: "en-US", mode: "markdown", dialect: "commonmark", frontmatter_keys: ["title"]
97
+ )
98
+ # ---
99
+ # title: He said “hello” once
100
+ # slug: "he-said-hello"
101
+ # ---
102
+ #
103
+ # The body was typeset all along.
104
+ ```
105
+
106
+ Without `frontmatter_keys:` nothing in the block changes, and a key you do not name never does. The
107
+ block is read with the same scan `yaml` mode uses, so it refuses the same constructs — a
108
+ single-quoted scalar containing `''` among them, which is how an apostrophe is written inside single
109
+ quotes, so `title: 'It''s a test'` comes back untouched. The block is also processed separately from
110
+ the body, which shows up in exactly one place: an unbalanced quotation mark in `title` cannot pair
111
+ with a mark in your first paragraph.
112
+
88
113
  `require "polytypo"` never loads the native `commonmarker` extension unless you actually call
89
114
  `Polytypo.transform` with `mode: "markdown"` — the require happens lazily, inside the markdown
90
115
  pipeline only. A single `Polytypo.transform` module method (not separate
@@ -0,0 +1,11 @@
1
+ # Paths under canonical polytypo's spec/ that this repository deliberately does not vendor, so
2
+ # check-vendored-spec.sh must not expect them here. Every other file canonical has at tag
3
+ # spec-v$(cat VERSION) must be present here, or the check fails naming it — which is how a
4
+ # vendored file that was deleted, or a canonical file that was never copied, is caught.
5
+ #
6
+ # An entry canonical does not have at that tag is an error, and so is an entry that is also
7
+ # present here: this list records deliberate omissions, not exemptions.
8
+ #
9
+ # CONFORMANCE.md is canonical's own conformance matrix, written after a release. Nothing here
10
+ # reads it, and it is the one canonical file a released spec version may still gain.
11
+ CONFORMANCE.md
@@ -18,17 +18,22 @@ one copy, shipped as part of the gem's own `lib/` payload and loaded via `File.r
18
18
  Editing a file here does not change the spec; it only drifts this copy from canonical. When
19
19
  canonical's `spec/` changes, re-copy the affected files here.
20
20
 
21
- CI checks that it was done. `script/check-vendored-spec.sh` compares every file in this
22
- directory against canonical `polytypo/polytypo` at tag `spec-v` + this directory's own
23
- `VERSION`, and fails on any difference. Three details. The files this repository authors
24
- itself are listed in `.not-canonical` and skipped — and a listed path that canonical *does*
25
- have is an error, so that list cannot be used to keep a forked copy of a canonical file. A
26
- `locales/*.json` file is compared in full when it carries its `sources` array, and against
27
- canonical minus that array when it does not, which is the shipped form three of the five
28
- runtimes vendor; the script reads which case it is off the file rather than being told. And a
29
- file here with no canonical counterpart is a failure, so a canonical rename cannot pass
30
- unnoticed. Completeness is deliberately not checked — each runtime vendors its own subset,
31
- and the subsets differ.
21
+ CI checks that it was done. `script/check-vendored-spec.sh` compares every file in this directory
22
+ against canonical `polytypo/polytypo` at tag `spec-v` + this directory's own `VERSION`, and fails
23
+ on any difference. Five details. The files this repository authors itself are listed in
24
+ `.not-canonical` and skipped — and a listed path that canonical *does* have is an error, so that
25
+ list cannot be used to keep a forked copy of a canonical file. A `locales/*.json` file is compared
26
+ in full when it carries its `sources` array, and against canonical minus that array when it does
27
+ not, which is the shipped form three of the five runtimes vendor; the script reads which case it
28
+ is off the file rather than being told. A file here with no canonical counterpart is a failure, so
29
+ a canonical rename cannot pass unnoticed. Completeness is checked from canonical's side rather
30
+ than this one: every file canonical has at that tag must be here unless `.not-vendored` names it,
31
+ so a vendored file that was deleted, or a canonical file that arrived later and was never copied,
32
+ fails naming itself, and an entry canonical does not have at that tag, or one that is also present
33
+ here, fails too. Here that list names `CONFORMANCE.md`, and nothing else. And the version itself
34
+ is checked: a tree faithful to the tag it claims while canonical has tagged a newer one is a
35
+ warning in CI and, with `--require-current`, a refusal in the release job, because a package must
36
+ not be published claiming a spec version canonical has moved past.
32
37
 
33
38
  Before that check existed, this half of the tree went stale unnoticed in four of the five
34
39
  ports at once: the data half is proved by the test suite, and nothing at all read the prose.
@@ -1 +1 @@
1
- 1.6.3
1
+ 1.8.0
@@ -1,5 +1,5 @@
1
1
  {
2
- "spec": "1.6.3",
2
+ "spec": "1.8.0",
3
3
  "locale": "cs",
4
4
  "cases": [
5
5
  {
@@ -1,5 +1,5 @@
1
1
  {
2
- "spec": "1.6.3",
2
+ "spec": "1.8.0",
3
3
  "locale": "de-CH",
4
4
  "cases": [
5
5
  {
@@ -1,5 +1,5 @@
1
1
  {
2
- "spec": "1.6.3",
2
+ "spec": "1.8.0",
3
3
  "locale": "de-DE",
4
4
  "cases": [
5
5
  {
@@ -763,6 +763,19 @@
763
763
  "in": "description: a---#b\n",
764
764
  "out": "description: a---#b\n",
765
765
  "note": "modes.md §3.8.6 with §3.4's character clause: without it this became `description: a – #b`, and everything from the hash became a comment — the value silently truncated to `a –`."
766
+ },
767
+ {
768
+ "id": "de-de-markdown-commonmark-frontmatter-keys",
769
+ "rule": "quotes",
770
+ "mode": "markdown",
771
+ "dialect": "commonmark",
772
+ "frontmatterKeys": [
773
+ "title",
774
+ "summary"
775
+ ],
776
+ "in": "---\ntitle: Er sagte \"hallo\" laut\nsummary: Noch \"eins\" hier\nslug: \"er-sagte-hallo\"\n---\n\nIm Text \"so\" hier.\n",
777
+ "out": "---\ntitle: Er sagte „hallo“ laut\nsummary: Noch „eins“ hier\nslug: \"er-sagte-hallo\"\n---\n\nIm Text „so“ hier.\n",
778
+ "note": "modes.md §3.7.4: two listed plain scalars in a locale whose quote glyphs differ from English, with an unlisted slug between the block and the body. Each listed scalar is its own span and the marks pair inside it, so the German pair appears three times and the slug keeps its straight quotes."
766
779
  }
767
780
  ]
768
781
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "spec": "1.6.3",
2
+ "spec": "1.8.0",
3
3
  "locale": "el",
4
4
  "cases": [
5
5
  {
@@ -1,5 +1,5 @@
1
1
  {
2
- "spec": "1.6.3",
2
+ "spec": "1.8.0",
3
3
  "locale": "en-GB",
4
4
  "cases": [
5
5
  {