kopia lustrzana https://github.com/simonw/datasette
Preserve JSON key order in YAML, refs #1153
rodzic
38fcc96e67
commit
0183e1a72d
|
@ -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
|
||||
|
|
|
@ -6,7 +6,7 @@ import yaml
|
|||
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), " "))
|
||||
|
|
Ładowanie…
Reference in New Issue