Skip to content

Finalize theme metadata #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
2 tasks
Descent098 opened this issue Apr 23, 2022 · 0 comments
Open
2 tasks

Finalize theme metadata #5

Descent098 opened this issue Apr 23, 2022 · 0 comments

Comments

@Descent098
Copy link
Member

Finalize the themes after regen

  • Generate metadata for new themes
  • Add in required fields to all metadata

Script to regen metadata for all files in folder

import os
from pprint import pprint
from ezcv.themes import generate_theme_metadata
import yaml

# data_1 = generate_theme_metadata("dimension")
# data_2 = get_theme_metadata(os.path.join(THEMES_FOLDER, 'dimension'))

# pprint(data_1)

# pprint(data_2)

# # Non required field
# print(data_2["sections"]["education"]["fields"]["month_ended"])
# print(type(data_2["sections"]["education"]["fields"]["month_ended"]))

# # Required field
# print(data_2["sections"]["education"]["fields"]["institution"])
# print(type(data_2["sections"]["education"]["fields"]["institution"]))

print(f"Generating theme metadata for {[x for x in os.listdir('.')[2:] if os.path.isdir(x)]}")
for folder in os.listdir("."):
    if os.path.isdir(folder):
        if os.path.exists(os.path.join(folder, "index.jinja")):
            data = generate_theme_metadata(folder)
            if os.path.exists(os.path.join(folder, "metadata.yml")):
                print(f"Removing existing metadata.yml for {folder}")
                os.remove(os.path.join(folder, "metadata.yml"))
            with open(os.path.join(folder, "metadata.yml"), "w+") as f:
                print(f"Writing metadata.yml for {folder}")
                yaml.dump(dict(data), f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant