I thought I understood the problems I was having last week with the code due to variables inside \procedures, and I’ve managed to make functional modifications to it.
But with the following code, I don’t know what’s really happening. It doesn’t apply the values in $values, and I’m not sure why. If I replace the values with the ones I want, it works, so I think something’s wrong there.
Example: $values=" 'danger' 'callout-lateral' "
Would it be possible to specify variables in this or a similar way, or is the one you posted earlier the only one: $values=`<type> 'callout'<callout-model>` >
I’ve run several tests and haven’t found any that worked.
The $(var)$ syntax is the only way to substitute the value of a variable within the backtick syntax. <type> or <callout-model> within backticks would be treated as a literal value. Similarly, any quotes that appear inside your backticks will be preserved as quotes.
You didn’t mention it specifically, but I suspect 'callout'$(callout-model)$ may also be causing issues. As written, if <<model>> = “A”…
<<callout-model>> = -A
inside the backticks, 'callout'$(callout-model)$ = 'callout'-A
When the $genesis widget creates your details element, this will give you class="'callout'-A".
But 'callout'-... seems like an unlikely name for a CSS class. Are you sure you really want those single quotes around callout?
First of all, thanks for the clarification. There are still things about this topic I need to go into more detail about. You’re right. Based on what you’ve told me in other threads, if I use "" or with variables like this, <type> or <<type>> treats them as their literal value and therefore doesn’t generate the classes I want.
Regarding what you said about 'callout'$(callout-model)$, I understood, and I may be mistaken, that using ‘callout’ was used to enter the text string, or was that just with \define?
The classes as I have them in the CSS are: .callout, .callout-literal, and .callout-literalb.
When @EricShulman told me about the problem, I tried it and saw that it set the main class to .callout, but it turns out you’re right. The secondary classes (-lateral) aren’t being picked up, and I don’t know why…
Here you can see that I have model=lateral as the value, and it still has the .callout class. And the variable check table I have tells me that callout-model is doing it correctly.
I’m not sure where the miscommunication happened, but I can’t think of any scenarios in which this would be necessary. And when you’re using the backtick syntax in particular, everything that isn’t either a $(variable)$ or a ${ [[filter string]] }$ will be included literally, as it appears between the backticks — including spaces and quotation marks. This means that you should never use quotes inside backticks unless you want them to appear in your output.
I actually wouldn’t expect this to work at all, if you omitted ${ }$ around the filter as that example suggests. The following should work, though there’s not much benefit to using backticks over {{{ }}} syntax at this point…
Clearly, removing the single quotes from callout worked.
Regarding the single quotes for a string, it wasn’t something you told me; I probably saw it in another thread, or in another piece of code, and misinterpreted it. I’ve already written it down for the next time I have a question.
Well, in the end, the code works, just a matter of computer science… And the variant you provided also works, so now I have three ways to do it.
Regarding the secondary classes of .callout, they’re actually -lateral, not .literal, a matter of the translator…
I have a problem with the alternative method because I have to have [<type>] and callout[<callout-model>] separately. I tried: $values={{{ [<type>] [callout<callout-model>] +[join[ ]] }}} but it doesn’t work.
Where callout is a word and type and callout-model are variables.