diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a118d98343a2fbee4324c4a8afd0807c9582eed..825358c2888c44e44668d93e8dd0445e3ae55c43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `h5` instead of `h5-crawler` - `dev`, `doc`, `test` and `all` are new, they install the dependencies for developing, testing, documentation and everything. +- The `pandoc_header_tools.get_header()` parameter `add_header` has been renamed to `add_header_to_file` + to resolve a name collision. ### Deprecated ### diff --git a/src/caosadvancedtools/pandoc_header_tools.py b/src/caosadvancedtools/pandoc_header_tools.py index a0191e5a7880edb7aa378ad4f3f67f13fae28edb..88cdbc19ffa8d5dd724be0e1042fb2a42094c7dc 100644 --- a/src/caosadvancedtools/pandoc_header_tools.py +++ b/src/caosadvancedtools/pandoc_header_tools.py @@ -68,31 +68,30 @@ description: """ -def get_header(filename, add_header=False): - """Open an md file identified by filename and read out the yaml -header. +def get_header(filename, add_header_to_file=False): + """Open an md file identified by filename and read out the yaml header. -filename can also be a folder. In this case folder/README.md will be used for -getting the header. + filename can also be a folder. In this case folder/README.md will be used + for getting the header. -If a header is found a tuple is returned: (first yaml header line index, last+1 -yaml header line index, header) + If a header is found a tuple is returned: (first yaml header line index, + last+1 yaml header line index, header) -Otherwise, if `add_header` is True, a header is added and the function is called -again. + Otherwise, if `add_header_to_file` is True, a header is added and the + function is called again. -The header is normalized in the following way: + The header is normalized in the following way: -- If the value to a key is a string, a list with that string as only element is - returned. + - If the value to a key is a string, a list with that string as only + element is returned. -From https://pandoc.org/MANUAL.html: - -A YAML metadata block is a valid YAML object, delimited by a line of three -hyphens (---) at the top and a line of three hyphens (---) or three dots (...) -at the bottom. A YAML metadata block may occur anywhere in the document, but if -it is not at the beginning, it must be preceded by a blank line. + From https://pandoc.org/MANUAL.html: + A YAML metadata block is a valid YAML object, delimited by a line of three + hyphens (---) at the top and a line of three hyphens (---) or three + dots (...) at the bottom. A YAML metadata block may occur anywhere in the + document, but if it is not at the beginning, it must be preceded by a blank + line. """ if os.path.isdir(filename): @@ -146,7 +145,7 @@ it is not at the beginning, it must be preceded by a blank line. raise NoValidHeader(filename) return (found_1, found_2, clean_header(yaml_part)) - if not add_header: + if not add_header_to_file: raise NoValidHeader(filename) else: print("Adding header in: {fn}".format(fn=filename))