fontlab-www-toolkit 1.0.4.dev3__tar.gz → 1.0.5.dev3__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fontlab-www-toolkit
3
- Version: 1.0.4.dev3
3
+ Version: 1.0.5.dev3
4
4
  Summary: Shared ProperDocs + MaterialX site builder and deploy helpers for FontLab web properties.
5
5
  Project-URL: Homepage, https://github.com/Fontlab/fontlab-www-toolkit
6
6
  Project-URL: Issues, https://github.com/Fontlab/fontlab-www-toolkit/issues
@@ -26,7 +26,6 @@ Requires-Dist: mkdocs>=1.6.1
26
26
  Requires-Dist: properdocs>=1.6.7
27
27
  Description-Content-Type: text/markdown
28
28
 
29
- <!-- this_file: README.md -->
30
29
 
31
30
  # fontlab-www-toolkit
32
31
 
@@ -56,8 +55,8 @@ Commands:
56
55
 
57
56
  | Command | Effect |
58
57
  |---|---|
59
- | `build [--skip_webflow]` | Pull Webflow stubs, build with MkDocs/ProperDocs, overlay `wf_cache/` + `static_docs/`, publish to `public/`. |
60
- | `pull-webflow` | Refresh `wf_cache/` only. |
58
+ | `build [--skip_webflow] [--update_stubs]` | Pull Webflow stubs, build with MkDocs/ProperDocs, overlay `wf_cache/` + `static_docs/`, publish to `public/`. |
59
+ | `pull-webflow [--update_stubs]` | Refresh `wf_cache/` only. |
61
60
  | `convert-old` | Regenerate OLD pages from `src_docs/old-pages.yml`. |
62
61
  | `clean` | Delete `build_docs/` and `public/`. |
63
62
  | `setup [--venv PATH] [--clear]` | Create / refresh a uv venv for the admin pipeline. |
@@ -88,6 +87,24 @@ webflow-import-url: https://example.webflow.io/page
88
87
  ---
89
88
  ```
90
89
 
90
+ ### Refreshing stub bodies (`--update_stubs`)
91
+
92
+ Normally only `wf_cache/` is refreshed; the stub Markdown body stays as a
93
+ placeholder (the cached HTML overlays it at build time). Pass `--update_stubs`
94
+ to `pull-webflow` or `build` to also rewrite each stub's **body** from the
95
+ freshly cached HTML, while preserving the stub's **frontmatter** verbatim:
96
+
97
+ ```bash
98
+ fontlab-www-toolkit pull-webflow --update_stubs
99
+ ```
100
+
101
+ For each stub it strips non-prose noise (`<script>`/`<style>`/`<noscript>` and
102
+ hidden Webflow *Windflow* plugin metadata), serves the cleaned cached HTML over
103
+ a loopback HTTP server, and runs [`url22md`](https://github.com/twardoch/url22md)
104
+ to extract Markdown. This requires the `url22md` CLI on `PATH` (or set
105
+ `url22md_bin` in config); it is an external runtime tool, not a packaged
106
+ dependency.
107
+
91
108
  ## Configuration
92
109
 
93
110
  You can customize the builder's behavior using a JSON configuration file (by default `fontlab-www-toolkit.json` in the root directory, or passed via `--config` CLI option). Alternatively, individual pages can specify page-specific overrides inside the input HTML:
@@ -115,6 +132,10 @@ The following settings can be overridden in the root configuration object:
115
132
  * **`old_pages_config`** (string): Path to the legacy pages mapping file. Defaults to `"src_docs/old-pages.yml"`.
116
133
  * **`mkdocs_command`** (string | array): The custom build command for MkDocs/ProperDocs. Can include the `{config_file}` placeholder.
117
134
  * **`user_agent`** (string): Custom User-Agent header used when pulling Webflow pages. Defaults to `"fontlab_www_toolkit"`.
135
+ * **`split_google_fonts`** (bool): When true (default), split a multi-family `fonts.googleapis.com/css2?family=A&family=B&…` link into one `?family=X&display=swap` link per family. This keeps web fonts loading even if a downstream step truncates the served URL at the first `&` (otherwise only the first family loads and the rest fall back to a system font).
136
+ * **`url22md_bin`** (string): Path to the `url22md` executable used by `--update_stubs`. Defaults to whatever is found on `PATH`.
137
+ * **`url22md_tool`** (int | null): Forces a specific `url22md` extraction engine (`1`=trafilatura, `3`=readability, …). Defaults to `1` for offline, deterministic extraction; set to `null` to let url22md run its full fallback chain (may reach cloud tools).
138
+ * **`url22md_timeout`** (int): Per-page extraction timeout in seconds. Defaults to `60`.
118
139
 
119
140
  ### Cloudinary Options
120
141
 
@@ -1,4 +1,3 @@
1
- <!-- this_file: README.md -->
2
1
 
3
2
  # fontlab-www-toolkit
4
3
 
@@ -28,8 +27,8 @@ Commands:
28
27
 
29
28
  | Command | Effect |
30
29
  |---|---|
31
- | `build [--skip_webflow]` | Pull Webflow stubs, build with MkDocs/ProperDocs, overlay `wf_cache/` + `static_docs/`, publish to `public/`. |
32
- | `pull-webflow` | Refresh `wf_cache/` only. |
30
+ | `build [--skip_webflow] [--update_stubs]` | Pull Webflow stubs, build with MkDocs/ProperDocs, overlay `wf_cache/` + `static_docs/`, publish to `public/`. |
31
+ | `pull-webflow [--update_stubs]` | Refresh `wf_cache/` only. |
33
32
  | `convert-old` | Regenerate OLD pages from `src_docs/old-pages.yml`. |
34
33
  | `clean` | Delete `build_docs/` and `public/`. |
35
34
  | `setup [--venv PATH] [--clear]` | Create / refresh a uv venv for the admin pipeline. |
@@ -60,6 +59,24 @@ webflow-import-url: https://example.webflow.io/page
60
59
  ---
61
60
  ```
62
61
 
62
+ ### Refreshing stub bodies (`--update_stubs`)
63
+
64
+ Normally only `wf_cache/` is refreshed; the stub Markdown body stays as a
65
+ placeholder (the cached HTML overlays it at build time). Pass `--update_stubs`
66
+ to `pull-webflow` or `build` to also rewrite each stub's **body** from the
67
+ freshly cached HTML, while preserving the stub's **frontmatter** verbatim:
68
+
69
+ ```bash
70
+ fontlab-www-toolkit pull-webflow --update_stubs
71
+ ```
72
+
73
+ For each stub it strips non-prose noise (`<script>`/`<style>`/`<noscript>` and
74
+ hidden Webflow *Windflow* plugin metadata), serves the cleaned cached HTML over
75
+ a loopback HTTP server, and runs [`url22md`](https://github.com/twardoch/url22md)
76
+ to extract Markdown. This requires the `url22md` CLI on `PATH` (or set
77
+ `url22md_bin` in config); it is an external runtime tool, not a packaged
78
+ dependency.
79
+
63
80
  ## Configuration
64
81
 
65
82
  You can customize the builder's behavior using a JSON configuration file (by default `fontlab-www-toolkit.json` in the root directory, or passed via `--config` CLI option). Alternatively, individual pages can specify page-specific overrides inside the input HTML:
@@ -87,6 +104,10 @@ The following settings can be overridden in the root configuration object:
87
104
  * **`old_pages_config`** (string): Path to the legacy pages mapping file. Defaults to `"src_docs/old-pages.yml"`.
88
105
  * **`mkdocs_command`** (string | array): The custom build command for MkDocs/ProperDocs. Can include the `{config_file}` placeholder.
89
106
  * **`user_agent`** (string): Custom User-Agent header used when pulling Webflow pages. Defaults to `"fontlab_www_toolkit"`.
107
+ * **`split_google_fonts`** (bool): When true (default), split a multi-family `fonts.googleapis.com/css2?family=A&family=B&…` link into one `?family=X&display=swap` link per family. This keeps web fonts loading even if a downstream step truncates the served URL at the first `&` (otherwise only the first family loads and the rest fall back to a system font).
108
+ * **`url22md_bin`** (string): Path to the `url22md` executable used by `--update_stubs`. Defaults to whatever is found on `PATH`.
109
+ * **`url22md_tool`** (int | null): Forces a specific `url22md` extraction engine (`1`=trafilatura, `3`=readability, …). Defaults to `1` for offline, deterministic extraction; set to `null` to let url22md run its full fallback chain (may reach cloud tools).
110
+ * **`url22md_timeout`** (int): Per-page extraction timeout in seconds. Defaults to `60`.
90
111
 
91
112
  ### Cloudinary Options
92
113
 
@@ -22,27 +22,42 @@ from fontlab_www_toolkit.builder import BuildPaths, SiteBuilder, setup_environme
22
22
  class Cli:
23
23
  """Build, pull-webflow, convert-old, clean, or setup a FontLab site repo."""
24
24
 
25
- def build(self, root: str | None = None, skip_webflow: bool = False, config: str | None = None) -> None:
25
+ def build(
26
+ self,
27
+ root: str | None = None,
28
+ skip_webflow: bool = False,
29
+ update_stubs: bool = False,
30
+ config: str | None = None,
31
+ ) -> None:
26
32
  """Full build: pull Webflow (unless skipped), build, overlay, publish.
27
33
 
28
34
  Args:
29
35
  root: site repo root; defaults to the current working directory.
30
36
  skip_webflow: if true, do not refresh ``wf_cache/`` before building.
37
+ update_stubs: if true, rewrite each Webflow stub's body from the
38
+ cached HTML (via url22md), preserving the original frontmatter.
31
39
  config: path to the JSON configuration file.
32
40
  """
33
41
  builder, paths = _builder(root, config=config)
34
- builder.build(pull_webflow=not skip_webflow)
42
+ builder.build(pull_webflow=not skip_webflow, update_stubs=update_stubs)
35
43
  print(f"Published {paths.public}")
36
44
 
37
- def pull_webflow(self, root: str | None = None, config: str | None = None) -> None:
45
+ def pull_webflow(
46
+ self,
47
+ root: str | None = None,
48
+ update_stubs: bool = False,
49
+ config: str | None = None,
50
+ ) -> None:
38
51
  """Refresh ``wf_cache/`` only.
39
52
 
40
53
  Args:
41
54
  root: site repo root; defaults to the current working directory.
55
+ update_stubs: if true, rewrite each Webflow stub's body from the
56
+ cached HTML (via url22md), preserving the original frontmatter.
42
57
  config: path to the JSON configuration file.
43
58
  """
44
59
  builder, paths = _builder(root, config=config)
45
- for path in builder.pull_webflow():
60
+ for path in builder.pull_webflow(update_stubs=update_stubs):
46
61
  print(path.relative_to(paths.root))
47
62
 
48
63
  def convert_old(self, root: str | None = None, config: str | None = None) -> None:
@@ -79,6 +94,7 @@ class Cli:
79
94
  def version(self) -> None:
80
95
  """Print the package version and exit."""
81
96
  from fontlab_www_toolkit import __version__
97
+
82
98
  print(__version__)
83
99
 
84
100
 
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
18
18
  commit_id: str | None
19
19
  __commit_id__: str | None
20
20
 
21
- __version__ = version = '1.0.4.dev3'
22
- __version_tuple__ = version_tuple = (1, 0, 4, 'dev3')
21
+ __version__ = version = '1.0.5.dev3'
22
+ __version_tuple__ = version_tuple = (1, 0, 5, 'dev3')
23
23
 
24
24
  __commit_id__ = commit_id = None