Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for structured and nested values in metadata (#120) #368

Merged
merged 2 commits into from Sep 18, 2020

Conversation

andrenasturas
Copy link

Pull request fixing #120. All tests passes. Existing test on metadata is extended to cover new cases.

Dict support

key:
  subkey: subvalue

is now parsed as key: {subkey: subvalue}

List support

key:
  - one
  - two

is now parsed as key: ["one", "two"]

Nested structured values support

key:
  subkey:
    - >
      Long text
      in structure

is now parsed as key: {subkey: ["Long text\n in structure"]

Nota bene

  • Sub-elements can be indented by an arbitrary number of spaces or tabs, as soon as the indent is strictly identical for each element.
  • Sub-elements must begin with a line return. syntax like key: subkey: subvalue is not supported.

lib/markdown2.py Outdated
kvm = re.findall(self._key_val_block_pat, metadata_content)
kvm = [item.replace(": >\n", ":", 1) for item in kvm]
def parse_structured_value(value):
print(repr(value))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we nuke this print?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! Sorry about that.

@nicholasserra
Copy link
Collaborator

LGTM, thanks! Just had an extra print in there that needs removed, otherwise this should be good to go.

@nicholasserra
Copy link
Collaborator

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants