This repository has been archived by the owner on Sep 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjava_visualizer.html
63 lines (57 loc) · 2.25 KB
/
java_visualizer.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
{% comment %}
Version 2019-08-06
https://github.com/kevinlin1/jekyll-python-tutor
Liquid template for generating Java Visualizer embeds.
Usage:
{%- capture HelloWorld -%}
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, world!");
}
}
{%- endcapture -%}
{% include java_visualizer.html code=HelloWorld caption="Hello, world!" %}
Advanced usage:
{%- capture HelloWorld -%}
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, world!");
}
}
{%- endcapture -%}
{% include java_visualizer.html mode="display" code=HelloWorld
caption="Hello, world!" label="Visualize Code" class="btn" curInstr="0"
args='["arg1", ...]' stdin="stdin" showStringsAsObjects=""
showAllFields="" disableNesting="" verticalLists="" %}
{% endcomment %}
{% assign mode = include.mode | default: 'display' %}
{% assign code = include.code | default: '' %}
{% assign caption = include.caption | default: '' %}
{% assign label = include.label | default: 'Visualize Code' %}
{% assign class = include.class | default: 'btn' %}
{% assign curInstr = include.curInstr | default: 0 %}
{% assign args = include.args | default: '[]' %}
{% assign stdin = include.stdin | default: '' %}
{% assign showStringsAsObjects = include.showStringsAsObjects | default: '' %}
{% assign showAllFields = include.showAllFields | default: '' %}
{% assign disableNesting = include.disableNesting | default: '' %}
{% assign verticalLists = include.verticalLists | default: '' %}
{% capture codeBlock %}
```java
{{ code }}
```
{% endcapture %}
{% assign codeBlock = codeBlock | markdownify %}
{% if label %}
<figure>
{{ codeBlock }}
<figcaption>
{{ caption }}
<a class="{{ class }}" target="_blank" href="https://cscircles.cemc.uwaterloo.ca/java_visualize/#code={{ code | url_encode }}&mode={{ mode }}&showStringsAsObjects={{ showSringsAsObjects }}&showAllFields={{ showAllFields }}&disableNesting={{ disableNesting }}&verticalLists={{ verticalLists }}&args={{ args | url_encode }}&stdin={{ stdin | url_encode }}&curInstr={{ curInstr }}">
{{ label }}
</a>
</figcaption>
</figure>
{% else %}
{{ codeBlock }}
{% endif %}