Skip to content

Commit aa243a4

Browse files
authored
Merge pull request #990 from WolframResearch/bugfix/enable-code-captions-in-code-blocks
Bugfix: Enable code captions in code blocks
2 parents f73f0a4 + c48d846 commit aa243a4

File tree

1 file changed

+24
-18
lines changed

1 file changed

+24
-18
lines changed

Source/Chatbook/Formatting.wl

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -909,24 +909,24 @@ attachCopiedTooltip[ ] :=
909909
StyleBox[
910910
FEPrivate`ImportImage[
911911
FrontEnd`FileName[{"Typeset", "ClickToCopy"}, "Checkmark.png"]],
912-
Magnification -> 0.5`]],
913-
BaselinePosition -> Scaled[0.1`] -> Baseline],
912+
Magnification -> 0.5`]],
913+
BaselinePosition -> Scaled[0.1`] -> Baseline],
914914
DynamicBox[
915-
ToBoxes[FEPrivate`FrontEndResource["FEStrings",
916-
"clicktocopyDoneTooltip"], StandardForm]]}},
915+
ToBoxes[FEPrivate`FrontEndResource["FEStrings",
916+
"clicktocopyDoneTooltip"], StandardForm]]}},
917917
GridBoxAlignment -> {"Columns" -> {{Left}}, "Rows" -> {{Baseline}}},
918-
GridBoxItemSize -> {"Columns" -> {{Automatic}},
919-
"Rows" -> {{Automatic}}},
920-
GridBoxSpacings -> {"Columns" -> {{0.3`}}, "Rows" -> {{0}}}],
921-
Alignment -> Center,
922-
Appearance -> {"Default" ->
923-
FrontEnd`FileName[{"Chatbook"}, "CopyTooltip.9.png"]}, ImageSize -> {100, Automatic},
924-
FrameMargins -> {{0, 0}, {0, 0}},
925-
BaseStyle -> {LineBreakWithin -> Automatic,
926-
LinebreakAdjustments -> {1.`, 10, 1, 0, 1}, LineIndent -> 0,
927-
Hyphenation -> False,
918+
GridBoxItemSize -> {"Columns" -> {{Automatic}},
919+
"Rows" -> {{Automatic}}},
920+
GridBoxSpacings -> {"Columns" -> {{0.3`}}, "Rows" -> {{0}}}],
921+
Alignment -> Center,
922+
Appearance -> {"Default" ->
923+
FrontEnd`FileName[{"Chatbook"}, "CopyTooltip.9.png"]}, ImageSize -> {100, Automatic},
924+
FrameMargins -> {{0, 0}, {0, 0}},
925+
BaseStyle -> {LineBreakWithin -> Automatic,
926+
LinebreakAdjustments -> {1.`, 10, 1, 0, 1}, LineIndent -> 0,
927+
Hyphenation -> False,
928928
HyphenationOptions -> {"HyphenationCharacter" -> "\[Null]"},
929-
FontFamily -> "Source Sans Pro", FontSize -> 12,
929+
FontFamily -> "Source Sans Pro", FontSize -> 12,
930930
FontColor -> GrayLevel[0.5]}],
931931
Alignment -> { Center, Bottom },
932932
FrameMargins -> 0,
@@ -935,7 +935,7 @@ attachCopiedTooltip[ ] :=
935935
] ],
936936
{ Center, Bottom }, Offset[ { 0, -7 }, Automatic ], { Center, Center },
937937
RemovalConditions -> { "MouseExit" }
938-
];
938+
];
939939

940940
attachCopiedTooltip // endDefinition;
941941

@@ -1941,7 +1941,10 @@ makeInteractiveCodeCell[ lang_String? wolframLanguageQ, code0_ ] := Enclose[
19411941
LanguageCategory -> "Input",
19421942
ShowAutoStyles -> True,
19431943
ShowStringCharacters -> True,
1944-
ShowSyntaxStyles -> True
1944+
ShowSyntaxStyles -> True,
1945+
TranslationOptions -> {
1946+
"Enabled" -> Dynamic @ AbsoluteCurrentValue[ $FrontEnd, { TranslationOptions, "Enabled" } ]
1947+
}
19451948
];
19461949
handler = inlineInteractiveCodeCell[ display, code ];
19471950
codeBlockFrame[ ToBoxes @ handler, code ]
@@ -2418,7 +2421,10 @@ attachment[ alt_String, key_String, expr_ ] :=
24182421
LanguageCategory -> "Input",
24192422
ShowAutoStyles -> True,
24202423
ShowStringCharacters -> True,
2421-
ShowSyntaxStyles -> True
2424+
ShowSyntaxStyles -> True,
2425+
TranslationOptions -> {
2426+
"Enabled" -> Dynamic @ AbsoluteCurrentValue[ $FrontEnd, { TranslationOptions, "Enabled" } ]
2427+
}
24222428
];
24232429
handler = inlineInteractiveCodeCell[ display, Cell[ BoxData @ cachedBoxes @ expr, "Input" ] ];
24242430
codeBlockFrame[ Cell @ BoxData @ ToBoxes @ handler, expr ]

0 commit comments

Comments
 (0)