Skip to content

Duplicate names #8

@i2xzy

Description

@i2xzy

At the moment, as far as I can tell, the way to get around duplicate names is to give a unique id e.g. 'name2' and then modify the name field in the people obj

people:
  #duplicates
  Henry2:
    name: Henry
  William2:
    name: William

The only problem with this in the below code if person.name && !person.fullname you end up with the name written twice:

if (person.name || person.fullname) {
label =
'<<table align="center" border="0" cellpadding="0" cellspacing="2" width="4">' +
'<tr><td align="center">' +
`${person.name || id}</td></tr>` +
'<tr><td align="center">' +
'<font point-size="10" color="#aaaaaa">' +
`${person.fullname || person.name}</font></td></tr></table>>`
} else {
label = id
}

The solution I came up with is the following:

  if (person.fullname) {  // only make a second line when there is a fullname 
    label =
      '<<table align="center" border="0" cellpadding="0" cellspacing="2" width="4">' +
      '<tr><td align="center">' +
      `${person.name || id}</td></tr>` +
      '<tr><td align="center">' +
      '<font point-size="10" color="#aaaaaa">' +
      `${person.fullname}</font></td></tr></table>>` // put the fullname in the second line
  } else {
    label = person.name || id // if there is a name use that otherwise use id
  }

Really loving this project btw
thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions