lisongx / wikidata-elements

Custom HTML elements to reuse Wikidata
https://wikidata-elements.js.org
MIT License
14 stars 2 forks source link

Support multiple values #4

Open nichtich opened 5 years ago

nichtich commented 5 years ago

What about multi-value properties? For instance

<wd-entity id="Q42" property="P735" lang="en"/>

should not simply emit "Douglas" but some kind of list, e.g.

<ul><li>Douglas</li><li>Noël</li></ul>

Formatting (inline, bullet-list...) can be done via CSS.

Note that the order of list items is random unless you look at qualifiers.

dominiclooser commented 4 years ago

I was thinking about that too and came to the same conclusion: it should output an unordered list, which can be styled with css afterwards.

lisongx commented 4 years ago

@dominiclooser Thanks for your valuable input, this has always been in my mind since the begining! But it didn't come up with something very clear to do before

Render a ul and li seems like a good choice, but I guess we should support one option to force render the "main" value for the property even when there's list of values?

dominiclooser commented 4 years ago

I see your point. For example with the population of a city there are a lot of values for different times. There should be an option to choose if you want to get just the most recent value.

What about to first implement to give back all values as an ul? And to wait if there are people really needing the other case with just one value?

lisongx commented 4 years ago

@dominiclooser That sounds a good plan, I'm going to see how I can implement that this week! Cheers 🤞