Skip to content

Commit

Permalink
Preserve JSON key order in YAML, refs #1153
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed Jul 8, 2023
1 parent 38fcc96 commit 0183e1a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/metadata.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ Your ``metadata.yaml`` file can look something like this:

.. code-block:: yaml
title: Custom title for your index page
description: Some description text can go here
license: ODbL
license_url: https://opendatacommons.org/licenses/odbl/
source: Original Data Source
source_url: http://example.com/
title: Custom title for your index page
.. tab:: JSON
Expand Down
2 changes: 1 addition & 1 deletion docs/metadata_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
def metadata_example(cog, example):
cog.out("\n.. tab:: YAML\n\n")
cog.out(" .. code-block:: yaml\n\n")
cog.out(textwrap.indent(yaml.dump(example), " "))
cog.out(textwrap.indent(yaml.safe_dump(example, sort_keys=False), " "))
cog.out("\n\n.. tab:: JSON\n\n")
cog.out(" .. code-block:: json\n\n")
cog.out(textwrap.indent(json.dumps(example, indent=2), " "))
Expand Down

0 comments on commit 0183e1a

Please sign in to comment.