Skip to content
This repository was archived by the owner on Sep 10, 2022. It is now read-only.

Commit 5c06c81

Browse files
committed
_includes/java_visualizer.html: Remove visualization embedding
1 parent 8caeeaf commit 5c06c81

File tree

1 file changed

+24
-52
lines changed

1 file changed

+24
-52
lines changed

_includes/java_visualizer.html

+24-52
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{% comment %}
2-
Version 2018-08-08
2+
Version 2019-08-06
33
https://github.com/kevinlin1/jekyll-python-tutor
44

55
Liquid template for generating Java Visualizer embeds.
@@ -12,73 +12,45 @@
1212
}
1313
}
1414
{%- endcapture -%}
15-
{% include java_visualizer.html
16-
embed=true caption="Hello, world!" code=HelloWorld
17-
height="480px" curInstr="0" args='["arg1", ...]' stdin="stdin" %}
15+
{% include java_visualizer.html code=HelloWorld caption="Hello, world!" %}
16+
17+
Advanced usage:
18+
{%- capture HelloWorld -%}
19+
public class HelloWorld {
20+
public static void main(String[] args) {
21+
System.out.println("Hello, world!");
22+
}
23+
}
24+
{%- endcapture -%}
25+
{% include java_visualizer.html code=HelloWorld caption="Hello, world!"
26+
label="Visualize Code" curInstr="0" args='["arg1", ...]' stdin="stdin" %}
1827
{% endcomment %}
1928

20-
{% assign height = include.height | default: '564px' %}
29+
{% assign code = include.code | default: '' %}
30+
{% assign caption = include.caption | default: '' %}
31+
{% assign label = include.label | default: 'Visualize Code' %}
32+
{% assign class = include.class | default: 'btn' %}
2133
{% assign curInstr = include.curInstr | default: 0 %}
2234
{% assign args = include.args | default: '[]' %}
2335
{% assign stdin = include.stdin | default: '' %}
24-
{% assign code = include.code | default: '' %}
25-
{% assign caption = include.caption | default: '' %}
26-
{% assign embed = include.embed | default: false %}
2736

28-
{% if embed %}
29-
{% capture data %}
30-
{
31-
"user_script":"{{ code | replace: '"', '\"' | newline_to_br | replace: '<br />', '\n' }}",
32-
"options":{
33-
"showStringsAsValues":false,
34-
"showAllFields":false
35-
},
36-
"args":{{ args }},
37-
"stdin":"{{ stdin }}"
38-
}
39-
{% endcapture %}
40-
{% assign data = data
41-
| strip_newlines
42-
| uri_escape
43-
| replace: '#', '%23'
44-
| replace: '$', '%24'
45-
| replace: '&', '%26'
46-
| replace: '+', '%2B'
47-
| replace: ',', '%2C'
48-
| replace: '/', '%2F'
49-
| replace: ':', '%3A'
50-
| replace: ';', '%3B'
51-
| replace: '=', '%3D'
52-
| replace: '?', '%3F'
53-
| replace: '@', '%40'
54-
| replace: '[', '%5B'
55-
| replace: ']', '%5D'
56-
%}
57-
{% else %}
5837
{% capture codeBlock %}
5938
```java
6039
{{ code }}
6140
```
6241
{% endcapture %}
6342
{% assign codeBlock = codeBlock | markdownify %}
64-
{% endif %}
6543

44+
{% if label %}
6645
<figure>
67-
{% if embed %}
68-
<iframe style="width: 100%; height: {{ height }}; border: 0;"
69-
src="https://cscircles.cemc.uwaterloo.ca/java_visualize/iframe-embed.html#data={{ data }}&cumulative=true&heapPrimitives=false&drawParentPointers=false&textReferences=false&showOnlyOutputs=false&py=3&curInstr={{ curInstr }}&resizeContainer=true&highlightLines=true&rightStdout=true">
70-
</iframe>
71-
{% else %}
7246
{{ codeBlock }}
73-
{% endif %}
74-
{% if caption %}
7547
<figcaption>
7648
{{ caption }}
77-
<div class="tag-list">
78-
<a class="button" target="_blank" rel="noreferrer" href="https://cscircles.cemc.uwaterloo.ca/java_visualize/#code={{ code | url_encode }}&mode=edit&showStringsAsObjects=&disableNesting=&args={{ args | url_encode }}&stdin={{ stdin | url_encode }}&curInstr={{ curInstr }}">
79-
Visualize Code
80-
</a>
81-
</div>
49+
<a class="{{ class }}" target="_blank" href="https://cscircles.cemc.uwaterloo.ca/java_visualize/#code={{ code | url_encode }}&mode=edit&showStringsAsObjects=&disableNesting=&args={{ args | url_encode }}&stdin={{ stdin | url_encode }}&curInstr={{ curInstr }}">
50+
{{ label }}
51+
</a>
8252
</figcaption>
83-
{% endif %}
8453
</figure>
54+
{% else %}
55+
{{ codeBlock }}
56+
{% endif %}

0 commit comments

Comments
 (0)