Closed stolksdorf closed 1 year ago
It shouldn't be too hard I think. The trickiest part (for me at least) is the Jison grammar that is used to generate the parser.
I am always careful about syntax changes, since it is hard to change once it is released in the wild. In this case the syntax mustn't clash with just a plain line of text - which can appear inside a classifier.
The most straightforward way - which also could open up for other uses - would be a new macro declaration.
#--pum: Progressive Utility Matrix
(inspired by css custom properties)
or
#declare-pum: Progressive Utility Matrix
(inspired by C)
C macros might not have this "this was a really good idea" reputation, but it would be a less invasive change here.
I was hoping a simple directive would work, but after taking a quick glance, it seems directives don't want to be multi-declared. I was hopeful looking at #import
, but it looks like you do a special cli-only parse step for that one.
the syntax I'm hoping for is something like:
#alias: pum=Progressive Utility Matrix
Not sure if I can collect each #alias
directive declaration into a list to utilize. Still might be possible to achieve, I'll have to play around a bit more with the parsing.
Are there any issues with using a syntax like this?
The custom classifier styles is a good starting point. They have a “.” prefix to separate them from other directives. We could prefix the aliases with “--“ or “alias-“ (or similar).
/Daniel
From: Scott Tolksdorf notifications@github.com Sent: Tuesday, July 16, 2019 5:01 PM To: skanaar/nomnoml Cc: Daniel Kallin; Comment Subject: Re: [skanaar/nomnoml] [enhancement] Alias/nickname syntax (#106)
I was hoping a simple directive would work, but after taking a quick glance, it seems directives don't want to be multi-declared. I was hopeful looking at #import, but it looks like you do a special cli-only parse step for that one.
the syntax I'm hoping for is something like:
Not sure if I can collect each #alias directive declaration into a list to utilize. Still might be possible to achieve, I'll have to play around a bit more with the parsing.
Are there any issues with using a syntax like this?
— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/skanaar/nomnoml/issues/106?email_source=notifications&email_token=AAE4P55MIPWVNO4YNWY2VD3P7XPDLA5CNFSM4IDYXXVKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2BERWA#issuecomment-511854808, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AAE4P57K3JR4Q2BDFLQYZSTP7XPDLANCNFSM4IDYXXVA.
Hi, In IPython, there is a syntax called "Magic command system" (https://ipython.org/ipython-doc/stable/interactive/reference.html#magic-command-system)
IPython will treat any line whose first character is a % as a special call to a ‘magic’ function. These allow you to control the behavior of IPython itself, plus a lot of system-type features.
We can apply similar logic in here.
%alias SailorMessage shiver me; timbers
[<actor>Sailor] - [<usecase>Ahoy friend. Message from alias: ${SailorMessage}]
I tweaked jison file a little bit: https://github.com/KurkanRamazan/nomnoml/blob/magic_commands/src/nomnoml.jison
A few year late, but I am about to release "alias" support!
Have a look at https://stage.nomnoml.com/ where I have deployed a release candidate for the new parser.
@stolksdorf I would be very grateful for some testing here before I deploy it to www.nomnoml.com 🙏
A few months late, but I'm here!
So happy that you worked on this feature. What is the syntax that you ended up with? I don't see alias
referenced in the documentation, but in some examples I see the use of the id=
attribute.
If I try to use the id attribute on it's own I get an error (on both prod and stage) . eg. [<id=foo> Foo Bar]
.
You have to start the attribute bracket with a type (for example "class"). This might change...
I have intentionally not promoted the new features too much since I had to rewrite the parser and I would like to find the bugs related to the old syntax first.
This is now released as v1.6.1
🎉
It would be great to have a syntax for assigning a shorter alias to nodes. Sometimes I'll have very large diagrams with long node names, it makes it difficult to update each instance of the node in the structure.
example:
Any syntax can work, I don't know what would be easiest in regards to the internal parser.
I would be interested in taking a stab at this feature and making a PR. If you could let me know how do-able this is and any tips/places in code to get started, that would be great.