-
Notifications
You must be signed in to change notification settings - Fork 1
/
pedantic.html
86 lines (78 loc) · 3.28 KB
/
pedantic.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script src="https://github.com/stan-dev/stanc3/releases/download/nightly/stanc.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<link rel="stylesheet" href="prism/prism.css">
<link rel="stylesheet" href="https://prismjs.com/plugins/line-numbers/prism-line-numbers.css">
<link rel="stylesheet" href="prism/prism-live.css">
<link rel="stylesheet" href="style.css">
<script src="demo.js"></script>
</head>
<body>
<main>
<div class="page-links"><a href="index.html">Print C++</a></div>
<div class="page-links selected-link"><a class="selected" href="pedantic.html">Pedantic check</a></div>
<div class="page-links"><a href="signatures.html">Supported signatures</a></div>
<div class="page-links"><a href="optimization.html">Optimization diff</a></div>
<div class="page-links"><a href="autoformat.html">Auto format</a></div>
<div class="page-links"><a href="canonicalizer.html">Canonicalizer</a></div>
<div style="clear:both;"></div>
<textarea id="model" class="prism-live line-numbers language-stan" spellcheck="false"></textarea>
<div class="buttons">
<div class="action_btn">
<button id="compile" class="action_btn submit">Run pedantic
check</button>
<button id="url" class="action_btn cancel">Generate URL</button>
<p id="saved"></p>
</div>
</div>
<div id="url-box" class="error-box"></div>
<div id="error" class="error-box" style="white-space: pre-line;"></div>
</main>
</body>
<script>
function pedantic_check() {
var model = stanc("test_model",$("#model").val(), ["warn-pedantic", "filename-in-msg=demo-model"]);
if(model.errors) {
$("#error").html(model.errors[1].replace(/\n/g, "<br/>").replace(/\s/g, ' '));
$("#result").html("");
$("#error").show();
} else if (model.warnings) {
var content = ""
for (var i=0; i<model.warnings.length; i++) {
content += model.warnings[i].replace("\n", "")+"<br/><br/>"
}
$("#error").html(content);
$("#error").show();
}
}
$(document).ready(function(){
let model_url = GetURLParameter("model")
let model = "cGFyYW1ldGVycyB7CiAgcmVhbCB5Owp9Cm1vZGVsIHsKICB5IH4gbm9ybWFsKDAsIDEwMDApOwogIHkgfiBub3JtYWwoMCwgMTApOwp9"
if (model_url) {
model = model_url
}
decoded_model = atob(decodeURIComponent(model))
$("#model").val(decoded_model)
$("code", $("#model").prev()).html(decoded_model)
Prism.highlightAll()
$("#model").focus(function () {
$("#url-box").html("");
})
$("#compile").click(function() {
pedantic_check();
});
pedantic_check();
$("#url").click(function () {
let url = window.location.href.split('?')[0] + "?model=" + encodeURIComponent(btoa($("#model").val()))
$("#url-box").html(url);
});
});
</script>
<script src="https://blissfuljs.com/bliss.shy.min.js"></script>
<script src="prism/prism.js"></script>
<script src="https://prismjs.com/plugins/line-numbers/prism-line-numbers.js"></script>
<script src="prism/prism-live.js"></script>
</html>