Skip to content

Commit

Permalink
Fix hard-coded file ext logic for usnistgov/oscal-content#109. (#1301)
Browse files Browse the repository at this point in the history
  • Loading branch information
aj-stein-nist authored and david-waltermire committed Aug 23, 2022
1 parent f89f8c5 commit cd7068a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions build/ci-cd/python/convert_filetypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ def process_xml(file, old='', new='', dry_run=False):
}
data = etree.parse(fd)
links = list(find_xml(data, namespaces, "//*[@href or @media-type]"))
replacements = list(r for r in replace(links, 'yaml', 'xml') if r)
replacements = list(r for r in replace(links, old, new) if r)
update_xml(data, namespaces, replacements, links, 'href')

new_file = dry_run_file(file) if dry_run else file
Expand Down Expand Up @@ -403,7 +403,7 @@ def process_yaml(file, old='', new='', dry_run=False):
yaml.constructor.yaml_constructors.pop(u'tag:yaml.org,2002:timestamp', None)
data = yaml.load(raw_data)
links = list(find(data, ['href', 'media-type']))
replacements = list(r for r in replace(links, 'json', 'yaml') if r)
replacements = list(r for r in replace(links, old, new) if r)
update(data, replacements, links, 'href')

new_file = dry_run_file(file) if dry_run else file
Expand Down

0 comments on commit cd7068a

Please sign in to comment.