aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/shell.html5
-rw-r--r--tests/hello_world_sdl.cpp3
2 files changed, 6 insertions, 2 deletions
diff --git a/src/shell.html b/src/shell.html
index 69217b18..a41086b9 100644
--- a/src/shell.html
+++ b/src/shell.html
@@ -19,7 +19,10 @@
print: (function() {
var element = document.getElementById('output');
return function(text) {
- element.innerHTML += text.replace('\n', '<br>', 'g') + '<br>';
+ text = text.replace(/</g, "&lt;");
+ text = text.replace(/>/g, "&gt;");
+ text = text.replace('\n', '<br>', 'g');
+ element.innerHTML += text + '<br>';
};
})(),
canvas: document.getElementById('canvas')
diff --git a/tests/hello_world_sdl.cpp b/tests/hello_world_sdl.cpp
index df69b055..35aec303 100644
--- a/tests/hello_world_sdl.cpp
+++ b/tests/hello_world_sdl.cpp
@@ -20,7 +20,8 @@ int main() {
if (SDL_MUSTLOCK(screen)) SDL_UnlockSurface(screen);
SDL_Flip(screen);
- printf("you should see a colored cube.");
+ printf("you should see a colored cube.\n");
+ printf("and here is some text that should be HTML-friendly: amp: |&| double-quote: |\"| quote: |'| less-than, greater-than, html-like tags: |<cheez></cheez>|\nanother line.\n");
SDL_Quit();