How to deal with repeated yaml keys in dataview table

What I’m trying to do

Hi everyone, I have recently started using Dataview.

I use the Zotero plugin with the following snippet to get Author info of each publication. I think I got it from someone on here, so thanks!

>{%- for creator in creators %}
{%- if == null %} **{{creator.creatorType | capitalize}}**:: {{creator.lastName}}, {{creator.firstName}}  </br>
{%- endif -%}
{%- if %}**{{creator.creatorType | capitalize}}**:: {{}}  </br>
{%- endif -%}
{%- endfor %}

This creates the following output

Author:: John
Author:: Richard
Author:: Amelie

which looks like this on edit mode

> **Author**:: John</br> **Author**:: Richard</br> **Author**:: Amelie</br> 

However, unless I manually enter a break, the author column on a dataview talbe will look something like this:

Author:: Richard
Author:: Amelie

Instead of the expected:


So from what I understand, dataview parses the whole line as one author unless I manually add a line break between them. In that case, it creates the desired list of authors.

Does anyone know how I can make this work (as in, have each author in its own line) after using my template? This would allow dataview to parse like I expect it to.

Thanks in advance!

Things I have tried

I googled a bit and tried to use < br>, also add two of them and even adding two spaces before the break on my template. Nothing got me my desired result.

I’m not into that Zotero template thingy, so that part you need to work out on your own, but I can inform a little on the inline field syntax stuff.

Here’s an example with the markup on the left, and the actual fields as seen by Dataview on the right:

The markup as a code block
Author:: John
Author:: Johnny
Author:: John Frederic

**NotAuthor**:: Richard **NotAuthor**:: Bob **NotAuthor**:: Ricky

[Author:: Amelie], [Author:: Amy], and so on

AuthorList:: "Frederic2", "Freddy", "Fred"

In the first section, on “John”, I’ve show cased how single entries each on separate lines will add values to the Author field. All good here…

In the second section, on “Richard” & co, we see that when not using any other delimiters, the value of the NotAuthor field is in fact the rest of the paragraph, and it kind of swallows up the two other candidates for a list to be held within NotAuthor. Not so good…

In the third section, on “Amelie”, I show the proper syntax for having multiple inline field within a paragraph, and that is to surround them by square brackets. So both the variants of “Amelie” are added to the Author list

Finally in the fourth section, on “Frederic” & co, I show one way to define the list in one go, using quotes to signify that each entry is a separate entry.

Various other peculiarities will come into play if you switch to defining links and/or dates, or introduce spaces into the names. So care should be taken, and one way to verify that the end result is like you wanted it to be is to do something like: `$= dv.list(dv.current().Author)`
which will list each separate value on a line of its own (with one bullet per item).

Hopefully, this makes sense, and gives you some idea of what you need to change within your Zotero template to get the proper markup.


Hi Holroy,

This is exactly what was missing for understanding how this works on Dataview.

Thank you so much!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.