Docs spelling and grammar fixes (#13307)
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com> Co-authored-by: RainRat <rainrat78@yahoo.ca>
This commit is contained in:
parent
bddea17bf3
commit
064e2fd282
48 changed files with 179 additions and 172 deletions
|
|
@ -116,13 +116,21 @@ def update_subdir_edit_links(subdir="", docs_url=""):
|
|||
file.write(str(soup))
|
||||
|
||||
|
||||
def add_frontmatter(md_filepath: Path):
|
||||
def update_page(md_filepath: Path):
|
||||
"""Creates or updates a Markdown file, ensuring frontmatter is present."""
|
||||
if md_filepath.exists():
|
||||
existing_content = md_filepath.read_text()
|
||||
if not existing_content.strip().startswith("---\n"):
|
||||
content = md_filepath.read_text()
|
||||
|
||||
# Replace apostrophes
|
||||
content = content.replace("‘", "'").replace("’", "'")
|
||||
|
||||
# Add frontmatter if missing
|
||||
if not content.strip().startswith("---\n"):
|
||||
header = "---\ncomments: true\ndescription: TODO ADD DESCRIPTION\nkeywords: TODO ADD KEYWORDS\n---\n\n"
|
||||
md_filepath.write_text(header + existing_content)
|
||||
content = header + content
|
||||
|
||||
# Save page
|
||||
md_filepath.write_text(content)
|
||||
return
|
||||
|
||||
|
||||
|
|
@ -132,7 +140,7 @@ def main():
|
|||
|
||||
# Add frontmatter
|
||||
for file in tqdm((DOCS / "en").rglob("*.md"), desc="Adding frontmatter"):
|
||||
add_frontmatter(file)
|
||||
update_page(file)
|
||||
|
||||
# Update titles
|
||||
update_page_title(SITE / "404.html", new_title="Ultralytics Docs - Not Found")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue