Skip to content

Commit 8bed428

Browse files
committed
Merge remote-tracking branch 'upstream/master' into stable
2 parents 7adc440 + b040b97 commit 8bed428

34 files changed

+1438
-735
lines changed

css/style.css

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1622,7 +1622,7 @@ input.runButton, input.resetButton, input.argsButton, input.inputButton, input.e
16221622
padding:3px 6px;
16231623
text-decoration:none;
16241624
text-shadow:1px 1px 0px #ffffff;
1625-
width: 50px;
1625+
width: 10en;
16261626
margin: 2px;
16271627
position: relative;
16281628
z-index: 2;
@@ -1700,12 +1700,13 @@ div.openInEditorButton i{
17001700
-webkit-appearance: none;
17011701
-moz-appearance: none;
17021702
appearance: none;
1703-
max-width: 100%;
1703+
max-width: 120%;
17041704
}
17051705
.fa-select::after {
17061706
font-family: FontAwesome;
17071707
content: "\f0d7";
17081708
margin-left: -15px;
1709+
pointer-events: none; /* propagate click */
17091710
}
17101711
/* Runnable-examples css -end */
17111712

dlang.org.ddoc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,12 +398,16 @@ _=
398398
RELATIVE_LINK2=$(ALOCAL $1, $+)
399399
_=
400400

401+
_=These take a ddoc example enclosed in `---`
401402
RUNNABLE_EXAMPLE=<div class="runnable-examples">
402403
$1
403404
</div>
405+
RUNNABLE_EXAMPLE_COMPILE=<div class="runnable-examples" data-compile=''>
406+
$1
407+
</div>
408+
_=These go inside a RUNNABLE_EXAMPLE macro invocation before the first `---`
404409
RUNNABLE_EXAMPLE_STDIN=<code class="runnable-examples-stdin">$0</code>
405410
RUNNABLE_EXAMPLE_ARGS=<code class="runnable-examples-args">$0</code>
406-
RUNNABLE_EXAMPLE_COMPILE=$(RUNNABLE_EXAMPLE $0)
407411

408412
SAMPLESRC=$(SPANC sample_src, $(AHTTPS github.com/dlang/dmd/blob/master/samples/$0, /dmd/samples/d/$0))
409413
SCINI=$(TC pre, scini notranslate, $0)

dpl-docs/views/layout.dt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,9 @@ html(lang='en-US')
173173
- string path_prefix, line_suffix, filename;
174174
- if( modname )
175175
- if( modname.startsWith("core.") || modname.startsWith("object"))
176-
- project = "druntime", path_prefix = "src/";
176+
- project = "dmd", path_prefix = "druntime/src/";
177177
- else if( modname.startsWith("dmd.") )
178-
- project = "dmd", path_prefix = "src/";
178+
- project = "dmd", path_prefix = "compiler/src/";
179179
- else
180180
- project = "phobos", path_prefix = "";
181181
- if (info.docGroups.length >= 1 && !noExactSourceCodeLinks)

foundation/donate.dd

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ the art in the D programming language.)
4747

4848
$(H3 How can I donate?)
4949

50+
$(DONATE_ITEM Donate through GitHub Sponsors, github,
51+
52+
The D Language Foundation is enrolled in the GitHub Sponsors program. One-time donations here will go toward our general expense fund. We aim to use
53+
monthly donations to hire part-time workers who can help us achieve our vision for the D programming language. You can see our current monthly donation target
54+
along with multiple one-time and monthly donation tiers $(LINK2 https://github.com/sponsors/dlang, on our GitHub Sponsors page).
55+
)
56+
5057
$(DONATE_ITEM Donate through PayPal, paypal,
5158

5259
Click the yellow Donate button to make a donation to the D Language Foundation via PayPal. If

images/campaign-bounties.png

-106 KB
Binary file not shown.

images/campaign-forums.png

-37.3 KB
Binary file not shown.

images/campaign-general.png

-37.4 KB
Binary file not shown.

images/campaign-hr.png

-36.7 KB
Binary file not shown.

images/dconf22-logo.png

-7.52 KB
Binary file not shown.

js/run.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ void main(string[] args) {
3838
------
3939
4040
TL;DR
41-
All examples are replaced with custom form by default. You need to do additional work only if you wan't
42-
your example to have deafault standard input or default standard arguments.
41+
All examples are replaced with custom form by default. You need to do additional work only if you want
42+
your example to have default standard input or default standard arguments.
4343
*/
4444

4545
var nl2br = function()
@@ -102,7 +102,7 @@ var backends = {
102102
var req = {
103103
source: data.code,
104104
// always execute unittests and main for backwards compatibility with examples
105-
args: "-unittest",
105+
args: "-unittest -main",
106106
runtimeArgs: "--DRT-testmode=run-main",
107107
compiler: dmdCompilerBranch
108108
}
@@ -179,11 +179,11 @@ function parseOutput(res, o, oTitle)
179179
}
180180

181181
// wraps a unittest into a runnable script
182-
function wrapIntoMain(code) {
182+
function wrapIntoMain(code, compile) {
183183
var currentPackage = $('body')[0].id;
184184

185185
// dynamically wrap into main if needed
186-
if (code.indexOf("void main") >= 0 || code.indexOf("int main") >= 0) {
186+
if (compile || code.indexOf("void main") >= 0 || code.indexOf("int main") >= 0) {
187187
return code;
188188
}
189189
else {
@@ -207,7 +207,6 @@ $(document).ready(function()
207207
{
208208
var root = $(this);
209209
var el = root.children("pre");
210-
var stripedText = el.text().replace(/\s/gm,'');
211210

212211
var stdin = root.children(".runnable-examples-stdin").text();
213212
var args = root.children(".runnable-examples-args").text();
@@ -224,6 +223,11 @@ $(document).ready(function()
224223
+ '<textarea class="d_code_args">'+args+'</textarea></div>';
225224
}
226225

226+
var compile = el.parent()[0].hasAttribute('data-compile');
227+
var runAttrs = `value="${compile ? 'Compile' : 'Run'}"`;
228+
if (!compile)
229+
runAttrs += ' title="Note: Wraps code in `main` automatically if `main` is missing'
230+
+ ' & imports std.stdio.write[f][ln]"';
227231
var currentExample = el;
228232
var orig = currentExample.html();
229233

@@ -236,7 +240,7 @@ $(document).ready(function()
236240
+ '<input type="button" class="editButton" value="Edit">'
237241
+ (args.length > 0 ? '<input type="button" class="argsButton" value="Args">' : '')
238242
+ (stdin.length > 0 ? '<input type="button" class="inputButton" value="Input">' : '')
239-
+ '<input type="button" class="runButton" value="Run">'
243+
+ `<input type="button" class="runButton" ${runAttrs}>`
240244
+ '<input type="button" class="resetButton" value="Reset">'
241245
+ '<input type="button" class="openInEditorButton" value="Open in IDE"></div>'
242246
);
@@ -247,11 +251,13 @@ $(document).ready(function()
247251
var outputDiv = parent.children("div.d_code_output");
248252
var hasStdin = parent.children(".inputButton").length > 0;
249253
var hasArgs = parent.children(".argsButton").length > 0;
254+
var compile = parent.parent()[0].hasAttribute('data-compile');
250255
setupTextarea(this, {
251256
parent: parent,
252257
outputDiv: outputDiv,
253258
stdin: hasStdin,
254259
args: hasArgs,
260+
compile: compile,
255261
defaultOutput: "Succeed without output.",
256262
transformOutput: wrapIntoMain,
257263
});
@@ -421,7 +427,7 @@ function setupTextarea(el, opts)
421427
output.focus();
422428

423429
var data = {
424-
code: opts.transformOutput(editor.getValue())
430+
code: opts.transformOutput(editor.getValue(), opts.compile)
425431
};
426432
if (opts.stdin) {
427433
data.stdin = stdin.val();

0 commit comments

Comments
 (0)