summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-10-26 21:42:22 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2014-10-26 21:42:22 -0700
commit9d8dba5acd00edec29e385ac859bc28c9991dae9 (patch)
treef82d09e965e142a05b5815f795b8fc866d16de3a
parent695b5f3705fbdb42dd7422e4dc88f25e895d1406 (diff)
Added (interact) links to spec, to open examples in dingus.
-rw-r--r--spec2md.pl2
-rw-r--r--template.html15
2 files changed, 16 insertions, 1 deletions
diff --git a/spec2md.pl b/spec2md.pl
index 1426095..f93aad8 100644
--- a/spec2md.pl
+++ b/spec2md.pl
@@ -12,7 +12,7 @@ while (<STDIN>) {
if ($stage == 0) {
$example++;
print "\n<div class=\"example\" id=\"example-$example\" data-section=\"$section\">\n";
- print "<div class=\"examplenum\"><a href=\"#example-$example\">Example $example</a></div>\n\n";
+ print "<div class=\"examplenum\"><a href=\"#example-$example\">Example $example</a>&nbsp;&nbsp;<a class=\"dingus\" title=\"open in interactive dingus\">(interact)</a></div>\n\n";
print "````````````````````````````````````````````````````````` markdown\n";
} elsif ($stage == 1) {
print "`````````````````````````````````````````````````````````\n\n";
diff --git a/template.html b/template.html
index 0eaf299..b17d285 100644
--- a/template.html
+++ b/template.html
@@ -47,6 +47,7 @@ pre.html span.space:after {
border: 1px solid #666;
}
div.examplenum { font-size: 82%; text-align: left; }
+a.dingus { color: red; }
a.footnoteRef > sup:before {
content: "[";
}
@@ -58,6 +59,20 @@ a.footnoteRef > sup {
font-size: 100%;
}
</style>
+<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
+<script type="text/javascript">
+$$(document).ready(function() {
+ $$("div.example").each(function(e) {
+ var t = $$(this).find('pre.markdown > code').text();
+ $$(this).find('a.dingus').click(function(f) {
+ window.open('/dingus.html?text=' + encodeURIComponent(t));
+ });
+ });
+ $$("pre.markdown").dblclick(function(e) { window.open('/dingus.html?text=' +
+ encodeURIComponent($$(this).find('code').text()));
+ });
+});
+</script>
</head>
<body>
$if(title)$