@lark-apaas/coding-steering 0.1.18-dev.ec88bb5 → 0.1.18-dev.ee5404f
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.
- package/package.json +1 -1
- package/steering/design-html/skills/pptx-style-extract/SKILL.md +58 -22
- package/steering/design-html/skills/pptx-style-extract/font-fallback.yaml +3 -3
- package/steering/design-html/skills/pptx-style-extract/scripts/census.py +18 -12
- package/steering/design-html/skills/pptx-style-extract/scripts/check_v2.py +153 -8
- package/steering/design-html/skills/pptx-style-extract/scripts/draft.py +1659 -240
- package/steering/design-html/skills/pptx-style-extract/scripts/extract.py +325 -22
- package/steering/design-html/skills/pptx-style-extract/scripts/ooxml.py +1 -1
- package/steering/design-html/skills/pptx-style-extract/scripts/package.py +289 -154
- package/steering/design-html/skills/pptx-style-extract/scripts/parts.py +6 -3
- package/steering/design-html/skills/pptx-style-extract/scripts/query.py +4 -9
- package/steering/design-html/skills/pptx-style-extract/scripts/render_pages.py +16 -10
- package/steering/design-html/skills/pptx-style-extract/scripts/test_background_composite.py +57 -0
- package/steering/design-html/skills/pptx-style-extract/scripts/test_color_contract.py +58 -0
- package/steering/design-html/skills/pptx-style-extract/scripts/test_design_consumer_contract.py +62 -0
- package/steering/design-html/skills/pptx-style-extract/scripts/test_layout_css.py +98 -0
- package/steering/design-html/skills/pptx-style-extract/scripts/test_rounded_contract.py +112 -0
- package/steering/design-html/skills/pptx-style-extract/scripts/test_text_role_contract.py +168 -0
- package/steering/design-html/skills/pptx-style-extract/v2-format-spec.md +26 -15
- package/steering/design-html/skills/slide-deck/SKILL.md +15 -20
- package/steering/design-html/skills/slide-deck/scripts/check_local_references.py +179 -0
|
@@ -38,7 +38,7 @@ L 层判断单 schema(<l-out-dir> 四个文件,这段就是填写说明书
|
|
|
38
38
|
assets: # 可选;无资产包可整段省略
|
|
39
39
|
- id: bg-cover # 必填。命名规则 <kind 前缀>-<语义名>,
|
|
40
40
|
# logo- / slogan- / bg- / texture- / icon-
|
|
41
|
-
source_media:
|
|
41
|
+
source_media: <原图文件名> # media-out/ 里的**原图**文件名(不是压缩版)
|
|
42
42
|
kind: background # logo|slogan|background|texture|icon
|
|
43
43
|
role: cover # background/icon 用;封闭枚举见规范 §2
|
|
44
44
|
theme: dark # 双主题包按需
|
|
@@ -80,9 +80,9 @@ L 层判断单 schema(<l-out-dir> 四个文件,这段就是填写说明书
|
|
|
80
80
|
|
|
81
81
|
colors:
|
|
82
82
|
surface: "#FFFFFF"
|
|
83
|
-
primary: "#
|
|
83
|
+
primary: "#RRGGBB"
|
|
84
84
|
safe-area:
|
|
85
|
-
content: {top:
|
|
85
|
+
content: {top: <px>, right: <px>, bottom: <px>, left: <px>, applies-to: [content]}
|
|
86
86
|
confidence: medium
|
|
87
87
|
|
|
88
88
|
--------------------------------------------------------------------------------
|
|
@@ -98,7 +98,8 @@ L 层判断单 schema(<l-out-dir> 四个文件,这段就是填写说明书
|
|
|
98
98
|
role: cover
|
|
99
99
|
background: bg-cover
|
|
100
100
|
slots:
|
|
101
|
-
- {role: title, box: [
|
|
101
|
+
- {role: title, box: [<x>, <y>, <w>, <h>], type: title,
|
|
102
|
+
css: "<由源模板转译出的 CSS 声明串>"}
|
|
102
103
|
confidence: high
|
|
103
104
|
|
|
104
105
|
可选 `body:` 块标量 —— 追加到 layouts.md frontmatter 之后作为说明正文。
|
|
@@ -139,9 +140,11 @@ ASSET_CONSUMER_FIELDS = ['path', 'url', 'color', 'full', 'kind', 'role',
|
|
|
139
140
|
ASSET_AUDIT_FIELDS = ['boxes', 'aspect', 'mark', 'confidence']
|
|
140
141
|
KIND_PREFIX = {'background': 'bg', 'logo': 'logo', 'slogan': 'slogan',
|
|
141
142
|
'texture': 'texture', 'icon': 'icon'}
|
|
142
|
-
#
|
|
143
|
-
|
|
144
|
-
|
|
143
|
+
# 交付包的 ref/ 只留 audit.yaml(人复核数值出处用,几 KB)。
|
|
144
|
+
# 频次原表、聚类原始数据、extract.json、重建图、logo 候选图全部留在 stage1 抽取目录,
|
|
145
|
+
# 不拷进包——规范原本指望「下发时链路剥离」,但链路上没有环节真的剥离,结果
|
|
146
|
+
# 审计材料带着「别读我」一起进消费上下文,还占掉包体的大头。
|
|
147
|
+
REF_CARRY = ()
|
|
145
148
|
|
|
146
149
|
|
|
147
150
|
class Fail(SystemExit):
|
|
@@ -272,6 +275,10 @@ def truthy(v):
|
|
|
272
275
|
return str(v).strip().lower() in ('1', 'true', 'yes', 'on')
|
|
273
276
|
|
|
274
277
|
|
|
278
|
+
# 浏览器能解码的图片格式。落进包的资产必须在此列,否则消费端引用到就是一张空白图。
|
|
279
|
+
WEB_SAFE_EXT = {'png', 'jpg', 'jpeg', 'webp', 'gif', 'svg', 'avif'}
|
|
280
|
+
|
|
281
|
+
|
|
275
282
|
def asset_ext(name):
|
|
276
283
|
return name.rsplit('.', 1)[-1].lower() if '.' in name else ''
|
|
277
284
|
|
|
@@ -351,12 +358,25 @@ def place_assets(manifest, extract, stage1, pack):
|
|
|
351
358
|
entry['path'] = 'assets/%ss/%s.%s' % (kind, base, cext)
|
|
352
359
|
if truthy(a.get('use_full')):
|
|
353
360
|
oext = asset_ext(row['out'])
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
361
|
+
if oext.lower() in WEB_SAFE_EXT:
|
|
362
|
+
fdst = os.path.join(sub, '%s@full.%s' % (base, oext))
|
|
363
|
+
shutil.copy2(orig_path, fdst)
|
|
364
|
+
copied.append(fdst)
|
|
365
|
+
entry['full'] = 'assets/%ss/%s@full.%s' % (kind, base, oext)
|
|
366
|
+
else:
|
|
367
|
+
# 原图是浏览器不解码的格式(tiff/bmp 之类)。落进包并在 design.md
|
|
368
|
+
# 里声明成可用资源,消费端引用它就是一张空白图——实测踩过一次,
|
|
369
|
+
# 封面与结束页因此空白。压缩版已经带着全部像素,full 不给。
|
|
370
|
+
print(' ⚠ %s 的原图是 .%s,浏览器不解码,只给压缩版' % (aid, oext))
|
|
358
371
|
else:
|
|
359
372
|
oext = asset_ext(row['out'])
|
|
373
|
+
if oext.lower() not in WEB_SAFE_EXT:
|
|
374
|
+
# 转码两条路(Pillow / sips)都没成,原图又是浏览器不解码的格式。
|
|
375
|
+
# 照落进去就是把一张永远显示不出来的图当资产下发——实测封面因此空白。
|
|
376
|
+
raise Fail('%s: 原图是 .%s,浏览器不解码,而转码没有产物'
|
|
377
|
+
'(extract.json 里看 transcode_blocked 的原因)。'
|
|
378
|
+
'装上 Pillow 重跑抽取,或把这条资产从 manifest 删掉'
|
|
379
|
+
'并在 gaps 写明。' % (aid, oext))
|
|
360
380
|
dst = os.path.join(sub, '%s.%s' % (base, oext))
|
|
361
381
|
shutil.copy2(orig_path, dst)
|
|
362
382
|
copied.append(dst)
|
|
@@ -382,7 +402,7 @@ def place_assets(manifest, extract, stage1, pack):
|
|
|
382
402
|
if boxes:
|
|
383
403
|
au['boxes'] = boxes
|
|
384
404
|
# aspect 取**未取整**的 box —— 从取整后的整数反算会明显偏
|
|
385
|
-
#
|
|
405
|
+
# 先取整再相除,误差会落到小数点后两位,logo 这种细长框尤其明显。
|
|
386
406
|
raw = clusters[0]['box']
|
|
387
407
|
if raw.get('h'):
|
|
388
408
|
au['aspect'] = round(raw['w'] / float(raw['h']), 3)
|
|
@@ -406,6 +426,27 @@ def _pages_of(extract, source_media):
|
|
|
406
426
|
return sorted(pages)
|
|
407
427
|
|
|
408
428
|
|
|
429
|
+
def _archetypes_using(layouts_text, aid, key='asset'):
|
|
430
|
+
"""layouts.yaml 里哪些 archetype 引用了这个资产。
|
|
431
|
+
|
|
432
|
+
key='asset' 查 slots 里的图片槽;key='background' 查页型底图。
|
|
433
|
+
"""
|
|
434
|
+
out, cur, sect = [], None, None
|
|
435
|
+
for line in (layouts_text or '').split('\n'):
|
|
436
|
+
if re.match(r'^\w[\w-]*:\s*$', line):
|
|
437
|
+
sect = line.split(':')[0]
|
|
438
|
+
continue
|
|
439
|
+
if sect != 'layouts':
|
|
440
|
+
continue
|
|
441
|
+
m = re.match(r'^ ([\w-]+):\s*$', line)
|
|
442
|
+
if m:
|
|
443
|
+
cur = m.group(1)
|
|
444
|
+
continue
|
|
445
|
+
if cur and re.search(r'%s:\s*%s\b' % (key, re.escape(aid)), line) and cur not in out:
|
|
446
|
+
out.append(cur)
|
|
447
|
+
return out
|
|
448
|
+
|
|
449
|
+
|
|
409
450
|
def expand_placeholders(body, manifest, consumer, audit, extract, layouts_text):
|
|
410
451
|
"""body.md 里的 `{{ASSET_TABLE}}` / `{{LAYOUT_LIST}}` 由本脚本按落盘真值渲染——
|
|
411
452
|
路径与页型清单是打包期才确定的事实,不该由 L 层手抄(抄错就是死链)。"""
|
|
@@ -415,18 +456,19 @@ def expand_placeholders(body, manifest, consumer, audit, extract, layouts_text):
|
|
|
415
456
|
for aid, e in consumer.items():
|
|
416
457
|
pages = _pages_of(extract, src_of.get(aid))
|
|
417
458
|
box = (audit.get(aid) or {}).get('boxes') or []
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
when = '固定位 (%d, %d),尺寸 %dx%d px' % tuple(b)
|
|
425
|
-
when += (',全 %d 页里只出现在第 %s 页' % (extract['counts']['slides'],
|
|
426
|
-
'、'.join(map(str, pages)))
|
|
427
|
-
if pages and len(pages) <= 4 else ',每页固定放一次')
|
|
459
|
+
# 单元格保持短句:哪个页型用哪张由 `background` 字段决定,
|
|
460
|
+
# 那句说明放在表格前一次即可,逐行重复只是把同一句抄 N 遍。
|
|
461
|
+
if e['kind'] == 'background':
|
|
462
|
+
users = _archetypes_using(layouts_text, aid, key='background')
|
|
463
|
+
when = ('%s 用它' % '/'.join('`%s`' % o for o in users[:6])
|
|
464
|
+
if users else '未被任何页型引用')
|
|
428
465
|
else:
|
|
429
|
-
|
|
466
|
+
# 位置逐页型不同(同一 logo 常在封面左上、内容页右上,尺寸也不同),
|
|
467
|
+
# 所以这里只给归属,坐标一律交给 layouts.md 的 slots。
|
|
468
|
+
owners = _archetypes_using(layouts_text, aid)
|
|
469
|
+
when = ('%s 这 %d 个页型带它' % ('/'.join('`%s`' % o for o in owners[:6]),
|
|
470
|
+
len(owners))
|
|
471
|
+
if owners else '⚠ 没有页型声明它的位置,本包不使用它')
|
|
430
472
|
f = '`%s`' % e['path'] if e.get('path') else (
|
|
431
473
|
'`%s`' % e['url'] if e.get('url') else '纯色 `%s`' % e.get('color'))
|
|
432
474
|
if e.get('full'):
|
|
@@ -466,7 +508,7 @@ def render_assets_block(consumer):
|
|
|
466
508
|
|
|
467
509
|
# ------------------------------------------------- 数值可追溯机检(抄错即 FAIL)
|
|
468
510
|
HEX_RE = re.compile(r'#([0-9A-Fa-f]{6})\b')
|
|
469
|
-
FONTSIZE_RE = re.compile(r'\
|
|
511
|
+
FONTSIZE_RE = re.compile(r'\b(?:fontSize|font-size):\s*([\d.]+)px')
|
|
470
512
|
BOX_RE = re.compile(r'\bbox:\s*\[\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*,'
|
|
471
513
|
r'\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*\]')
|
|
472
514
|
KEYLINE_RE = re.compile(r'^(\s*)-?\s*([A-Za-z_][\w-]*):\s*(.*)$')
|
|
@@ -604,6 +646,47 @@ def _box_hit(box, idx):
|
|
|
604
646
|
% (best[0], best[1], best[2], best[3], best[4], bestd))
|
|
605
647
|
|
|
606
648
|
|
|
649
|
+
# 判断产物:L 层看着背景图划出来的区域,本就不该命中普查值——整键豁免,
|
|
650
|
+
# 不要求写 derived。逼它们走 derived 只会把整段豁免掉,机检反而更弱。
|
|
651
|
+
JUDGEMENT_KEYS = frozenset(('avoid', 'text_safe', 'pairing_rule'))
|
|
652
|
+
|
|
653
|
+
|
|
654
|
+
def media_integrity(stage1, extract):
|
|
655
|
+
"""extract.json 记录的尺寸,必须和磁盘上那个文件真实的尺寸一致。
|
|
656
|
+
|
|
657
|
+
这条挡的是「记录全对、文件被顶替」——两个 media 的输出名撞车时,后写的覆盖先写的,
|
|
658
|
+
extract.json 里各自的记录都还是对的,任何只读记录的检查都发现不了;只有把记录和
|
|
659
|
+
文件本身对一遍才抓得到。实测某模板因此把一张 109x109 的图当成了整页背景。
|
|
660
|
+
"""
|
|
661
|
+
try:
|
|
662
|
+
from PIL import Image
|
|
663
|
+
except Exception:
|
|
664
|
+
return [] # 没有 Pillow 就量不了,跳过而不是假装通过
|
|
665
|
+
bad, seen = [], {}
|
|
666
|
+
for m in extract.get('media') or []:
|
|
667
|
+
for key, rel in (('source_px', m.get('out')),
|
|
668
|
+
('compressed_px', m.get('compressed_out'))):
|
|
669
|
+
rec = m.get(key)
|
|
670
|
+
if not rel or not rec:
|
|
671
|
+
continue
|
|
672
|
+
path = os.path.join(stage1, rel)
|
|
673
|
+
if not os.path.exists(path):
|
|
674
|
+
bad.append('%s 的 %s 指向 %s,文件不存在' % (m['media'], key, rel))
|
|
675
|
+
continue
|
|
676
|
+
try:
|
|
677
|
+
with Image.open(path) as im:
|
|
678
|
+
real = list(im.size)
|
|
679
|
+
except Exception:
|
|
680
|
+
continue
|
|
681
|
+
if real != list(rec):
|
|
682
|
+
bad.append('%s 的 %s 记录 %s,但 %s 实际是 %s'
|
|
683
|
+
% (m['media'], key, rec, rel, real))
|
|
684
|
+
if rel in seen and seen[rel] != m['media']:
|
|
685
|
+
bad.append('%s 与 %s 都写到 %s' % (seen[rel], m['media'], rel))
|
|
686
|
+
seen[rel] = m['media']
|
|
687
|
+
return bad
|
|
688
|
+
|
|
689
|
+
|
|
607
690
|
def trace_check(pack, extract, shapes, derived_values, derived_tokens, factor):
|
|
608
691
|
"""产物里每个 hex / 字号 / slot 坐标都必须可追溯到普查值或 derived 声明。"""
|
|
609
692
|
idx = build_trace_index(extract, shapes)
|
|
@@ -614,6 +697,9 @@ def trace_check(pack, extract, shapes, derived_values, derived_tokens, factor):
|
|
|
614
697
|
if not text:
|
|
615
698
|
continue
|
|
616
699
|
for lineno, path, raw in _scan_keyed(text):
|
|
700
|
+
if JUDGEMENT_KEYS & set(path):
|
|
701
|
+
checked['judgement'] += 1
|
|
702
|
+
continue
|
|
617
703
|
exempt_token = any(k in derived_tokens for k in path)
|
|
618
704
|
for m in HEX_RE.finditer(raw):
|
|
619
705
|
val = '#' + m.group(1).upper()
|
|
@@ -762,106 +848,6 @@ def build_package_manifest(manifest, consumer, audit, extract, pack):
|
|
|
762
848
|
return {k: v for k, v in pkg.items() if v is not None}
|
|
763
849
|
|
|
764
850
|
|
|
765
|
-
def layout_fast_index(layouts_blocks, max_slots=4):
|
|
766
|
-
if not layouts_blocks:
|
|
767
|
-
return []
|
|
768
|
-
blocks = {k: (inline, lines) for k, inline, lines in layouts_blocks}
|
|
769
|
-
if 'layouts' not in blocks:
|
|
770
|
-
return []
|
|
771
|
-
items = []
|
|
772
|
-
cur = None
|
|
773
|
-
for line in blocks['layouts'][1]:
|
|
774
|
-
m = re.match(r'^ ([\w-]+):\s*$', line)
|
|
775
|
-
if m:
|
|
776
|
-
cur = {'id': m.group(1), 'name': '', 'role': '', 'background': '', 'slots': []}
|
|
777
|
-
items.append(cur)
|
|
778
|
-
continue
|
|
779
|
-
if not cur:
|
|
780
|
-
continue
|
|
781
|
-
m = re.match(r'^ (name|role|background):\s*(.+?)\s*$', line)
|
|
782
|
-
if m:
|
|
783
|
-
cur[m.group(1)] = unquote(m.group(2))
|
|
784
|
-
continue
|
|
785
|
-
m = re.match(r'^\s{6}-\s*\{(.+)\}\s*$', line)
|
|
786
|
-
if m and len(cur['slots']) < max_slots:
|
|
787
|
-
raw = m.group(1)
|
|
788
|
-
role = re.search(r'role:\s*([^,}]+)', raw)
|
|
789
|
-
box = re.search(r'box:\s*\[([^\]]+)\]', raw)
|
|
790
|
-
typ = re.search(r'type:\s*([^,}]+)', raw)
|
|
791
|
-
if role and box:
|
|
792
|
-
label = unquote(role.group(1).strip())
|
|
793
|
-
if typ:
|
|
794
|
-
label += '/' + unquote(typ.group(1).strip())
|
|
795
|
-
cur['slots'].append('%s [%s]' % (label, box.group(1).strip()))
|
|
796
|
-
out = []
|
|
797
|
-
for item in items:
|
|
798
|
-
parts = ['`%s`' % item['id']]
|
|
799
|
-
if item.get('name'):
|
|
800
|
-
parts.append(item['name'])
|
|
801
|
-
if item.get('role'):
|
|
802
|
-
parts.append(item['role'])
|
|
803
|
-
if item.get('background'):
|
|
804
|
-
parts.append('背景 `%s`' % item['background'])
|
|
805
|
-
slots = ';'.join(item['slots'])
|
|
806
|
-
out.append('%s:%s' % (' / '.join(parts), slots or '按最接近用途套用'))
|
|
807
|
-
return out
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
def render_fast_path(manifest, consumer, has_sidecar, canvas, layouts_index=None):
|
|
811
|
-
"""Render the small consumer-first block that keeps runtime agents out of ref/."""
|
|
812
|
-
cover = next((aid for aid, a in consumer.items()
|
|
813
|
-
if a.get('kind') == 'background' and a.get('role') == 'cover'), None)
|
|
814
|
-
content_bgs = [aid for aid, a in consumer.items()
|
|
815
|
-
if a.get('kind') == 'background' and a.get('role') == 'content']
|
|
816
|
-
logos = [aid for aid, a in consumer.items() if a.get('kind') in ('logo', 'slogan')]
|
|
817
|
-
assets = []
|
|
818
|
-
for aid, a in consumer.items():
|
|
819
|
-
path = a.get('path') or a.get('color') or a.get('url')
|
|
820
|
-
role = a.get('role') or a.get('kind')
|
|
821
|
-
if path:
|
|
822
|
-
assets.append('`%s` -> `%s` (%s)' % (aid, path, role))
|
|
823
|
-
if len(assets) > 8:
|
|
824
|
-
assets = assets[:8] + ['其余资产见 frontmatter `assets`,不要去 `ref/` 里临时挑图。']
|
|
825
|
-
|
|
826
|
-
lines = [
|
|
827
|
-
'## Agent Fast Path',
|
|
828
|
-
'',
|
|
829
|
-
'消费本风格时先读这一节;它是给生成 Agent 的短路径,目标是把风格理解控制在 1 分钟内,避免把审计材料重新理解一遍。',
|
|
830
|
-
'',
|
|
831
|
-
'- **时间预算**:风格导入最多做 1 次 `read_file design.md`。本节已经内联常用坐标,读完后必须直接开始生成,不要再探索风格包。',
|
|
832
|
-
'- **只读入口**:常规生成只需要 `design.md`。只有本节的版式索引无法覆盖目标页时,才打开 %s。'
|
|
833
|
-
% ('`layouts.md`' if has_sidecar else '`design.md` 里的 `layouts`'),
|
|
834
|
-
'- **附件/zip 兜底**:如果当前内容来自 zip 附件的文本摘要,直接使用摘要中 `design.md` / `layouts.md` 的文本;不要尝试修复 zip、解析二进制、搜索附件目录或重建压缩包。',
|
|
835
|
-
'- **禁止动作**:不要读取 `ref/color-freq-raw.json`、`ref/font-clusters.json`、`ref/extract.json`、`ref/rebuild/`、`ref/rebuild/png/*`;不要 summarize / view 参考页;不要重新统计颜色、字体或版式。',
|
|
836
|
-
'- **信息来源优先级**:本节 > `## Usage` > frontmatter `assets` / `colors` / `typography` > `layouts.md`。除此之外的文件只用于人工审计,不用于生成。',
|
|
837
|
-
'- **缺信息时降级**:如果某个细节本节没有写,用 frontmatter token 和最接近的 `layouts.md` archetype 推断;不要打开审计文件补证。',
|
|
838
|
-
]
|
|
839
|
-
if canvas:
|
|
840
|
-
lines.append('- **画布**:所有坐标按 `%dx%d` 绝对像素理解。' % tuple(canvas))
|
|
841
|
-
if cover:
|
|
842
|
-
lines.append('- **封面背景**:优先使用 `%s`;整幅铺满画布,禁止自造渐变替代。' % cover)
|
|
843
|
-
if content_bgs:
|
|
844
|
-
lines.append('- **内容页背景**:按 `layouts.md` 中 archetype 的 `background` 字段取;常用内容背景为 %s。'
|
|
845
|
-
% '、'.join('`%s`' % x for x in content_bgs[:4]))
|
|
846
|
-
if cover or content_bgs:
|
|
847
|
-
lines.append('- **背景安全区**:背景图和版式必须配对。按 archetype 的 `background`、`text_safe`、`avoid` 一起放文字和卡片;标题、正文、关键数字、图表、卡片、时间线及其容器的外接矩形都不得压到背景视觉主体、强光斑、深色透明区上,透明容器也不能跨进禁放区。')
|
|
848
|
-
if logos:
|
|
849
|
-
lines.append('- **标识资产**:只使用 %s;不得重画、不得改比例。'
|
|
850
|
-
% '、'.join('`%s`' % x for x in logos))
|
|
851
|
-
lines += [
|
|
852
|
-
'- **配色与字体**:颜色只取 frontmatter `colors`;字体/字号只取 frontmatter `typography`;内容主题不得引入新色相。',
|
|
853
|
-
'- **版式**:优先使用下面内联版式索引;需要更多 slot 时才读 `layouts.md`;不要用 `ref/rebuild/png` 反推坐标。',
|
|
854
|
-
]
|
|
855
|
-
if layouts_index:
|
|
856
|
-
lines += ['', '内联版式索引(先用这里,不要为了选页型再读文件):']
|
|
857
|
-
lines += ['- ' + x for x in layouts_index]
|
|
858
|
-
if assets:
|
|
859
|
-
lines += ['', '关键资产:']
|
|
860
|
-
lines += ['- ' + a for a in assets]
|
|
861
|
-
lines.append('')
|
|
862
|
-
return '\n'.join(lines) + '\n'
|
|
863
|
-
|
|
864
|
-
|
|
865
851
|
def strip_agent_fast_path(body):
|
|
866
852
|
if '## Agent Fast Path' not in body:
|
|
867
853
|
return body
|
|
@@ -869,8 +855,7 @@ def strip_agent_fast_path(body):
|
|
|
869
855
|
count=1, flags=re.S).lstrip('\n')
|
|
870
856
|
|
|
871
857
|
|
|
872
|
-
def build_design(manifest, l_frontmatter, consumer, body, has_sidecar, canvas
|
|
873
|
-
layouts_index=None):
|
|
858
|
+
def build_design(manifest, l_frontmatter, consumer, body, has_sidecar, canvas):
|
|
874
859
|
blocks = {k: (inline, lines) for k, inline, lines in l_frontmatter}
|
|
875
860
|
bad = set(blocks) - L_FRONTMATTER_KEYS
|
|
876
861
|
if bad:
|
|
@@ -908,9 +893,9 @@ def build_design(manifest, l_frontmatter, consumer, body, has_sidecar, canvas,
|
|
|
908
893
|
out.append('canvas: %dx%d' % tuple(canvas))
|
|
909
894
|
out.append('---')
|
|
910
895
|
text = '\n'.join(out) + '\n'
|
|
896
|
+
# Fast Path 已废弃:它是 Usage / Hard Rules / 资产表 / 页型清单的第二份副本。
|
|
897
|
+
# 规则的唯一出处是正文各段,这里只负责把历史产物里的残留剥掉。
|
|
911
898
|
body = strip_agent_fast_path(body)
|
|
912
|
-
text += '\n' + render_fast_path(manifest, consumer, has_sidecar, canvas,
|
|
913
|
-
layouts_index=layouts_index)
|
|
914
899
|
if body:
|
|
915
900
|
text += body if body.startswith('\n') else '\n' + body
|
|
916
901
|
if not text.endswith('\n'):
|
|
@@ -918,26 +903,170 @@ def build_design(manifest, l_frontmatter, consumer, body, has_sidecar, canvas,
|
|
|
918
903
|
return text
|
|
919
904
|
|
|
920
905
|
|
|
906
|
+
def shrink_safe_area(lines):
|
|
907
|
+
"""text_safe 与 avoid 相交时把安全区收掉重叠的那部分。
|
|
908
|
+
|
|
909
|
+
text_safe 是脚本按「该背景各页型的槽位并集」算的,而模板里的槽位本身可能就压在
|
|
910
|
+
主视觉上;avoid 是看图的人填的。两者从不同来源来,会直接打架——实测一张背景的
|
|
911
|
+
text_safe 有 34% 落在 avoid 里,消费端按 text_safe 把标题放进了禁放区,正好压在
|
|
912
|
+
背景的山峰主体上。这里以 avoid 为准收缩:能不能放字是看图的人说了算。
|
|
913
|
+
"""
|
|
914
|
+
def parse_box(s):
|
|
915
|
+
m = re.findall(r'-?\d+', s)
|
|
916
|
+
return [int(x) for x in m[:4]] if len(m) >= 4 else None
|
|
917
|
+
|
|
918
|
+
ts_i = ts = None
|
|
919
|
+
avoids = []
|
|
920
|
+
for i, ln in enumerate(lines):
|
|
921
|
+
st = ln.strip()
|
|
922
|
+
if st.startswith('text_safe:'):
|
|
923
|
+
ts_i, ts = i, parse_box(st.split(':', 1)[1].split('#')[0])
|
|
924
|
+
elif st.startswith('avoid:'):
|
|
925
|
+
for chunk in re.findall(r'box:\s*\[[^\]]*\]', st):
|
|
926
|
+
b = parse_box(chunk)
|
|
927
|
+
if b:
|
|
928
|
+
avoids.append(b)
|
|
929
|
+
if ts is None or not avoids:
|
|
930
|
+
return lines, None
|
|
931
|
+
x0, y0, x1, y1 = ts[0], ts[1], ts[0] + ts[2], ts[1] + ts[3]
|
|
932
|
+
for a in avoids:
|
|
933
|
+
ax0, ay0, ax1, ay1 = a[0], a[1], a[0] + a[2], a[1] + a[3]
|
|
934
|
+
if ax1 <= x0 or ax0 >= x1 or ay1 <= y0 or ay0 >= y1:
|
|
935
|
+
continue # 不相交
|
|
936
|
+
# 从被侵占得最少的一边切:优先保留面积最大的剩余矩形
|
|
937
|
+
cands = []
|
|
938
|
+
if ax0 > x0:
|
|
939
|
+
cands.append((x0, y0, ax0, y1))
|
|
940
|
+
if ax1 < x1:
|
|
941
|
+
cands.append((ax1, y0, x1, y1))
|
|
942
|
+
if ay0 > y0:
|
|
943
|
+
cands.append((x0, y0, x1, ay0))
|
|
944
|
+
if ay1 < y1:
|
|
945
|
+
cands.append((x0, ay1, x1, y1))
|
|
946
|
+
if not cands:
|
|
947
|
+
return lines, 'text_safe 被 avoid 完全覆盖,这张背景没有可放文字的区域'
|
|
948
|
+
x0, y0, x1, y1 = max(cands, key=lambda c: (c[2] - c[0]) * (c[3] - c[1]))
|
|
949
|
+
new = [x0, y0, x1 - x0, y1 - y0]
|
|
950
|
+
if new == ts:
|
|
951
|
+
return lines, None
|
|
952
|
+
lines = list(lines)
|
|
953
|
+
lines[ts_i] = ' text_safe: [%d, %d, %d, %d] # 已按 avoid 收缩(原 %s)' % (
|
|
954
|
+
new[0], new[1], new[2], new[3], ts)
|
|
955
|
+
return lines, None
|
|
956
|
+
|
|
957
|
+
|
|
921
958
|
def build_layouts_md(layouts_blocks, canvas):
|
|
922
959
|
blocks = {k: (inline, lines) for k, inline, lines in layouts_blocks}
|
|
923
960
|
if 'canvas' in blocks:
|
|
924
961
|
raise Fail('layouts.yaml 不要写 canvas —— 脚本从 extract.json 取')
|
|
925
962
|
if 'layouts' not in blocks:
|
|
926
963
|
raise Fail('layouts.yaml 缺顶层键 `layouts:`')
|
|
927
|
-
# `names:` 是给 L
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
964
|
+
# `names:` / `roles:` / `text_roles:` / `bg_rules:` 是给 L 层集中填判断的
|
|
965
|
+
# 扁平区——在这里并回各 archetype,本身不进产物。让 L 层只改扁平键值,别去动 layouts 里的
|
|
966
|
+
# slots/confidence 结构(嵌套结构手改极易破坏缩进,进而静默改变语义)。
|
|
967
|
+
names, roles = {}, {}
|
|
968
|
+
for key, sink in (('names', names), ('roles', roles)):
|
|
969
|
+
for line in blocks.get(key, ('', []))[1]:
|
|
970
|
+
m = re.match(r'^\s{2}([\w-]+):\s*(.+?)\s*$', line)
|
|
971
|
+
if m:
|
|
972
|
+
sink[m.group(1)] = unquote(m.group(2))
|
|
973
|
+
text_roles = {}
|
|
974
|
+
allowed_text_roles = {'title', 'subtitle', 'header', 'footer', 'body'}
|
|
975
|
+
for line in blocks.get('text_roles', ('', []))[1]:
|
|
976
|
+
m = re.match(r'^\s{2}([\w-]+):\s*([A-Za-z-]+)(?:\s+#.*)?$', line)
|
|
977
|
+
if not m:
|
|
978
|
+
continue
|
|
979
|
+
role_id, role = m.groups()
|
|
980
|
+
if role not in allowed_text_roles:
|
|
981
|
+
raise Fail('text_roles.%s 取值 %s 非法;应为 %s'
|
|
982
|
+
% (role_id, role, '|'.join(sorted(allowed_text_roles))))
|
|
983
|
+
text_roles[role_id] = role
|
|
984
|
+
bg_rules, cur = {}, None
|
|
985
|
+
for line in blocks.get('bg_rules', ('', []))[1]:
|
|
986
|
+
# 键后面允许行内注释(草案会标「用它的页型:…」)
|
|
987
|
+
m = re.match(r'^\s{2}([\w-]+):\s*(?:#.*)?$', line)
|
|
931
988
|
if m:
|
|
932
|
-
|
|
933
|
-
|
|
989
|
+
cur = m.group(1)
|
|
990
|
+
bg_rules[cur] = []
|
|
991
|
+
continue
|
|
992
|
+
if cur and line.strip():
|
|
993
|
+
bg_rules[cur].append(' ' + line.strip())
|
|
994
|
+
out = ['---', 'canvas: %dx%d' % tuple(canvas)]
|
|
995
|
+
# 禁放区是背景的属性,按背景写一次;页型只留 `background:` 指针。
|
|
996
|
+
# 合并进每个页型会把同一句话按页型数复制 N 遍。
|
|
997
|
+
if bg_rules:
|
|
998
|
+
out.append('backgrounds:')
|
|
999
|
+
for bg, lines in bg_rules.items():
|
|
1000
|
+
lines, err = shrink_safe_area(lines)
|
|
1001
|
+
if err:
|
|
1002
|
+
raise Fail('%s: %s' % (bg, err))
|
|
1003
|
+
out.append(' %s:' % bg)
|
|
1004
|
+
out += lines
|
|
1005
|
+
out.append('layouts:')
|
|
1006
|
+
pending_text_role = None
|
|
1007
|
+
used_text_roles = set()
|
|
934
1008
|
for line in blocks['layouts'][1]:
|
|
1009
|
+
# 判断单里的结构事实(栅格、间距序列、样张字数、命中配方)是给 L 层判断用的,
|
|
1010
|
+
# 不进产物——消费端要的是结论,不是推导过程。
|
|
1011
|
+
if line.lstrip().startswith('#'):
|
|
1012
|
+
marker = re.match(r'^\s*#\s*text-role:\s*([\w-]+)\s*$', line)
|
|
1013
|
+
if marker:
|
|
1014
|
+
pending_text_role = marker.group(1)
|
|
1015
|
+
continue
|
|
1016
|
+
if pending_text_role:
|
|
1017
|
+
if pending_text_role not in text_roles:
|
|
1018
|
+
raise Fail('text_roles 缺少 %s 的判断' % pending_text_role)
|
|
1019
|
+
role = text_roles[pending_text_role]
|
|
1020
|
+
slot_type = role if role in ('title', 'subtitle', 'footer') else 'body'
|
|
1021
|
+
line, role_n = re.subn(r'(\{\s*role:\s*)[\w-]+',
|
|
1022
|
+
r'\g<1>%s' % role, line, count=1)
|
|
1023
|
+
line, type_n = re.subn(r'(\btype:\s*)[\w-]+',
|
|
1024
|
+
r'\g<1>%s' % slot_type, line, count=1)
|
|
1025
|
+
if role_n != 1 or type_n != 1:
|
|
1026
|
+
raise Fail('text_roles.%s 没有命中一个文本槽' % pending_text_role)
|
|
1027
|
+
used_text_roles.add(pending_text_role)
|
|
1028
|
+
pending_text_role = None
|
|
935
1029
|
out.append(line)
|
|
936
1030
|
m = re.match(r'^ ([\w-]+):\s*$', line)
|
|
937
1031
|
if m and m.group(1) in names:
|
|
938
1032
|
out.append(' name: "%s"' % names.pop(m.group(1)))
|
|
1033
|
+
if m and m.group(1) in roles:
|
|
1034
|
+
out.append(' role: %s' % roles.pop(m.group(1)))
|
|
939
1035
|
if names:
|
|
940
1036
|
raise Fail('names 里这些页型在 layouts 下找不到:%s' % ', '.join(sorted(names)))
|
|
1037
|
+
if roles:
|
|
1038
|
+
raise Fail('roles 里这些页型在 layouts 下找不到:%s' % ', '.join(sorted(roles)))
|
|
1039
|
+
unused_text_roles = set(text_roles) - used_text_roles
|
|
1040
|
+
if unused_text_roles:
|
|
1041
|
+
raise Fail('text_roles 里这些判断没有命中文本槽:%s'
|
|
1042
|
+
% ', '.join(sorted(unused_text_roles)))
|
|
1043
|
+
missing_role = [k for k in re.findall(r'^ ([\w-]+):\s*$', '\n'.join(blocks['layouts'][1]), re.M)
|
|
1044
|
+
if not re.search(r'^ %s:\s*$(?:\n(?! \S).*)*?\n role:' % re.escape(k),
|
|
1045
|
+
'\n'.join(out), re.M)]
|
|
1046
|
+
if missing_role:
|
|
1047
|
+
raise Fail('这些页型没有 role(在 layouts.yaml 的 roles 段填):%s' % ', '.join(missing_role))
|
|
1048
|
+
# flow 与 slots 二选一:两份都留下,消费端不知道该听哪份坐标——design.md 正文与
|
|
1049
|
+
# layouts.md 打架就是这么来的,别重演。
|
|
1050
|
+
both, cur, has = [], None, {}
|
|
1051
|
+
for line in blocks['layouts'][1]:
|
|
1052
|
+
m = re.match(r'^ ([\w-]+):\s*$', line)
|
|
1053
|
+
if m:
|
|
1054
|
+
if cur and has.get('flow') and has.get('slots'):
|
|
1055
|
+
both.append(cur)
|
|
1056
|
+
cur, has = m.group(1), {}
|
|
1057
|
+
continue
|
|
1058
|
+
m = re.match(r'^ (flow|slots):\s*$', line)
|
|
1059
|
+
if m:
|
|
1060
|
+
has[m.group(1)] = True
|
|
1061
|
+
if cur and has.get('flow') and has.get('slots'):
|
|
1062
|
+
both.append(cur)
|
|
1063
|
+
if both:
|
|
1064
|
+
raise Fail('这些页型同时留了 flow 和 slots,二选一删掉另一个:%s' % ', '.join(both))
|
|
1065
|
+
declared = set(re.findall(r'^ background:\s*(\S+)\s*$',
|
|
1066
|
+
'\n'.join(blocks['layouts'][1]), re.M))
|
|
1067
|
+
stray = set(bg_rules) - declared
|
|
1068
|
+
if stray:
|
|
1069
|
+
raise Fail('backgrounds 段里这些背景没有任何页型在用:%s' % ', '.join(sorted(stray)))
|
|
941
1070
|
out.append('---')
|
|
942
1071
|
text = '\n'.join(out) + '\n'
|
|
943
1072
|
if 'body' in blocks:
|
|
@@ -993,6 +1122,12 @@ def main(argv=None):
|
|
|
993
1122
|
if left:
|
|
994
1123
|
raise Fail('判断单还有 %d 处草案占位没改(TODO 是 draft.py 留给 L 层的判断点):\n %s'
|
|
995
1124
|
% (len(left), '\n '.join(left)))
|
|
1125
|
+
mdesc = re.search(r'^description:\s*[|>]?\s*\n((?:\s+\S.*\n?)+)',
|
|
1126
|
+
open(os.path.join(lout, 'manifest.yaml'), encoding='utf-8').read(), re.M)
|
|
1127
|
+
if mdesc and len(re.sub(r'\s+', '', mdesc.group(1))) < 20:
|
|
1128
|
+
raise Fail('manifest 的 description 只有 %d 个字符——它是消费模型定调的唯一入口,'
|
|
1129
|
+
'写清底色/主色/字形/版面骨架,不要留占位'
|
|
1130
|
+
% len(re.sub(r'\s+', '', mdesc.group(1))))
|
|
996
1131
|
|
|
997
1132
|
manifest = read_manifest(os.path.join(lout, 'manifest.yaml'))
|
|
998
1133
|
if args.style_name:
|
|
@@ -1016,34 +1151,23 @@ def main(argv=None):
|
|
|
1016
1151
|
|
|
1017
1152
|
lay_text = open(lay_path, encoding='utf-8').read() if os.path.exists(lay_path) else ''
|
|
1018
1153
|
body = expand_placeholders(body, manifest, consumer, audit, extract, lay_text)
|
|
1019
|
-
layouts_index = layout_fast_index(layouts_blocks)
|
|
1020
1154
|
design = build_design(manifest, l_fm, consumer, body,
|
|
1021
|
-
has_sidecar=layouts_blocks is not None, canvas=canvas
|
|
1022
|
-
layouts_index=layouts_index)
|
|
1155
|
+
has_sidecar=layouts_blocks is not None, canvas=canvas)
|
|
1023
1156
|
with open(os.path.join(pack, 'design.md'), 'w', encoding='utf-8') as f:
|
|
1024
1157
|
f.write(design)
|
|
1025
1158
|
if layouts_blocks is not None:
|
|
1026
1159
|
with open(os.path.join(pack, 'layouts.md'), 'w', encoding='utf-8') as f:
|
|
1027
1160
|
f.write(build_layouts_md(layouts_blocks, canvas))
|
|
1028
1161
|
|
|
1029
|
-
ref
|
|
1162
|
+
# 审计记录写回**抽取工作目录**,不进交付包:包是消费产物,`ref/` 里的东西
|
|
1163
|
+
# 没有任何门禁读、消费模型也用不上,放进去只会让「别读我」和「几 MB 材料」同时下发。
|
|
1164
|
+
ref = os.path.join(stage1, 'ref')
|
|
1030
1165
|
os.makedirs(ref, exist_ok=True)
|
|
1031
|
-
|
|
1166
|
+
audit_path = os.path.join(ref, 'audit.yaml')
|
|
1167
|
+
with open(audit_path, 'w', encoding='utf-8') as f:
|
|
1032
1168
|
f.write(render_audit(manifest, extract, audit))
|
|
1033
1169
|
carried = []
|
|
1034
|
-
|
|
1035
|
-
srcf = os.path.join(stage1, 'ref', name)
|
|
1036
|
-
if os.path.exists(srcf):
|
|
1037
|
-
shutil.copy2(srcf, os.path.join(ref, name))
|
|
1038
|
-
carried.append(name)
|
|
1039
|
-
shutil.copy2(ex_path, os.path.join(ref, 'extract.json'))
|
|
1040
|
-
carried.append('extract.json')
|
|
1041
|
-
for sub in ('rebuild', 'logo-candidates'):
|
|
1042
|
-
s = os.path.join(stage1, 'ref', sub)
|
|
1043
|
-
if os.path.isdir(s):
|
|
1044
|
-
shutil.copytree(s, os.path.join(ref, sub), dirs_exist_ok=True)
|
|
1045
|
-
carried.append(sub + '/')
|
|
1046
|
-
# L 层自备的 ref 补充件(判断理由、版式溯源等)原样带入
|
|
1170
|
+
# L 层自备的 ref 补充件(判断理由、版式溯源等)也归到抽取目录
|
|
1047
1171
|
l_ref = os.path.join(lout, 'ref')
|
|
1048
1172
|
if os.path.isdir(l_ref):
|
|
1049
1173
|
shutil.copytree(l_ref, ref, dirs_exist_ok=True)
|
|
@@ -1061,7 +1185,9 @@ def main(argv=None):
|
|
|
1061
1185
|
print(' assets %d 条目 / %d 文件落盘' % (len(consumer), len(copied)))
|
|
1062
1186
|
for d in copied:
|
|
1063
1187
|
print(' %-52s %8d B' % (os.path.relpath(d, pack), os.path.getsize(d)))
|
|
1064
|
-
print('
|
|
1188
|
+
print(' 审计记录 -> %s%s(不进交付包)'
|
|
1189
|
+
% (os.path.relpath(audit_path, os.path.dirname(stage1)),
|
|
1190
|
+
' ' + ', '.join(carried) if carried else ''))
|
|
1065
1191
|
|
|
1066
1192
|
# ---- 数值可追溯机检:产物里每个色值/字号/坐标都得能指回普查值
|
|
1067
1193
|
derived_values, derived_tokens = set(), set()
|
|
@@ -1079,9 +1205,17 @@ def main(argv=None):
|
|
|
1079
1205
|
shapes = json.load(open(sp, encoding='utf-8'))['shapes'] if os.path.exists(sp) else []
|
|
1080
1206
|
problems, checked = trace_check(pack, extract, shapes,
|
|
1081
1207
|
derived_values, derived_tokens, factor)
|
|
1208
|
+
integrity = media_integrity(stage1, extract)
|
|
1209
|
+
if integrity:
|
|
1210
|
+
print('\n--- 媒体产物完整性 ---')
|
|
1211
|
+
for b in integrity:
|
|
1212
|
+
print(' FAIL ' + b)
|
|
1213
|
+
raise Fail('media-out 里的文件和 extract.json 的记录对不上(%d 处)' % len(integrity))
|
|
1082
1214
|
print('\n--- 数值可追溯机检 ---')
|
|
1083
|
-
print(' 受检 hex %d / fontSize %d / slot box %d;derived 豁免 %d%s'
|
|
1215
|
+
print(' 受检 hex %d / fontSize %d / slot box %d;derived 豁免 %d%s%s'
|
|
1084
1216
|
% (checked['hex'], checked['size'], checked['box'], checked['exempt'],
|
|
1217
|
+
';判断键跳过 %d 行(avoid/text_safe/pairing_rule)' % checked['judgement']
|
|
1218
|
+
if checked['judgement'] else '',
|
|
1085
1219
|
';rebase_factor=%g' % factor if factor else ''))
|
|
1086
1220
|
if not shapes:
|
|
1087
1221
|
print(' ⚠ 未找到 %s,slot 坐标一项无法校验' % sp)
|
|
@@ -1108,6 +1242,7 @@ def main(argv=None):
|
|
|
1108
1242
|
print('check_v1: 未探测到($DSM_V1_DIR / 同级 skill / 开发机路径均无)—— v1 门禁未跑,交付前必须补跑')
|
|
1109
1243
|
if args.check_v1:
|
|
1110
1244
|
print('\n--- check_v1 ---')
|
|
1245
|
+
sys.stdout.flush()
|
|
1111
1246
|
r1 = subprocess.run([sys.executable, args.check_v1,
|
|
1112
1247
|
os.path.join(pack, 'design.md'), 'slide'])
|
|
1113
1248
|
rc = rc or r1.returncode
|
|
@@ -39,15 +39,15 @@ class Package:
|
|
|
39
39
|
self.masters = sorted((n for n in self.names if MASTER_RE.match(n)), key=_num)
|
|
40
40
|
self.themes, self.theme_discovery = self._find_themes(ct)
|
|
41
41
|
# zip directory entries ('ppt/media/') must not be counted as assets —
|
|
42
|
-
#
|
|
42
|
+
# they inflate media totals by one.
|
|
43
43
|
self.media = sorted(n for n in self.names
|
|
44
44
|
if n.startswith('ppt/media/') and not n.endswith('/'))
|
|
45
45
|
|
|
46
46
|
def _find_themes(self, ct):
|
|
47
47
|
"""Theme parts come from [Content_Types].xml, not from a path pattern.
|
|
48
48
|
|
|
49
|
-
Compressors relocate them —
|
|
50
|
-
ppt/slideMasters/theme/
|
|
49
|
+
Compressors relocate them — some rewrite them under
|
|
50
|
+
ppt/slideMasters/theme/ — and a `ppt/theme/` regex then finds
|
|
51
51
|
nothing to bind the masters to, so every schemeClr resolves to
|
|
52
52
|
UNRESOLVED:no-scheme. The path regex stays as the fallback for packages
|
|
53
53
|
whose content types are unreadable.
|
|
@@ -393,6 +393,9 @@ def walk_tree(el, ctx, out, path=(), xf=(1.0, 1.0, 0.0, 0.0), depth=0):
|
|
|
393
393
|
blip = sp.find('p:blipFill/a:blip', NS)
|
|
394
394
|
if blip is not None:
|
|
395
395
|
rec['media'] = ctx.media_of(blip.get(R_EMBED)) or ctx.media_of(blip.get(R_LINK))
|
|
396
|
+
alpha = blip.find('a:alphaModFix', NS)
|
|
397
|
+
if alpha is not None and alpha.get('amt') is not None:
|
|
398
|
+
rec['opacity'] = round(int(alpha.get('amt')) / 100000.0, 6)
|
|
396
399
|
svg = blip.find('a:extLst//asvg:svgBlip', NS)
|
|
397
400
|
if svg is not None:
|
|
398
401
|
rec['media_svg'] = ctx.media_of(svg.get(R_EMBED))
|