File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -71,6 +71,23 @@ def versions_block(path: Path) -> list[str] | None:
7171 return lines [start :end ]
7272
7373
74+ def normalize_latest_display_name (block : list [str ] | None ) -> list [str ] | None :
75+ if block is None :
76+ return None
77+
78+ normalized = list (block )
79+ display_name_index = - 1
80+ for index , line in enumerate (block ):
81+ if line .startswith ("- display-name:" ):
82+ display_name_index = index
83+ continue
84+ match = VERSION_SLUG_RE .match (line )
85+ if display_name_index != - 1 and match and match .group (1 ) == "latest" :
86+ normalized [display_name_index ] = '- display-name: "Latest"\n '
87+ break
88+ return normalized
89+
90+
7491def restore_versions_block (path : Path , block : list [str ] | None ) -> None :
7592 if block is None :
7693 return
@@ -157,7 +174,7 @@ def sync_source(args: argparse.Namespace) -> int:
157174 if not (source_root / "fern" / "docs.yml" ).exists ():
158175 raise PublishedBranchError (f"Missing source Fern docs at { source_root / 'fern' } " )
159176
160- preserved_versions_block = versions_block (published_root / "fern" / "docs.yml" )
177+ preserved_versions_block = normalize_latest_display_name ( versions_block (published_root / "fern" / "docs.yml" ) )
161178 with tempfile .TemporaryDirectory () as tmpdir :
162179 preserved_versions = Path (tmpdir ) / "versions"
163180 if (published_root / "fern" / "versions" ).exists ():
You can’t perform that action at this time.
0 commit comments