pandorga 1.6.9 → 1.7.1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +37 -0
- data/DESIGN.md +9 -9
- data/_includes/content-runtime/30-includes.html +1 -1
- data/_includes/content-runtime/43-blocks.html +1 -1
- data/_includes/content-runtime/50-detail.html +5 -5
- data/_includes/content-runtime/60-fragments.html +1 -1
- data/_includes/page/network-graph.html +2 -2
- data/_includes/page/site-footer.html +2 -2
- data/_includes/theme/font-loader.html +2 -54
- data/_includes/theme/theme-vars-block.liquid +10 -18
- data/_layouts/articles.html +1 -1
- data/_layouts/projects.html +2 -2
- data/_layouts/resources.html +1 -1
- data/_layouts/shell.html +1 -1
- data/_layouts/text.html +4 -4
- data/_plugins/lib/writing_entry.rb +1 -1
- data/assets/css/article.css +3 -3
- data/assets/css/base.css +0 -79
- data/assets/css/global-link.css +0 -1
- data/assets/css/ledger/chrome.css +1 -1
- data/assets/css/ledger/cv.css +1 -1
- data/assets/css/ledger/detail.css +1 -1
- data/assets/css/ledger/footer.css +1 -1
- data/assets/css/ledger/home.css +13 -42
- data/assets/css/ledger/projects.css +2 -2
- data/assets/css/ledger/sources.css +3 -3
- data/assets/css/ledger/writing.css +1 -1
- data/examples/full/_config.yml +9 -0
- data/lib/pandorga/fonts.rb +235 -0
- data/lib/pandorga/jekyll/plugins/fonts.rb +17 -0
- data/lib/pandorga/jekyll/plugins/lib/writing_entry.rb +1 -1
- data/lib/pandorga/registry/schema.yml +21 -0
- data/lib/pandorga/version.rb +1 -1
- data/scripts/content/export-content-json.rb +1 -1
- data/scripts/generate-configuration-doc.rb +1 -1
- data/scripts/test/render-parity/load-runtime.mjs +1 -1
- data/scripts/test/test-css-structure.rb +20 -0
- data/scripts/test/test-discovery.rb +5 -0
- data/scripts/test/test-examples-build.rb +9 -0
- data/scripts/test/test-fonts.rb +91 -0
- data/scripts/test/test-listing-filter-contract.rb +1 -1
- data/scripts/test/test-shell-a11y.rb +21 -0
- data/scripts/validate.sh +1 -0
- metadata +4 -1
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
# PLT-AC-30. A site names its Google Fonts families in pandorga.fonts.
|
|
5
|
+
# Omitted roles keep Cinzel Decorative, Newsreader, and Courier Prime.
|
|
6
|
+
|
|
7
|
+
require "pathname"
|
|
8
|
+
require "yaml"
|
|
9
|
+
|
|
10
|
+
ROOT = Pathname.new(__dir__).join("..", "..").expand_path
|
|
11
|
+
|
|
12
|
+
def fail!(message)
|
|
13
|
+
warn "FAIL test-fonts: #{message}"
|
|
14
|
+
exit 1
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
require_relative "../../lib/pandorga/fonts"
|
|
18
|
+
|
|
19
|
+
DEFAULT_HREF = "https://fonts.googleapis.com/css2?family=Cinzel+Decorative:wght@400;700;900" \
|
|
20
|
+
"&family=Marcellus+SC:wght@400;700" \
|
|
21
|
+
"&family=Newsreader:wght@300;400;500;600;700" \
|
|
22
|
+
"&family=Courier+Prime:ital,wght@0,400;0,700;1,400;1,700" \
|
|
23
|
+
"&display=swap"
|
|
24
|
+
|
|
25
|
+
theme = YAML.safe_load(ROOT.join("_data/themes/shared.yml").read).fetch("fonts")
|
|
26
|
+
bare = Pandorga::Fonts.resolve(nil, nil)
|
|
27
|
+
from_theme = Pandorga::Fonts.resolve(nil, theme)
|
|
28
|
+
fail!("unset config dropped the ledger faces") unless Pandorga::Fonts.stylesheet_href(bare) == DEFAULT_HREF
|
|
29
|
+
fail!("theme tokens drifted from the ledger faces") unless Pandorga::Fonts.stylesheet_href(from_theme) == DEFAULT_HREF
|
|
30
|
+
|
|
31
|
+
fail!("title stack dropped Cinzel") unless Pandorga::Fonts.css_stack(from_theme, "title") == "'Cinzel Decorative', serif"
|
|
32
|
+
fail!("body stack dropped the serif fallback") unless Pandorga::Fonts.css_stack(from_theme, "body") == "'Newsreader', Georgia, serif"
|
|
33
|
+
fail!("mono stack dropped Courier Prime") unless Pandorga::Fonts.css_stack(from_theme, "mono").start_with?("'Courier Prime', ui-monospace")
|
|
34
|
+
|
|
35
|
+
custom = Pandorga::Fonts.resolve(
|
|
36
|
+
{
|
|
37
|
+
"title" => "Fraunces",
|
|
38
|
+
"body" => { "family" => "Source Serif 4", "weights" => [600, 400, 400] },
|
|
39
|
+
"mono" => { "family" => "IBM Plex Mono", "weights" => [400, 500], "italic" => true }
|
|
40
|
+
},
|
|
41
|
+
theme
|
|
42
|
+
)
|
|
43
|
+
custom_href = Pandorga::Fonts.stylesheet_href(custom)
|
|
44
|
+
fail!("custom title was not requested") unless custom_href.include?("family=Fraunces:wght@400;700")
|
|
45
|
+
fail!("custom title kept the Cinzel axis") if custom_href.include?("Cinzel")
|
|
46
|
+
fail!("body weights were not sorted") unless custom_href.include?("family=Source+Serif+4:wght@400;600")
|
|
47
|
+
fail!("mono italic axis is wrong") unless custom_href.include?("family=IBM+Plex+Mono:ital,wght@0,400;0,500;1,400;1,500")
|
|
48
|
+
fail!("unset label left Marcellus") unless custom_href.include?("family=Marcellus+SC:wght@400;700")
|
|
49
|
+
fail!("body change left the tagline on Newsreader") unless Pandorga::Fonts.css_stack(custom, "subtitle").start_with?("'Source Serif 4'")
|
|
50
|
+
|
|
51
|
+
# A font rename once replaced the letters "hind" inside the word "behind".
|
|
52
|
+
token = "be" + "Newsreader"
|
|
53
|
+
broken = []
|
|
54
|
+
Dir.glob(ROOT.join("**/*.{css,html,rb,js,mjs,md,liquid,yml}")).each do |path|
|
|
55
|
+
next if path.include?("/studio/assets/")
|
|
56
|
+
next if path.include?("/node_modules/")
|
|
57
|
+
next if path.end_with?("test-fonts.rb")
|
|
58
|
+
text = File.read(path)
|
|
59
|
+
next unless text.include?(token)
|
|
60
|
+
|
|
61
|
+
broken << Pathname.new(path).relative_path_from(ROOT).to_s
|
|
62
|
+
end
|
|
63
|
+
fail!("corrupted 'behind' left by a font rename (#{broken.size} files): #{broken.join(', ')}") unless broken.empty?
|
|
64
|
+
fail!("code face did not follow mono") unless Pandorga::Fonts.css_stack(custom, "code").start_with?("'IBM Plex Mono'")
|
|
65
|
+
|
|
66
|
+
kept = Pandorga::Fonts.resolve({ "title" => "Cinzel Decorative" }, theme)
|
|
67
|
+
fail!("naming the default title changed the stylesheet") unless Pandorga::Fonts.stylesheet_href(kept) == DEFAULT_HREF
|
|
68
|
+
|
|
69
|
+
ignored = Pandorga::Fonts.resolve({ "title" => "Fraunces</style>" }, theme)
|
|
70
|
+
fail!("a broken family name was accepted") unless Pandorga::Fonts.stylesheet_href(ignored) == DEFAULT_HREF
|
|
71
|
+
|
|
72
|
+
example = YAML.safe_load(ROOT.join("examples/full/_config.yml").read)
|
|
73
|
+
example_fonts = example.dig("pandorga", "fonts")
|
|
74
|
+
fail!("full example has no pandorga.fonts") unless example_fonts.is_a?(Hash)
|
|
75
|
+
fail!("full example changed the measured faces") unless Pandorga::Fonts.stylesheet_href(Pandorga::Fonts.resolve(example_fonts, theme)) == DEFAULT_HREF
|
|
76
|
+
|
|
77
|
+
loader = ROOT.join("_includes/theme/font-loader.html").read
|
|
78
|
+
shell = ROOT.join("_layouts/shell.html").read
|
|
79
|
+
fail!("loader no longer hands the href to the shell") unless loader.include?("__pandorgaFontsHref")
|
|
80
|
+
fail!("loader preloads the text faces") if loader.include?('rel="preload"')
|
|
81
|
+
fail!("text faces wait for the load event") if loader.include?("addEventListener('load'")
|
|
82
|
+
preconnect_at = shell.index("fonts.googleapis.com")
|
|
83
|
+
script_at = shell.index("theme/critical-preload.html")
|
|
84
|
+
fail!("font host is not preconnected before the preload script") unless preconnect_at && script_at && preconnect_at < script_at
|
|
85
|
+
fail!("text faces are not requested after the first paint") unless shell.include?("requestAnimationFrame") && shell.include?("__pandorgaFontsHref")
|
|
86
|
+
|
|
87
|
+
spec = ROOT.join("docs/spec.md").read
|
|
88
|
+
fail!("spec is missing PLT-AC-30") unless spec.include?("PLT-AC-30")
|
|
89
|
+
fail!("configuration reference omits pandorga.fonts") unless ROOT.join("docs/configuration.md").read.include?("pandorga.fonts")
|
|
90
|
+
|
|
91
|
+
puts "PASS test-fonts"
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
# on click; `filterItems` reads a fixed set of names. Nothing connects the
|
|
8
8
|
# two, so renaming a facet in a layout — `category` to `tag`, say — leaves the
|
|
9
9
|
# chips rendering, highlighting and pushing a query string while the list
|
|
10
|
-
#
|
|
10
|
+
# behind them never changes. That shipped on the Sources page: every click set
|
|
11
11
|
# a key nothing read.
|
|
12
12
|
#
|
|
13
13
|
# There is no build error and no console error to notice, so the contract is
|
|
@@ -27,4 +27,25 @@ fail!("footer home link still uses site.author alone") if FOOTER.include?(bare)
|
|
|
27
27
|
fail!("shell home link needs an identity.name fallback") unless SHELL.include?("site.pandorga.identity.name")
|
|
28
28
|
fail!("footer home link needs an identity.name fallback") unless FOOTER.include?("site.pandorga.identity.name")
|
|
29
29
|
|
|
30
|
+
# Decorative Material Symbols sit beside a text label. Without aria-hidden
|
|
31
|
+
# the ligature ("arrow_left_alt", "shuffle", an icon name) is read aloud.
|
|
32
|
+
ICON_FILES = [
|
|
33
|
+
ROOT.join("_layouts/text.html"),
|
|
34
|
+
ROOT.join("_includes/content-runtime/50-detail.html"),
|
|
35
|
+
ROOT.join("_includes/content-runtime/60-fragments.html"),
|
|
36
|
+
ROOT.join("_includes/content-runtime/30-includes.html")
|
|
37
|
+
].freeze
|
|
38
|
+
|
|
39
|
+
ICON_FILES.each do |path|
|
|
40
|
+
path.read.each_line.with_index(1) do |line, number|
|
|
41
|
+
next unless line.include?("material-symbols-outlined")
|
|
42
|
+
next if line.include?("querySelector")
|
|
43
|
+
next if line.include?("aria-hidden")
|
|
44
|
+
# Class token handed to a later span that already sets aria-hidden.
|
|
45
|
+
next if line.include?("cls:")
|
|
46
|
+
|
|
47
|
+
fail!("#{path.relative_path_from(ROOT)}:#{number}: decorative icon is exposed")
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
30
51
|
puts "PASS test-shell-a11y"
|
data/scripts/validate.sh
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pandorga
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.7.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- The Pandorga contributors
|
|
@@ -288,6 +288,7 @@ files:
|
|
|
288
288
|
- lib/pandorga/commands/serve.rb
|
|
289
289
|
- lib/pandorga/commands/studio_schema.rb
|
|
290
290
|
- lib/pandorga/discovery.rb
|
|
291
|
+
- lib/pandorga/fonts.rb
|
|
291
292
|
- lib/pandorga/hero_summary.rb
|
|
292
293
|
- lib/pandorga/jekyll.rb
|
|
293
294
|
- lib/pandorga/jekyll/generator.rb
|
|
@@ -303,6 +304,7 @@ files:
|
|
|
303
304
|
- lib/pandorga/jekyll/plugins/content_writing_index.rb
|
|
304
305
|
- lib/pandorga/jekyll/plugins/content_writing_paths.rb
|
|
305
306
|
- lib/pandorga/jekyll/plugins/discovery.rb
|
|
307
|
+
- lib/pandorga/jekyll/plugins/fonts.rb
|
|
306
308
|
- lib/pandorga/jekyll/plugins/force_utf8_encoding.rb
|
|
307
309
|
- lib/pandorga/jekyll/plugins/git_chronology.rb
|
|
308
310
|
- lib/pandorga/jekyll/plugins/git_metadata.rb
|
|
@@ -422,6 +424,7 @@ files:
|
|
|
422
424
|
- scripts/test/test-export-content-json-incremental.rb
|
|
423
425
|
- scripts/test/test-export.rb
|
|
424
426
|
- scripts/test/test-exported-fields-reach-the-view.rb
|
|
427
|
+
- scripts/test/test-fonts.rb
|
|
425
428
|
- scripts/test/test-form-control-theming.rb
|
|
426
429
|
- scripts/test/test-git-chronology.rb
|
|
427
430
|
- scripts/test/test-hero-name.rb
|