fr-docs 3.5.0__tar.gz → 3.6.0__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.
- {fr_docs-3.5.0 → fr_docs-3.6.0}/PKG-INFO +1 -1
- {fr_docs-3.5.0 → fr_docs-3.6.0}/fr_docs/build.py +3 -0
- {fr_docs-3.5.0 → fr_docs-3.6.0}/fr_docs/init.py +14 -4
- {fr_docs-3.5.0 → fr_docs-3.6.0}/fr_docs/update.py +1 -2
- {fr_docs-3.5.0 → fr_docs-3.6.0}/fr_docs.egg-info/PKG-INFO +1 -1
- {fr_docs-3.5.0 → fr_docs-3.6.0}/pyproject.toml +6 -3
- {fr_docs-3.5.0 → fr_docs-3.6.0}/LICENSE.md +0 -0
- {fr_docs-3.5.0 → fr_docs-3.6.0}/README.md +0 -0
- {fr_docs-3.5.0 → fr_docs-3.6.0}/fr_docs/__init__.py +0 -0
- {fr_docs-3.5.0 → fr_docs-3.6.0}/fr_docs/__main__.py +0 -0
- {fr_docs-3.5.0 → fr_docs-3.6.0}/fr_docs/config.py +0 -0
- {fr_docs-3.5.0 → fr_docs-3.6.0}/fr_docs/config_accessors.py +0 -0
- {fr_docs-3.5.0 → fr_docs-3.6.0}/fr_docs/frontmatter.py +0 -0
- {fr_docs-3.5.0 → fr_docs-3.6.0}/fr_docs/git.py +0 -0
- {fr_docs-3.5.0 → fr_docs-3.6.0}/fr_docs/html_pipeline.py +0 -0
- {fr_docs-3.5.0 → fr_docs-3.6.0}/fr_docs/markdown.py +0 -0
- {fr_docs-3.5.0 → fr_docs-3.6.0}/fr_docs/search.py +0 -0
- {fr_docs-3.5.0 → fr_docs-3.6.0}/fr_docs/slug.py +0 -0
- {fr_docs-3.5.0 → fr_docs-3.6.0}/fr_docs/syntax.py +0 -0
- {fr_docs-3.5.0 → fr_docs-3.6.0}/fr_docs/template.py +0 -0
- {fr_docs-3.5.0 → fr_docs-3.6.0}/fr_docs/utils.py +0 -0
- {fr_docs-3.5.0 → fr_docs-3.6.0}/fr_docs.egg-info/SOURCES.txt +0 -0
- {fr_docs-3.5.0 → fr_docs-3.6.0}/fr_docs.egg-info/dependency_links.txt +0 -0
- {fr_docs-3.5.0 → fr_docs-3.6.0}/fr_docs.egg-info/entry_points.txt +0 -0
- {fr_docs-3.5.0 → fr_docs-3.6.0}/fr_docs.egg-info/requires.txt +0 -0
- {fr_docs-3.5.0 → fr_docs-3.6.0}/fr_docs.egg-info/top_level.txt +0 -0
- {fr_docs-3.5.0 → fr_docs-3.6.0}/setup.cfg +0 -0
|
@@ -569,6 +569,9 @@ def main(argv=None) -> None:
|
|
|
569
569
|
if fonts_dir.is_dir():
|
|
570
570
|
out_fonts = Path(config["_out_dir"]) / "fonts"
|
|
571
571
|
out_fonts.mkdir(parents=True, exist_ok=True)
|
|
572
|
+
for stale in out_fonts.iterdir():
|
|
573
|
+
if stale.is_file():
|
|
574
|
+
stale.unlink()
|
|
572
575
|
for f in fonts_dir.iterdir():
|
|
573
576
|
if f.is_file():
|
|
574
577
|
shutil.copy2(f, out_fonts / f.name)
|
|
@@ -293,6 +293,8 @@ jobs:
|
|
|
293
293
|
uses: Omena0/fr-docs@main
|
|
294
294
|
"""
|
|
295
295
|
|
|
296
|
+
BROWSER_UA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
|
|
297
|
+
|
|
296
298
|
DEFAULT_CSS_URL = (
|
|
297
299
|
"https://fonts.googleapis.com/css2?"
|
|
298
300
|
"family=Inter:ital,opsz,wght@0,14..32,400..800"
|
|
@@ -303,9 +305,10 @@ FONT_FACE_RE = re.compile(
|
|
|
303
305
|
r"@font-face\s*\{\n"
|
|
304
306
|
r"\s*font-family:\s*['\"](?P<family>[^'\"]+)['\"]\s*;\n"
|
|
305
307
|
r"\s*font-style:\s*(?P<style>\w+)\s*;\n"
|
|
306
|
-
r"\s*font-weight:\s*(?P<weight
|
|
308
|
+
r"\s*font-weight:\s*(?P<weight>[\d\s]+)\s*;\n"
|
|
307
309
|
r"\s*font-display:\s*(?P<display>\w+)\s*;\n"
|
|
308
310
|
r"\s*src:\s*url\((?P<src>[^)]+)\)\s*format\(['\"](?P<format>[^'\"]+)['\"]\)\s*;\n"
|
|
311
|
+
r"(?:\s*unicode-range:\s*(?P<unicode_range>[^;]+);\n)?"
|
|
309
312
|
r"\}"
|
|
310
313
|
)
|
|
311
314
|
|
|
@@ -332,7 +335,7 @@ def download_file(url, dest_path) -> bool:
|
|
|
332
335
|
|
|
333
336
|
def fetch_fonts_css(css_url: str) -> str:
|
|
334
337
|
"""Fetch Google Fonts CSS text."""
|
|
335
|
-
req = urllib.request.Request(css_url, headers={"User-Agent":
|
|
338
|
+
req = urllib.request.Request(css_url, headers={"User-Agent": BROWSER_UA})
|
|
336
339
|
with urllib.request.urlopen(req, timeout=30) as resp:
|
|
337
340
|
return resp.read().decode("utf-8")
|
|
338
341
|
|
|
@@ -342,7 +345,7 @@ def download_font(url: str, dest: Path) -> bool:
|
|
|
342
345
|
if dest.exists() and dest.stat().st_size > 0:
|
|
343
346
|
return True
|
|
344
347
|
try:
|
|
345
|
-
req = urllib.request.Request(url, headers={"User-Agent":
|
|
348
|
+
req = urllib.request.Request(url, headers={"User-Agent": BROWSER_UA})
|
|
346
349
|
with urllib.request.urlopen(req, timeout=60) as resp:
|
|
347
350
|
data = resp.read()
|
|
348
351
|
if len(data) < 1000:
|
|
@@ -371,11 +374,18 @@ def run_fetch_fonts(docs_dir: Path, css_url: str = DEFAULT_CSS_URL) -> int:
|
|
|
371
374
|
print(f"Found {len(faces)} font-face rules")
|
|
372
375
|
|
|
373
376
|
local_rules = []
|
|
374
|
-
|
|
377
|
+
seen = set()
|
|
378
|
+
for family, style, weight, _display, src_url, fmt, _unicode_range in faces:
|
|
375
379
|
src_url = src_url.strip().strip("'\"")
|
|
376
380
|
fname = Path(src_url.split("?")[0]).name
|
|
377
381
|
if not fname:
|
|
378
382
|
continue
|
|
383
|
+
# De-duplicate: woff2 serves one file per unicode-range subset; keep the
|
|
384
|
+
# first occurrence per (family, weight, style) which is the latin block.
|
|
385
|
+
key = (family, weight, style)
|
|
386
|
+
if key in seen:
|
|
387
|
+
continue
|
|
388
|
+
seen.add(key)
|
|
379
389
|
dest = out_dir / fname
|
|
380
390
|
print(f" {family} {weight} {style} -> {fname}")
|
|
381
391
|
if not download_font(src_url, dest):
|
|
@@ -10,7 +10,6 @@ from .build import (
|
|
|
10
10
|
from .config import load_config
|
|
11
11
|
from .config_accessors import project_name
|
|
12
12
|
from .init import (
|
|
13
|
-
DEFAULT_CSS_URL,
|
|
14
13
|
FAVICON_SVG_URL,
|
|
15
14
|
SCRIPT_JS_URL,
|
|
16
15
|
STYLE_CSS_URL,
|
|
@@ -56,7 +55,7 @@ def update_resources(config):
|
|
|
56
55
|
fonts_dir = docs_path / "fonts"
|
|
57
56
|
if fonts_dir.is_dir():
|
|
58
57
|
old_count = len(list(fonts_dir.iterdir()))
|
|
59
|
-
result = run_fetch_fonts(docs_path
|
|
58
|
+
result = run_fetch_fonts(docs_path)
|
|
60
59
|
if result == 0:
|
|
61
60
|
new_count = len(list(fonts_dir.iterdir()))
|
|
62
61
|
if new_count > old_count:
|
|
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
|
|
|
6
6
|
|
|
7
7
|
[project]
|
|
8
8
|
name = "fr-docs"
|
|
9
|
-
version = "3.
|
|
9
|
+
version = "3.6.0"
|
|
10
10
|
description = "Fast static documentation generator with search, versioning, and zero-config setup"
|
|
11
11
|
readme = "README.md"
|
|
12
12
|
requires-python = ">=3.14"
|
|
@@ -106,5 +106,8 @@ fixable = [
|
|
|
106
106
|
"ALL",
|
|
107
107
|
]
|
|
108
108
|
|
|
109
|
-
[tool.
|
|
110
|
-
|
|
109
|
+
[tool.refurb]
|
|
110
|
+
ignore = [
|
|
111
|
+
"FURB107",
|
|
112
|
+
"FURB120",
|
|
113
|
+
]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|