Generator: add IF.DAVE v2.1 style id
This commit is contained in:
parent
9a559b259d
commit
3daf05032c
1 changed files with 14 additions and 9 deletions
|
|
@ -32,6 +32,7 @@ def generate_shadow_dossier(*, style_id: str, source_text: str, source_path: str
|
|||
"if.dave.v1.8",
|
||||
"if.dave.v1.9",
|
||||
"if.dave.v2.0",
|
||||
"if.dave.v2.1",
|
||||
"if.dave.fr.v1.2",
|
||||
"if.dave.fr.v1.3",
|
||||
"dave",
|
||||
|
|
@ -44,18 +45,19 @@ def generate_shadow_dossier(*, style_id: str, source_text: str, source_path: str
|
|||
"if://bible/dave/v1.8",
|
||||
"if://bible/dave/v1.9",
|
||||
"if://bible/dave/v2.0",
|
||||
"if://bible/dave/v2.1",
|
||||
"if://bible/dave/fr/v1.2",
|
||||
"if://bible/dave/fr/v1.3",
|
||||
}:
|
||||
style = style_id.lower()
|
||||
locale = "fr" if style in {"if.dave.fr.v1.2", "if.dave.fr.v1.3", "if://bible/dave/fr/v1.2", "if://bible/dave/fr/v1.3"} else "en"
|
||||
if style in {"if.dave.v2.0", "if://bible/dave/v2.0"}:
|
||||
if style in {"if.dave.v2.0", "if.dave.v2.1", "if://bible/dave/v2.0", "if://bible/dave/v2.1"}:
|
||||
return _generate_dave_v1_8_mirror(
|
||||
source_text=source_text,
|
||||
source_path=source_path,
|
||||
action_pack=action_pack,
|
||||
locale=locale,
|
||||
style_version="v2.0",
|
||||
style_version="v2.1" if style in {"if.dave.v2.1", "if://bible/dave/v2.1"} else "v2.0",
|
||||
)
|
||||
if style in {"if.dave.v1.9", "if://bible/dave/v1.9"}:
|
||||
return _generate_dave_v1_8_mirror(
|
||||
|
|
@ -2438,7 +2440,7 @@ def _render_section(section: _SourceSection, *, ctx: _RenderContext) -> str:
|
|||
]
|
||||
)
|
||||
elif title_upper.startswith("APPENDIX 1") or "ARCHITECTURE" in title_upper:
|
||||
if ctx.voice == "v2.0":
|
||||
if ctx.voice in {"v2.0", "v2.1"}:
|
||||
variants = [
|
||||
"Architecture diagrams are where optimism meets the enforcement boundary (and quietly loses).",
|
||||
"Architecture diagrams are forwardable; boundaries are enforceable. Dave prefers the version you can screenshot.",
|
||||
|
|
@ -2491,7 +2493,7 @@ def _render_section(section: _SourceSection, *, ctx: _RenderContext) -> str:
|
|||
]
|
||||
)
|
||||
elif "SECURITY TEAM" in title_upper or "SECURITY REVIEW" in title_upper:
|
||||
if ctx.voice == "v2.0":
|
||||
if ctx.voice in {"v2.0", "v2.1"}:
|
||||
variants = [
|
||||
'Security team efficiency is a legitimate goal, especially when queues become the organization’s truth serum. The risk is claiming throughput without defining what “review complete” means or what evidence proves it.',
|
||||
'Faster reviews are defensible; unmeasured reviews are theater. Define “complete,” define the evidence, and make drift visible before the next audit season.',
|
||||
|
|
@ -2687,7 +2689,7 @@ def _render_section(section: _SourceSection, *, ctx: _RenderContext) -> str:
|
|||
paragraphs.append(ctx.pick_unique(kind="paragraph:fallback", key=section.title, variants=variants, used=ctx.used_paragraphs))
|
||||
|
||||
raw_title = section.title
|
||||
heading_title = _compact_title(raw_title, max_chars=72) if ctx.voice == "v2.0" else raw_title
|
||||
heading_title = _compact_title(raw_title, max_chars=72) if ctx.voice in {"v2.0", "v2.1"} else raw_title
|
||||
out: list[str] = [f"## {heading_title}"]
|
||||
if heading_title != raw_title:
|
||||
out.extend(["", f"> {raw_title}"])
|
||||
|
|
@ -3164,6 +3166,7 @@ def _generate_dave_v1_2_mirror(*, source_text: str, source_path: str, action_pac
|
|||
extract_sha = _sha256_text(normalized)
|
||||
source_file_sha = _sha256_file(source_path) if Path(source_path).exists() else "unknown"
|
||||
ctx = _RenderContext(seed=extract_sha, locale=locale, voice="v1.2")
|
||||
style_version = ctx.voice
|
||||
|
||||
action_pack = bool(action_pack) or _truthy_env("REVOICE_ACTION_PACK")
|
||||
|
||||
|
|
@ -3291,6 +3294,7 @@ def _generate_dave_v1_3_mirror(*, source_text: str, source_path: str, action_pac
|
|||
extract_sha = _sha256_text(normalized)
|
||||
source_file_sha = _sha256_file(source_path) if Path(source_path).exists() else "unknown"
|
||||
ctx = _RenderContext(seed=extract_sha, locale=locale, voice="v1.3")
|
||||
style_version = ctx.voice
|
||||
|
||||
action_pack = bool(action_pack) or _truthy_env("REVOICE_ACTION_PACK")
|
||||
|
||||
|
|
@ -3417,6 +3421,7 @@ def _generate_dave_v1_6_mirror(*, source_text: str, source_path: str, action_pac
|
|||
extract_sha = _sha256_text(normalized)
|
||||
source_file_sha = _sha256_file(source_path) if Path(source_path).exists() else "unknown"
|
||||
ctx = _RenderContext(seed=extract_sha, locale=locale, voice="v1.6")
|
||||
style_version = ctx.voice
|
||||
|
||||
action_pack = bool(action_pack) or _truthy_env("REVOICE_ACTION_PACK")
|
||||
|
||||
|
|
@ -4234,7 +4239,7 @@ def _generate_dave_v1_8_mirror(*, source_text: str, source_path: str, action_pac
|
|||
action_pack_enabled = (not _truthy_env("REVOICE_NO_ACTION_PACK")) or bool(action_pack) or _truthy_env("REVOICE_ACTION_PACK")
|
||||
|
||||
sections = _extract_sections(normalized)
|
||||
if style_version == "v2.0":
|
||||
if style_version in {"v2.0", "v2.1"}:
|
||||
sections = _merge_consecutive_sections_by_title(sections)
|
||||
sections = _merge_repeated_titles_globally(sections)
|
||||
if not sections:
|
||||
|
|
@ -4351,7 +4356,7 @@ def _generate_dave_v1_8_mirror(*, source_text: str, source_path: str, action_pac
|
|||
)
|
||||
cover_h2_out = ""
|
||||
if cover_h2:
|
||||
if style_version == "v2.0":
|
||||
if style_version in {"v2.0", "v2.1"}:
|
||||
if not _looks_like_cover_subtitle_noise(cover_h2):
|
||||
cover_h2_out = _compact_title(cover_h2, max_chars=90)
|
||||
else:
|
||||
|
|
@ -4403,7 +4408,7 @@ def _generate_dave_v1_8_mirror(*, source_text: str, source_path: str, action_pac
|
|||
out.extend([table, ""])
|
||||
|
||||
if action_pack_enabled:
|
||||
if style_version == "v2.0":
|
||||
if style_version in {"v2.0", "v2.1"}:
|
||||
out.append(_render_action_pack_v2_0(sections=sections[1:], normalized_text=normalized, locale=locale))
|
||||
else:
|
||||
out.append(_render_action_pack(sections[1:]))
|
||||
|
|
@ -4479,6 +4484,6 @@ def _generate_dave_v1_8_mirror(*, source_text: str, source_path: str, action_pac
|
|||
)
|
||||
|
||||
doc = "\n".join(out).strip() + "\n"
|
||||
if style_version == "v2.0":
|
||||
if style_version in {"v2.0", "v2.1"}:
|
||||
return _apply_dave_v2_0_postprocess(doc, locale=locale)
|
||||
return doc
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue