Rule to prevent endash?

Consider…

.sv-section-selector-panel {
 background-color: var(--panel-bgcolor);
 <<std-bk-panel-css>>
}

I would like to add the var(--panel-bgcolor) line to the macro std-bk-panel-css, but when I do, TW is changing the double-hyphen to endash.

My current rule pragma:

\rules only filteredtranscludeinline transcludeinline macrodef macrocallinline

which clearly does nothing to help here.

I see a parser rule for dash in ControlPanel → Info → Advanced → Parsing but that doesn’t seem to help either. And either way, can I have two rule pragmas? One like above and another (except) to turn off dash transposing?

Or am I missing something obvious?

maybe create a field code-body:yes or test to wrap things with <pre>...</pre>

Uh… how would that help exactly?

Ha! 'taint pretty but…


\define hyphen() -
\define std-bk-panel-css()
 background-color: var(<<hyphen>><<hyphen>>panel-bgcolor);
 other:stuff;
\end

works just fine.

Thanks for the inspiration, @twMat

The following code snippet should do what you want. It uses \rules except dash inside the macro definition.

Every macro, procedure or function definition opens a new parser. So the \rules pragma can be used there.

You could also use the \rules only xxx rule inside the macro definition. But I used \rules only because it’s easier to understand as an example.

\rules only filteredtranscludeinline transcludeinline macrodef macrocallinline

\define std-bk-panel-css()
\rules except dash
background-color: var(--panel-bgcolor);
color: #aaa;
\end

.sv-section-selector-panel {
 <<std-bk-panel-css>>
}