Skip to content

Commit 88c57fd

Browse files
Recipe JS: improve support for escape sequences in copied code (#46)
* fix: Mixed escape sequences in copied code * recipe.js: disable client-side caching --------- Co-authored-by: Scott W Harden <swharden@gmail.com>
1 parent 4cb7cd3 commit 88c57fd

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

layouts/_default/baseof.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
3535

3636
<script src="/js/anchor.js"></script>
37-
<script src="/js/recipe.js?20250123"></script>
37+
<script src="/js/recipe.js?20250128"></script>
3838

3939
<link rel="stylesheet" href="/css/accordian.css?20231209">
4040
<link rel="stylesheet" href="/css/stats.css?20231209">

static/js/recipe.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,13 @@ function copy_button_clicked(button) {
8787
const name = localStorage.getItem("startupLanguage");
8888
code = "";
8989
if (name == "Console") {
90-
code = codeBlock.innerHTML;
90+
code = codeBlock.textContent;
9191
} else if (name == "WinForms") {
92-
code = getControlCode(codeBlock.innerHTML, 'formsPlot1');
92+
code = getControlCode(codeBlock.textContent, 'formsPlot1');
9393
} else if (name == "WPF") {
94-
code = getControlCode(codeBlock.innerHTML, 'WpfPlot1');
94+
code = getControlCode(codeBlock.textContent, 'WpfPlot1');
9595
} else if (name == "Other") {
96-
code = getControlCode(codeBlock.innerHTML, 'MyPlotControl');
96+
code = getControlCode(codeBlock.textContent, 'MyPlotControl');
9797
} else {
9898
console.error("unknown language: " + name)
9999
}

0 commit comments

Comments
 (0)