So I've been playing with the new 11.1 documentation style and I noticed that there's something seemingly odd with the openers.
If we open any doc page:
Documentation`HelpLookup@"TaggingRules"
And look at any of the section openers we see they're something custom:
But they work totally normally. And looking at how they're implemented we see a general pattern like:
Dynamic@
CurrentValue[EvaluationNotebook[],
{TaggingRules, "Openers", style},
Closed]
(where style
is sometimes more deeply nested, like "ExamplesSection", "0"
).
And interestingly we can open and close the groups via:
CurrentValue[EvaluationNotebook[],
{TaggingRules, "Openers", style}] = Open | Closed
And this gets updated when the cell group is opened and closed by hand, too.
If we copy and paste one of these cells the behavior is preserved, but if we take the cell expression and reprint it using NotebookWrite
it no longer works. The cell group will open and close because it has WholeCellGroupOpener->True
but the opener won't toggle states and we can't close it via CurrentValue
.
If I look at the Cell
expressions there's no difference, so what causes this?
Update for clarity:
I expected to see grouping from the automatic grouping that Mathematica applies. I figured the grouping behavior would be handled somehow in the Cell
expression because copying one of the CellObjects
yielded the opening behavior I originally saw. It turns out the CellObject
simply remembered the grouping spec.