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

Duplicate names #8

Open
i2xzy opened this issue Nov 20, 2018 · 1 comment
Open

Duplicate names #8

i2xzy opened this issue Nov 20, 2018 · 1 comment

Comments

@i2xzy
Copy link

i2xzy commented Nov 20, 2018

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

@AlexanderWillner
Copy link

Fixed by @vabene1111 in https://github.com/vabene1111/kingraph and I pushed some additional fixes at https://github.com/AlexanderWillner/kingraph

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

No branches or pull requests

2 participants