question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Nested Inline Fields

See original GitHub issue

Is your feature request related to a problem? Please describe. Frontmatter data can be arbitrarily nested however as far as I understand it your inline field system is limited to just top level keys and values.

Describe the solution you’d like It would be nice if there was a way to describe arbitrarily nested data through the inline fields as well. This may be incompatible with the current implementation so I understand if you mark this as won’t-fix

For example I would like to collect all date ranges under the date key for easy accessing. In YAML I would do something like this.

---
date:
  construction: 2000
  life: 2000-2020
  demolition: 2020
---

Could be defined inline as

(date:: construction:: 2000)
(date:: life:: 2000-2020)
(date:: demolition:: 2020)

And rendered like this image

Additional Context There are some compatibility issues that I don’t have answers to eg what would the following look like in data form

(date:: 2000)
(date:: life:: 2000-2020)

or this

(date:: 2000)
(date:: 2020)
(date:: life:: 2000-2020)

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
gentlegiantJGCcommented, Jul 22, 2022

I have opened a pull request to fix the html corruption.

I have had some more thoughts on how the data should be structured when parsed.

Examples

Here are some examples of how the plugin currently parses data (I believe)

Example 1

[key:: value]

becomes

{"key": "value"}

Example 2

[key1:: value1]
[key1:: value2]

becomes

{"key1": ["value1", "value2"]}

Example 3

[key1:: value1]
[key1:: [key2:: value2]]

becomes

{"key1": ["value1", "[key2:: value2]"]}

Example 4

[key1:: value1]
[key1:: [key2:: value2]]
[key1:: [key2:: value3]]

becomes

{"key1": ["value1", "[key2:: value2]", "[key2:: value3]"]}

The two options going forward as far as I see them are either

  1. Dataview plugin has no special handling and continues to treat them as strings and leaves it up to the user to handle them
  2. Dataview plugin looks for nested fields and parses those as well. Examples 3 and 4 would look like the following.
{"key1": ["value1", {"key2": "value2"}]}
{"key1": ["value1", {"key2": "value2"}, {"key2": "value3"}]}

I don’t think it would be wise for the dataview plugin to try and merge the data more than this due to the ambiguity of how to merge dictionaries as well as the possibility of the list containing strings.

3reactions
gentlegiantJGCcommented, Jul 21, 2022

I have solved this particular issue in a different way outside of the dataview plugin. I thought I would just thought I would open the discussion.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Inline Form nested within Horizontal Form in Bootstrap 3
I have created a demo for you. Here is how your nested structure should be in Bootstrap 3: <div class="form-group"> <label for="birthday" ...
Read more >
Django Nested Inline. Save Data. - DEV Community ‍ ‍
Since our nested-inline is defined as a read-only field, the changed_data property will nominally ignore all changes in nested-inline, so we ...
Read more >
django-nested-inline 0.4.5 - PyPI
Recursive nesting of inline forms for Django Admin.
Read more >
3. How to add nested inlines in Django admin? - Books by Agiliq
You want to have one admin page to create Category , Hero and HeroAcquaintance objects. However, Django doesn't support nested inline with Foreign...
Read more >
Nested inline active fields inside Bootstrap horizontal forms
Step 1: Your Horizontal Form Layout; Step 2: Rendering Inline Fields; Step 3: Controlling your label widths/styles per field; Viewing a demo.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found