Permalink
Browse files

Merge pull request #136 from nazriel/runnable-work

Couple improvments to runnable examples
  • Loading branch information...
2 parents 12c4c00 + d556e95 commit a8deacedfc71ab4de137e8817158b61b265fe63f @andralex andralex committed Jul 9, 2012
Showing with 130 additions and 161 deletions.
  1. +9 −8 css/style.css
  2. +3 −2 doc.ddoc
  3. +1 −18 index.dd
  4. +1 −63 js/d.js
  5. +84 −67 js/run.js
  6. +32 −3 process.php
View
@@ -718,32 +718,33 @@ div.runCode {
margin: 1em 0 1em 3em;
}
-div.d_code_output, textarea.d_code_stdin, textarea.d_code_args
+textarea.d_code_output, textarea.d_code_stdin, textarea.d_code_args
{
text-align: left;
border: none;
width: 98%;
- font-size: 12px;
+ font-size: 1.09em;
font-family: monospace;
padding: 5px;
margin: 1px;
- max-height: 150px;
- overflow: auto;
word-wrap: break-word;
- height: 150px;
+ height: auto;
background: white;
+ margin-left: 2px;
+ outline: none;
}
-div.d_code_output_div, div.d_code_stdin, div.d_code_args
+div.d_code_output, div.d_code_stdin, div.d_code_args
{
border: 1px solid #CCC;
background: white;
display: none;
+ height: auto;
+ width: 100%;
}
.CodeMirror-lines {background: white;}
-.CodeMirror {line-height: 1.2em; font-size: 1.2em;
- border: 1px solid #CCC;}
+.CodeMirror {line-height: 1.2em; font-size: 1.2em;border: 1px solid #CCC;}
.cm-s-eclipse span.cm-word {color: #006;}
.cm-s-eclipse span.cm-meta {color: #FF1717;}
.cm-s-eclipse span.cm-keyword { color: blue; }
View
@@ -15,7 +15,7 @@ DDOC=
<title>$(TITLE) - D Programming Language</title>
<link rel="stylesheet" type="text/css" href="css/style.css" />
<link rel="stylesheet" type="text/css" href="css/print.css" media="print" />
-<script src="http://code.jquery.com/jquery.min.js" type="text/javascript"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
<script src="/js/codemirror.js"></script>
<script src="/js/d.js"></script>
<script src="/js/run.js" type="text/javascript"></script>
@@ -386,10 +386,11 @@ D_PSYMBOL = <span class="d_psymbol">$0</span>
D_PARAM = <span class="d_param">$0</span>
D_RUN_CODE = <noscript>$1</noscript>
<div class="runCode">
+<div style="display: none;" class="d_code_src">$2</div>
<textarea class="d_code">$2</textarea>
<div class="d_code_stdin"><span class="d_code_title">Standard input</span><br /><textarea class="d_code_stdin">$3</textarea></div>
<div class="d_code_args"><span class="d_code_title">Command line arguments</span><br /><textarea class="d_code_args">$4</textarea></div>
-<div class="d_code_output_div"><span class="d_code_title">Application output</span><div class="d_code_output">Running...</div></div>
+<div class="d_code_output"><span class="d_code_title">Application output</span><br /><textarea class="d_code_output" readonly>Running...</textarea></div>
<input type="button" class="editButton" value="Edit">
<input type="button" class="argsButton" value="Args">
<input type="button" class="inputButton" value="Input">
View
@@ -5,23 +5,11 @@ $(D_S D Programming Language,
$(SECTION3 The D programming language. Modern
convenience. Modeling power. Native efficiency.,
-<script>
-function showHideYourCodeHere()
-{
- var obj = document.getElementById('your-code-info');
- if(obj.style.display=='block'){
- obj.style.display='none';
- }else{
- obj.style.display = 'block';
- }
-}
-</script>
-
<div style="text-align: right; font-size: 11px; margin-bottom: -35px; margin-right: 5px; position: relative; z-index: 10000">
<a href="http://forum.dlang.org/group/digitalmars.D" target="_blank" class="tip button">
[your code here]
<span>
- Got a brief example illustrating D? Submit your code to the digitalmars.D forum specifying "[your code here]" in the title. Upon approval it will be showcased on a random schedule on D&#145;s homepage.
+ Got a brief example illustrating D? Submit your code to the digitalmars.D forum specifying "[your code here]" in the title. Upon approval it will be showcased on a random schedule on D's homepage.
</span>
</a>
</div>
@@ -62,11 +50,6 @@ void main() {
$(ARGS Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris tristique rutrum sem, nec convallis enim bibendum ut. Donec ac dolor tortor, sit amet consequat turpis. In hac habitasse platea dictumst. Fusce lacus dolor, sodales ac consequat eu, ultricies et leo. In commodo scelerisque urna non posuere. Sed justo ipsum, consectetur nec sodales in, faucibus ut nunc. Phasellus nunc metus, mollis eu malesuada at, scelerisque eget nulla. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus ac velit vel massa faucibus sagittis ut quis lectus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Aliquam convallis dolor quis nunc viverra suscipit. Nam egestas pretium enim, sit amet tincidunt orci condimentum sit amet. Duis accumsan elit vehicula nisl tincidunt hendrerit. Nunc nec augue velit, ac lacinia nunc.),
$(ARGS))
-$(TAG2 div, id="your-code-info" style="display:block; position:relative; width: 50%; margin-left:auto; top:-2.5em; bottom:0em; background:white; border:1px solid #ccc; font-size:80%; padding:0px 5px 0px 5px; line-height:1.4em;",
-
-)
-<script>showHideYourCodeHere();</script>
-
D is a language with C-like syntax and static typing. It pragmatically combines
efficiency, control, and modeling power, with safety and programmer productivity.
View
64 js/d.js
@@ -154,62 +154,8 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
return obj;
}
- var cKeywords = "auto if break int case long char register continue return default short do sizeof " +
- "double static else struct entry switch extern typedef float union for unsigned " +
- "goto while enum void const signed volatile";
- function cppHook(stream, state) {
- if (!state.startOfLine) return false;
- stream.skipToEnd();
- return "meta";
- }
-
- // C#-style strings where "" escapes a quote.
- function tokenAtString(stream, state) {
- var next;
- while ((next = stream.next()) != null) {
- if (next == '"' && !stream.eat('"')) {
- state.tokenize = null;
- break;
- }
- }
- return "string";
- }
-
- CodeMirror.defineMIME("text/x-csrc", {
- name: "clike",
- keywords: words(cKeywords),
- blockKeywords: words("case do else for if switch while struct"),
- atoms: words("null"),
- hooks: {"#": cppHook}
- });
- CodeMirror.defineMIME("text/x-c++src", {
- name: "clike",
- keywords: words(cKeywords + " asm dynamic_cast namespace reinterpret_cast try bool explicit new " +
- "static_cast typeid catch operator template typename class friend private " +
- "this using const_cast inline public throw virtual delete mutable protected " +
- "wchar_t"),
- blockKeywords: words("catch class do else finally for if struct switch try while"),
- atoms: words("true false null"),
- hooks: {"#": cppHook}
- });
- CodeMirror.defineMIME("text/x-java", {
- name: "clike",
- keywords: words("abstract assert boolean break byte case catch char class const continue default " +
- "do double else enum extends final finally float for goto if implements import " +
- "instanceof int interface long native new package private protected public " +
- "return short static strictfp super switch synchronized this throw throws transient " +
- "try void volatile while"),
- blockKeywords: words("catch class do else finally for if switch try while"),
- atoms: words("true false null"),
- hooks: {
- "@": function(stream, state) {
- stream.eatWhile(/[\w\$_]/);
- return "meta";
- }
- }
- });
- CodeMirror.defineMIME("text/x-csharp", {
+ CodeMirror.defineMIME("text/x-d", {
name: "clike",
keywords: words("abstract alias align assert auto body bool break byte case cast catch cdouble cent cfloat" +
" char class const continue creal dchar debug default delegate delete deprecated double dstring" +
@@ -222,14 +168,6 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
atoms: words("asm catch class debug do else exit failure finally for foreach foreach_reverse if struct switch synchronized unittest version try while with "),
hooks: {
- "@": function(stream, state) {
- if (stream.eat('"')) {
- state.tokenize = tokenAtString;
- return tokenAtString(stream, state);
- }
- stream.eatWhile(/[\w\$_]/);
- return "meta";
- }
}
});
}());
Oops, something went wrong.

0 comments on commit a8deace

Please sign in to comment.