Commit 18d6ca56 authored by Willi Rath's avatar Willi Rath

Add acknowledgements/citations to rendered Readme

This addresses #57
parent 7e87636c
......@@ -354,6 +354,8 @@ class ReadmeRenderer(Renderer):
People: {{people}}
## Known problems
......@@ -395,6 +397,15 @@ class ReadmeRenderer(Renderer):
def __init__(self, yaml_dict=None, *args, **kwargs):
"""Add credentials file info but use super's init otherwise."""
yaml_dict = self._maybe_include_credentials(yaml_dict)
yaml_dict = self._maybe_include_acknowledgements(yaml_dict)
yaml_dict = self._maybe_include_citations(yaml_dict)
super(ReadmeRenderer, self).__init__(yaml_dict=yaml_dict, *args,
def _maybe_include_credentials(yaml_dict):
if "credential_files" not in yaml_dict:
yaml_dict["maybe_credentials"] = ""
......@@ -404,9 +415,46 @@ class ReadmeRenderer(Renderer):
"- \"{}\"".format(el)
for el in yaml_dict["credential_files"]))
yaml_dict["maybe_credentials"] = textwrap.dedent(cred_string)
super(ReadmeRenderer, self).__init__(yaml_dict=yaml_dict, *args,
return yaml_dict
def _maybe_include_acknowledgements(yaml_dict):
if "acknowledgements" not in yaml_dict:
yaml_dict["acknowledgements_parsed"] = ""
ack_string = """\
## How to acknowledge the original data set?
Please consider to include the following in the
acknowledgements of any manuscript that uses the data:
> {acknowledgements}
yaml_dict["acknowledgements_parsed"] = textwrap.dedent(
return yaml_dict
def _maybe_include_citations(yaml_dict):
if ("citations" not in yaml_dict or
len(yaml_dict["citations"]) == 0):
yaml_dict["citations_parsed"] = ""
cite_string = """\
## How to cite the data set?
The following references provide details about the data
yaml_dict["citations_parsed"] = textwrap.dedent(
for ct in yaml_dict["citations"]:
yaml_dict["citations_parsed"] += """\
- {text}, doi:{doi}
return yaml_dict
def _make_file_executable(file_name):
......@@ -25,6 +25,18 @@ repo_description: |
asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf
asdf asdf asdf asdf asdf asdf
acknowledgement: |
The TEST_REPO data was provided by EXAMPLE.COM.
- text: Doe, J., J. Doe, A new TEST dataset, J. Alchemy,
doi:12.345/987654asdf11, 2017
doi: 12.345/987654asdf11
- text: Doe, J., J. Doe, An old TEST dataset, J. Alchemy,
doi:12.345/987654asdf10, 2011
doi: 12.345/987654asdf10
prefixes: data doc
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment