As shown in Difference between ParentList and Inherited we can use ParentList
to nicely merge additional rules.
It seems to work nicely when it comes to inheriting between 'objects' like: $FrontEnd
, $FrontEndSession
, _StyleSheet
, _Notebook(Object)
, _Cell(Object)
etc.
I failed to make it work for StyleData[style]
and StyleData[style, env]
pair.
Here is an example:
CreateDocument[
{ Cell[BoxData@"", "Input"] }
, StyleKeyMapping -> {ParentList, "&" -> "WolframAlphaShort"}
, StyleDefinitions -> Notebook[
{ Cell[StyleData[StyleDefinitions -> "Default.nb"]]
, Cell[StyleData["Input", "Working"]
, StyleKeyMapping -> {ParentList, "Tab" -> "WolframAlphaShort"}
]
}
]
]
By default when you hit =
, in an empty Input
cell, it will be converted to a WolframAlphaShort
cell.
I wanted to add &
and Tab
to do the same. The former explicitly in a notebook and the latter via stylesheet.
They both work but the original =
does not anymore.
This means the Notebook's
spec correctly merged stylesheet's spec but the stylesheet resolution failed to merge spec from Default.nb.
Should it happen? Is there any way to proceed without explicitly including parent spec?
At the end I want all &
, Tab
and =
to produce WAShort cell.
related:
Updating styles which are based on styles changed in private stylesheet
CreateDocument[{}, StyleKeyMapping -> {ParentList, "&" -> "WolframAlphaShort"}]
doesn't cause the&
to work, while the equivalent version puttingStyleKeyMapping -> {ParentList, "&" -> "WolframAlphaShort"}
in the stylesheet causes&
to work but not=
. $\endgroup$