Commit 91e387d2 authored by Willi Rath's avatar Willi Rath
Browse files

Merge branch 'develop' into 'master'

Add an easy way to properly credit original creators

See merge request !64
parents 7e87636c 6e6aab2d
Loading
Loading
Loading
Loading
+57 −4
Original line number Diff line number Diff line
@@ -351,10 +351,21 @@ class ReadmeRenderer(Renderer):
        """\
        # {{repo_name}}

        People: {{people}}

        {{repo_description}}

        **Note:**  *This dataset is just a mirror of an external source.
        Please make sure to properly credit the original creators of the data
        set just as you would do if you'd obtained the data directly from
        them.*

        {{maybe_acknowledgements}}
        {{maybe_citations}}

        ## People who might now

        To learn more, you can ask the following people:
        {{people}}

        ## Known problems

        - Open and closed issues are here:
@@ -395,6 +406,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,
                                             **kwargs)

    @staticmethod
    def _maybe_include_credentials(yaml_dict):
        if "credential_files" not in yaml_dict:
            yaml_dict["maybe_credentials"] = ""
        else:
@@ -404,9 +424,42 @@ class ReadmeRenderer(Renderer):
                                    "- \"{}\"".format(el)
                                    for el in yaml_dict["credential_files"]))
            yaml_dict["maybe_credentials"] = textwrap.dedent(cred_string)
        return yaml_dict

        super(ReadmeRenderer, self).__init__(yaml_dict=yaml_dict, *args,
                                             **kwargs)
    @staticmethod
    def _maybe_include_acknowledgements(yaml_dict):
        if "acknowledgements" not in yaml_dict:
            yaml_dict["maybe_acknowledgements"] = ""
        else:
            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}
                """.format(**yaml_dict)
            yaml_dict["maybe_acknowledgements"] = textwrap.dedent(
                ack_string)
        return yaml_dict

    @staticmethod
    def _maybe_include_citations(yaml_dict):
        if ("citations" not in yaml_dict or
                len(yaml_dict["citations"]) == 0):
            yaml_dict["maybe_citations"] = ""
        else:
            cite_string = textwrap.dedent("""\
                ## How to cite the data set?

                The following references provide details about the data
                set:

                """.format(yaml_dict["citations"]))
            for ct in yaml_dict["citations"]:
                cite_string += "\n- {text}, doi:{doi}\n".format(**ct)
            yaml_dict["maybe_citations"] = textwrap.dedent(cite_string)
        return yaml_dict


def _make_file_executable(file_name):
+12 −0
Original line number Diff line number Diff line
@@ -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

acknowledgements: |
    The TEST_REPO data was provided by EXAMPLE.COM.

citations:
    - 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

pre_processing: