Skip to content

Commit

Permalink
Update ttl_to_context.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jsimonclark authored Mar 28, 2024
1 parent fe13244 commit 53f04bd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion sphinx/ttl_to_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,13 @@ def generate_jsonld_context(ttl_file, predicate_uri, label_uri='http://www.w3.or
predicate_uri = 'http://www.w3.org/2004/02/skos/core#prefLabel'
context = generate_jsonld_context(file_uri, predicate_uri)

# Determine the path for saving the context file in the same directory as the HTML docs
context_file_path = os.path.join(os.path.dirname(file_path), 'sphinx/_build/html/context/context.json')

# Create the directory if it doesn't exist
os.makedirs(os.path.dirname(context_file_path), exist_ok=True)

# Save to JSON file
with open("./sphinx/_build/html/context/"+ 'context.json', "w+", encoding="utf-8") as f:
with open(context_file_path, 'w') as f:
json.dump(context, f, indent=4)

0 comments on commit 53f04bd

Please sign in to comment.