Skip to content

Commit af1b24d

Browse files
authored
Merge pull request #1575 from wilzbach/improve-runnable
Improve runnable: disable assert to writeln transformation + make output a pre element
2 parents 52289a6 + d82ab8b commit af1b24d

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

css/style.css

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1610,7 +1610,7 @@ div.changelog-nav
16101610

16111611
/* Runnable-examples css */
16121612
textarea.d_code {display: none;}
1613-
textarea.d_code_output, textarea.d_code_stdin, textarea.d_code_args
1613+
textarea.d_code_stdin, textarea.d_code_args
16141614
{
16151615
text-align: left;
16161616
border: none;
@@ -1624,6 +1624,11 @@ textarea.d_code_output, textarea.d_code_stdin, textarea.d_code_args
16241624
outline: none;
16251625
}
16261626

1627+
pre.d_code_output {
1628+
border: none;
1629+
max-height: 30em;
1630+
}
1631+
16271632
div.d_code {margin: 0; padding: 0; background: #F5F5F5;}
16281633
div.d_run_code {display: none;}
16291634
div.d_code_output, div.d_code_stdin, div.d_code_args, div.d_code_unittest
@@ -1681,6 +1686,11 @@ input.editButton:active
16811686
position: relative; top: 1px;
16821687
}
16831688
input.resetButton{display: none}
1689+
1690+
/* Style for the example run buttons on the Phobos library documentation */
1691+
.d_example_buttons {
1692+
text-align: left;
1693+
}
16841694
/* Runnable-examples css -end */
16851695

16861696
.page-contents
@@ -2113,8 +2123,3 @@ dt.d_decl:hover .decl_anchor {
21132123
text-decoration: none;
21142124
color: #333;
21152125
}
2116-
2117-
/* Style for the example run buttons on the Phobos library documentation */
2118-
.d_example_buttons {
2119-
text-align: left;
2120-
}

js/run.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ $(document).ready(function()
370370
+ '<textarea class="d_code_stdin">'+stdin+'</textarea></div>'
371371
+ '<div class="d_code_args"><span class="d_code_title">Command line arguments</span><br>'
372372
+ '<textarea class="d_code_args">'+args+'</textarea></div>'
373-
+ '<div class="d_code_output"><span class="d_code_title">Application output</span><br><textarea class="d_code_output" readonly>Running...</textarea></div>'
373+
+ '<div class="d_code_output"><span class="d_code_title">Application output</span><br><pre class="d_code_output" readonly>Running...</pre></div>'
374374
+ '<input type="button" class="editButton" value="Edit">'
375375
+ '<input type="button" class="argsButton" value="Args">'
376376
+ '<input type="button" class="inputButton" value="Input">'
@@ -456,7 +456,7 @@ function setupTextarea(el, opts)
456456

457457
var plainSourceCode = parent.parent().children("div.d_code");
458458

459-
var output = outputDiv.children("textarea.d_code_output");
459+
var output = outputDiv.children("pre.d_code_output");
460460
var outputTitle = outputDiv.children("span.d_code_title");
461461
if (opts.args) {
462462
var argsBtn = parent.children("input.argsButton");

js/run_examples.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ $(document).ready(function()
5959
var currentExample = $(this);
6060
var orig = currentExample.html();
6161

62-
orig = reformatExample(orig);
62+
// disable regex assert -> writeln rewrite logic (for now)
63+
//orig = reformatExample(orig);
6364

6465
// check whether it is from a ddoced unittest
6566
// 1) check is for ddoc, 2) for ddox
@@ -81,7 +82,7 @@ $(document).ready(function()
8182
+ '<div class="d_run_code" style="display: block">'
8283
+ '<textarea class="d_code" style="display: none;"></textarea>'
8384
+ '</div>'
84-
+ '<div class="d_code_output"><span class="d_code_title">Application output</span><br><textarea class="d_code_output" readonly>Running...</textarea>'
85+
+ '<div class="d_code_output"><span class="d_code_title">Application output</span><br><pre class="d_code_output" readonly>Running...</pre>'
8586
+ '</div>'
8687
);
8788
});

0 commit comments

Comments
 (0)