From de1765445e6b308d3f08d08e46e1b14c3447ec42 Mon Sep 17 00:00:00 2001
From: James Miller <james.ryland.miller@gmail.com>
Date: Tue, 21 Apr 2020 17:54:30 -0500
Subject: [PATCH] make cleanyaml.py get all yaml files in the directory and
 then run it

---
 data/yaml/ancestriesheritages.yaml | 27 +++++++++++++++------------
 data/yaml/cleanyaml.py             | 24 +++++++++++++++---------
 data/yaml/gear.yaml                | 10 +++++-----
 3 files changed, 35 insertions(+), 26 deletions(-)

diff --git a/data/yaml/ancestriesheritages.yaml b/data/yaml/ancestriesheritages.yaml
index b5ac249..f05bae9 100644
--- a/data/yaml/ancestriesheritages.yaml
+++ b/data/yaml/ancestriesheritages.yaml
@@ -236,7 +236,10 @@ ancestries:
       to add your level to the Hit Points you regain from their treatment.
     feat: null
     name: Hillock Halfling
-  - descr: Your ancestors have traveled from place to place for generations, never content to settle down. You gain two additional languages of your choice, chosen from among the common and uncommon languages available to you, and every time you take the Multilingual feat, you gain another new language.
+  - descr: Your ancestors have traveled from place to place for generations, never
+      content to settle down. You gain two additional languages of your choice, chosen
+      from among the common and uncommon languages available to you, and every time
+      you take the Multilingual feat, you gain another new language.
     feat: null
     name: Nomadic Halfling
   - descr: Your ancestors performed many secret acts under the concealing cover of
@@ -268,16 +271,16 @@ ancestries:
   flavor_text: TODO
   flaws: null
   heritages:
-  - descr: Either one of your parents was an elf, or one or both were half-elves. You
-      have pointed ears and other telltale signs of elf heritage. You gain the elf trait
-      and low-light vision. In addition, you can select elf, half-elf, and human feats
-      whenever you gain an ancestry feat.
+  - descr: Either one of your parents was an elf, or one or both were half-elves.
+      You have pointed ears and other telltale signs of elf heritage. You gain the
+      elf trait and low-light vision. In addition, you can select elf, half-elf, and
+      human feats whenever you gain an ancestry feat.
     feat: null
     name: Half-Elf
-  - descr: One of your parents was an orc, or one or both were half-orcs. You have a
-      green tinge to your skin and other indicators of orc heritage. You gain the orc
-      trait and low-light vision. In addition, you can select orc, half-orc, and human
-      feats whenever you gain an ancestry feat.
+  - descr: One of your parents was an orc, or one or both were half-orcs. You have
+      a green tinge to your skin and other indicators of orc heritage. You gain the
+      orc trait and low-light vision. In addition, you can select orc, half-orc, and
+      human feats whenever you gain an ancestry feat.
     feat: null
     name: Half-Orc
   - descr: Your ingenuity allows you to train in a wide variety of skills. You become
@@ -286,9 +289,9 @@ ancestries:
     feat: null
     name: Skilled Heritage
   - descr: Humanity’s versatility and ambition have fueled its ascendance to be the
-      most common ancestry in most nations throughout the world. Select a general feat
-      of your choice for which you meet the prerequisites (as with your ancestry feat,
-      you can select this general feat at any point during character creation).
+      most common ancestry in most nations throughout the world. Select a general
+      feat of your choice for which you meet the prerequisites (as with your ancestry
+      feat, you can select this general feat at any point during character creation).
     feat: null
     name: Versatile Heritage
   hp: 8
diff --git a/data/yaml/cleanyaml.py b/data/yaml/cleanyaml.py
index 16073df..cb396d6 100644
--- a/data/yaml/cleanyaml.py
+++ b/data/yaml/cleanyaml.py
@@ -2,27 +2,33 @@
 # TO CLEAN UP AND ORDER ALL THE YAML
 
 import yaml
+import glob
+import os
 
-yfiles = [
-    "actions.yaml", "ancestries.yaml", "armor.yaml", "backgrounds.yaml",
-    "basics.yaml", "bulks.yaml", "conditions.yaml", "damage.yaml",
-    "feats-levels-false-matches.yaml", "feats.yaml", "langs.yaml",
-    "monsters.yaml", "requirements.yaml", "senses.yaml", "skills.yaml",
-    "sources.yaml", "spells.yaml", "traits.yaml", "triggers.yaml"
-]
 
 
 def main():
+
+    # gets all files with a yaml extension in the directory
+    yfiles = []
+    for file in glob.glob("*.yaml"):
+        yfiles.append(file)
+
+    yfiles.sort()
+    print(yfiles)
+
     for x in yfiles:
         print("Doing: {}".format(x))
         with open(x, 'r') as r:
             data = yaml.full_load(r)
             if x == "feats.yaml":
                 for i in data['feat']:
+                    # This is to clean out smart quotes that made it into the
+                    # yaml file so it matches the requirements.yaml
                     if i['requirement'] != None:
-                        print("Before: {}".format(i['requirement']))
+                        # print("Before: {}".format(i['requirement']))
                         i['requirement'] = i['requirement'].replace('’', "'")
-                        print("After: {}".format(i['requirement']))
+                        # print("After: {}".format(i['requirement']))
         final = yaml.safe_dump(data, allow_unicode=True)
         with open(x, 'w') as f:
             f.write(final)
diff --git a/data/yaml/gear.yaml b/data/yaml/gear.yaml
index e11631a..63174ec 100644
--- a/data/yaml/gear.yaml
+++ b/data/yaml/gear.yaml
@@ -1073,7 +1073,7 @@ gear:
     page_start: 291
     page_stop: 291
   traits:
-    - Uncommon
+  - Uncommon
 - bulk: 0.1
   descr: Maps are uncommon. Most maps you can find are simple and functional. A survey
     map details a single location in excellent detail. One of these maps gives you
@@ -1088,7 +1088,7 @@ gear:
     page_start: 291
     page_stop: 291
   traits:
-    - Uncommon
+  - Uncommon
 - bulk: 0.0
   descr: Picking an average lock requires four successes at DC 25.
   hands: 2
@@ -1192,8 +1192,8 @@ gear:
   - abbr: CRB
     page_start: 291
     page_stop: 291
-  traits: 
-    - Uncommon
+  traits:
+  - Uncommon
 - bulk: 0.1
   descr: This small wooden box contains cosmetics, false facial hair, spirit gum,
     and a few simple wigs. You usually need a disguise kit to set up a disguise in
@@ -1271,7 +1271,7 @@ gear:
     page_start: 291
     page_stop: 291
   traits:
-    - Uncommon
+  - Uncommon
 - bulk: 0.1
   descr: You need thieves' tools to Pick Locks or Disable Devices (of some types)
     using the Thievery skill. Infiltrator thieves' tools add a +1 item bonus to checks