Jump to content

Topic on Extension talk:Genealogy

Celyn Kendrick (talkcontribs)

I'm trying to generate a tree from within a template... but apparently, I can't delimit an array using new lines (in a way that makes the tree work.)

i.e. something like this doesn't work:

{{#genealogy:tree|ancestors={{#arrayprint:parents|<br />|format=Mermaid}}

Help?

Samwilson (talkcontribs)

@Celyn Kendrick: I take it that #arrayprint is from the Arrays extension? The syntax you have above is not valid; I'm guessing you missed the closing braces, i.e. {{#genealogy:tree|ancestors={{#arrayprint:parents|<br />}}|format=Mermaid}}

But to answer your question: no, I'm afraid it doesn't work. The |ancestors= and |descendants= parameters are split on "\n", and I'm not sure if there's anyway to get #arrayprint to correctly output that. It sounds like what we need is to make the delimiter customizable, perhaps via a new |delimiter= parameter. Does that sound okay? Then you could do e.g. {{#genealogy:tree|ancestors={{#arrayprint:parents|;}}|delimiter=;|format=Mermaid}}

Celyn Kendrick (talkcontribs)

A delimiter parameter sounds awesome! Thanks!

Celyn Kendrick (talkcontribs)

Do you know if there's a way to make mermaid display vertically vs. horizontally?

Samwilson (talkcontribs)

@Celyn Kendrick: I've just released version 2.4.0 with the new delimiter feature.

As for laying out Mermaid, I'm not really sure. I guess it's possible? Should we add an option for switching? Although there's probably lots of diagram customization that could be done… the other day I was wondering about integrating this tree drawing system: https://github.com/PeWu/topola-viewer — it might be nice to have something that's genealogy-specific instead of generic graph layout software.

Celyn Kendrick (talkcontribs)

Honestly, I haven't given the layout too much thought since suggesting it (although it would be a nice option). A more important/priority feature I could use is using a namespace other than (Main). I've created a namespace called Genealogy: but I'm understandably running into some issues. I'd rather not mix all the genealogy info in with my main pages. My scenario: A book series with complicated families/timelines... so it's not really necessary to have a complete genealogy, just trees I can highlight key people, etc., and include on a couple of pages, but without cluttering up the main characters with background that doesn't (really) matter except for rendering.

Thanks for your work!

Reply to "newline issues"