diff --git a/python/create_skill_tree_svg.py b/python/create_skill_tree_svg.py new file mode 100755 index 0000000..ddbb4cf --- /dev/null +++ b/python/create_skill_tree_svg.py @@ -0,0 +1,67 @@ +#!/bin/env python +import argparse + +import yaml + + +def load_yaml(file_path): + with open(file_path) as file: + return yaml.safe_load(file) + + +def load_svg_template(file_path): + with open(file_path) as file: + return file.read() + + +def process_svg(template, data): + # Replace title and author + processed = template.replace("{{ title }}", data["title"]) + processed = processed.replace("{{ author }}", data["author"]) + + displacement = (0, 9, 19, 29, 39, 49, 59, 69) + for i in range(10): + for j in range(7): + if i < 9: + box_number = i + displacement[j] + elif i == 9: + box_number = i + displacement[j + 1] + if j >= 5: + continue + value = data["row"][i][j] + placeholder = f"{{{{ box_{box_number:03d} }}}}" + processed = processed.replace(placeholder, str(value)) + + return processed + + +def save_processed_svg(content, output_path): + with open(output_path, "w") as file: + file.write(content) + + +def main(): + svg_template_path = "skill_tree_template.svg.j2" + + parser = argparse.ArgumentParser(description="Process SVG template with YAML data.") + parser.add_argument("input_yaml", help="Path to input YAML file") + parser.add_argument("output_svg", help="Path to output processed SVG file") + args = parser.parse_args() + + # Load YAML data + yaml_data = load_yaml(args.input_yaml) + + # Load SVG template + svg_template = load_svg_template(svg_template_path) + + # Process SVG + processed_svg = process_svg(svg_template, yaml_data) + + # Save processed SVG + save_processed_svg(processed_svg, args.output_svg) + + print(f"Processed SVG saved to {args.output_svg}") + + +if __name__ == "__main__": + main() diff --git a/python/input.yml b/python/input.yml new file mode 100644 index 0000000..b13caa8 --- /dev/null +++ b/python/input.yml @@ -0,0 +1,82 @@ +--- +title: Some Interesting Title +author: John Doe +row: + 0: + - 0a + - 0b + - 0c + - 0d + - 0e + - 0f + - 0g + 1: + - 1a + - 1b + - 1c + - 1d + - 1e + - 1f + - 1g + 2: + - 2a + - 2b + - 2c + - 2d + - 2e + - 2f + - 2g + 3: + - 3a + - 3b + - 3c + - 3d + - 3e + - 3f + - 3g + 4: + - 4a + - 4b + - 4c + - 4d + - 4e + - 4f + - 4g + 5: + - 5a + - 5b + - 5c + - 5d + - 5e + - 5f + - 5g + 6: + - 6a + - 6b + - 6c + - 6d + - 6e + - 6f + - 6g + 7: + - 7a + - 7b + - 7c + - 7d + - 7e + - 7f + - 7g + 8: + - 8a + - 8b + - 8c + - 8d + - 8e + - 8f + - 8g + 9: + - 9a + - 9b + - 9c + - 9d + - 9e diff --git a/python/skill_tree_template.svg.j2 b/python/skill_tree_template.svg.j2 new file mode 100644 index 0000000..e28af42 --- /dev/null +++ b/python/skill_tree_template.svg.j2 @@ -0,0 +1,880 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Icons by Icons8.com + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Use for individuals or as a group by picking a colour each and coloring in a part of the box. Everyone’s journey is different and you can + + + interpret the goals flexibly. The aim is to inspire you to learn and try new things. Not everything needs to be completed. + + + CC BY-NC-SA 4.0 + github.com/sjpiper145/MakerSkillTree + + + + + + Total Score + + + 1 tile = 1 point + + + + {{ box_000 }} + + + {{ box_001 }} + + + {{ box_002 }} + + + {{ box_003 }} + + + {{ box_004 }} + + + {{ box_005 }} + + + {{ box_006 }} + + + {{ box_007 }} + + + {{ box_008 }} + + + {{ box_009 }} + + + {{ box_010 }} + + + {{ box_011 }} + + + {{ box_012 }} + + + {{ box_013 }} + + + {{ box_014 }} + + + {{ box_015 }} + + + {{ box_016 }} + + + {{ box_017 }} + + + {{ box_018 }} + + + {{ box_019 }} + + + {{ box_020 }} + + + {{ box_021 }} + + + {{ box_022 }} + + + {{ box_023 }} + + + {{ box_024 }} + + + {{ box_025 }} + + + {{ box_026 }} + + + {{ box_027 }} + + + {{ box_028 }} + + + {{ box_029 }} + + + {{ box_030 }} + + + {{ box_031 }} + + + {{ box_032 }} + + + {{ box_033 }} + + + {{ box_034 }} + + + {{ box_035 }} + + + {{ box_036 }} + + + {{ box_037 }} + + + {{ box_038 }} + + + {{ box_039 }} + + + {{ box_040 }} + + + {{ box_041 }} + + + {{ box_042 }} + + + {{ box_043 }} + + + {{ box_044 }} + + + {{ box_045 }} + + + {{ box_046 }} + + + {{ box_047 }} + + + {{ box_048 }} + + + {{ box_049 }} + + + {{ box_050 }} + + + {{ box_051 }} + + + {{ box_052 }} + + + {{ box_053 }} + + + {{ box_054 }} + + + {{ box_055 }} + + + {{ box_056 }} + + + {{ box_057 }} + + + {{ box_058 }} + + + {{ box_059 }} + + + {{ box_060 }} + + + {{ box_061 }} + + + {{ box_062 }} + + + {{ box_063 }} + + + {{ box_064 }} + + + {{ box_065 }} + + + {{ box_066 }} + + + {{ box_067 }} + + + {{ title }} + +