Is it possible to reference the host card or and-or plus card from a plus card of that host?

Support Ticket

+status
 

Suppose I am viewing the Whatever card and I create two plus cards in its content {+number} and {+somename}.

 

Is it possible to reference a transclusion inside {+numer} to {+somename} programatically inside the Structure Rule so that Whatever's host card name can change?

 

The short answer is yes. This is all done by "contextual" name evaluation. The +x processing is part of that, but there are a bunch of other substitutions that are very useful. So, from A+somename, if I want A+number, it is: {{_left+number}}. Theres stuff like _user, and _param (where param is the name of a query parameter).

--Gerry Gleason.....2015-05-04 13:19:24 +0000

See contextual names. We don't technically have any syntax for the "nesting" card (which you're calling the host), but we do have handling for the name parents (_left and _right). Since the most common case is for the left name parent to nest the name child, you have the syntax you need there.

 

Gerry, I think everything you said is spot on except for _param. I don't think that's actually a thing; pretty sure it's not a "blessed" part of the nest API.

--Ethan McCutchen.....2015-05-04 15:44:04 +0000

I misremembered this little piece of code:

when /^_/
custom = args[:params] ? args[:params][part] : nil
custom ? CGI.escapeHTML(custom) : part #why are we escaping HTML here?

The params are not query params, but view params.  I imagine that is used for things like keyword searches where the custom view arg is from code, not inclusion syntax.

--Gerry Gleason.....2015-05-04 22:03:51 +0000

I don't think that code is used. Almost certainly not from nests.

--Ethan McCutchen.....2015-05-04 22:35:50 +0000

We should probably remove it if it isn't used now. I'm sure you probably know that's from Smartname.

--Gerry Gleason.....2015-05-04 22:43:22 +0000

ya. and ya.

--Ethan McCutchen.....2015-05-05 02:27:27 +0000

Ok great! This is what I was looking for contextual names, and the _L, _R, _LL, _LR,  _LLL part is particularly interesting.

--Mir S......2015-05-06 19:04:09 +0000

Yeah, like car and cdr in lisp, or cddr and caddddr. Don't stress out the way-back machine on those references.

--Gerry Gleason.....2015-05-09 15:31:21 +0000