Permalink
Browse files

[feature] doc/book: Added live examples.

  • Loading branch information...
1 parent 1d23948 commit 9ef2110d8e881eb97f172fae957842644263be72 @akoprow akoprow committed Aug 16, 2011
@@ -38,6 +38,9 @@ If you are curious, this is the full source code of the application:
------------------------
include::hello_chat.opa[]
------------------------
+++++
+<span class="run"><A target="_blank" href="http://tutorials.opalang.org/hello_chat">Run</A></span>
+++++
In this listing, we define the communication infrastructure for the chatroom,
the user interface, and finally, the main application. In the rest of the
@@ -592,7 +595,9 @@ As a summary, let us recapitulate the source file:
------------------------
include::hello_chat.opa[]
------------------------
-
+++++
+<span class="run"><A target="_blank" href="http://tutorials.opalang.org/hello_chat">Run</A></span>
+++++
All this in 20 effective lines of code (without the CSS). Note that, in this
final version, we have removed some needless parentheses, which were useful
@@ -34,6 +34,9 @@ If you are curious, this is the full source code of our application:
------------------------
include::hello_recaptcha_app.opa[]
------------------------
+++++
+<span class="run"><A target="_blank" href="http://tutorials.opalang.org/hello_recaptcha">Run</A></span>
+++++
Of course, since the features are provided by Google reCaptcha, the most
interesting aspects of the code are not to be found in the source of the
@@ -775,6 +778,9 @@ To test the API, we may write a simple application:
------------------------
include::hello_recaptcha_app.opa[]
------------------------
+++++
+<span class="run"><A target="_blank" href="http://tutorials.opalang.org/hello_recaptcha">Run</A></span>
+++++
With the exception of directive +@server_private+, this listing should not
surprise you. Here, we placed directive +@server_private+ as a sanity check, to
@@ -42,7 +42,9 @@ If you are curious, this is the full source code of the REST wiki server:
-------------
include::hello_wiki_rest.opa[]
-------------
-
+++++
+<span class="run"><A target="_blank" href="http://tutorials.opalang.org/hello_wiki_rest">Run</A></span>
+++++
We will now walk through the concepts introduced in this listing.
@@ -183,6 +185,9 @@ And with this, we are done! Our wiki can now be scripted by external web applica
----------------
include::hello_wiki_rest.opa[]
----------------
+++++
+<span class="run"><A target="_blank" href="http://tutorials.opalang.org/hello_wiki_rest">Run</A></span>
+++++
All in all, the changes required a dozen lines of code.
@@ -412,6 +417,9 @@ If you are curious, this is the full source code of the REST wiki client (which
-------------
include::hello_wiki_rest_client_customizable.opa[]
-------------
+++++
+<span class="run"><A target="_blank" href="http://tutorials.opalang.org/hello_wiki_rest_client">Run</A></span>
+++++
The web client
~~~~~~~~~~~~~~
@@ -664,6 +672,9 @@ With this, your client wiki is complete:
----------------
include::hello_wiki_rest.opa[]
----------------
+++++
+<span class="run"><A target="_blank" href="http://tutorials.opalang.org/hello_wiki_rest">Run</A></span>
+++++
Launch the server wiki, launch the client wiki on a different port (use option
+--server-port+ to select a port) and behold, you can edit your wiki from two
@@ -896,6 +907,9 @@ The full source code follows:
--------------
include::hello_wiki_rest_client_customizable.opa[]
--------------
+++++
+<span class="run"><A target="_blank" href="http://tutorials.opalang.org/hello_wiki_rest_client">Run</A></span>
+++++
Exercises
~~~~~~~~~
@@ -35,6 +35,9 @@ If you are curious, this is the full source code of the application.
------------------------
include::hello_wiki.opa[]
------------------------
+++++
+<span class="run"><A target="_blank" href="http://tutorials.opalang.org/hello_wiki">Run</A></span>
+++++
In this listing, we define a database for storing the content of the pages in a
safe format, we define the user interface and finally, the main application. In
@@ -400,6 +403,9 @@ As a summary, let us recapitulate the source file:
------------------------
include::hello_wiki_simple.opa[]
------------------------
+++++
+<span class="run"><A target="_blank" href="http://tutorials.opalang.org/hello_wiki">Run</A></span>
+++++
This is a total of 30 effective lines of code + CSS.
View
@@ -15,6 +15,12 @@
margin: 0;
padding: 0;
}
+ div.admonitionblock {
+ margin-top: 15px;
+ }
+ .imageblock img {
+ border: 1px dotted black;
+ }
div.listingblock div.title {
font-weight:bold
}
@@ -50,7 +56,7 @@ table td.icon:after {border:none;}
table td.content {padding-left:10px;}
table td.content .title {font-variant:small-caps;font-size:1.2em;color:#B30A0A;}
table td:after {border-bottom: 1px solid #FFF;content:"";position:relative;top:5px;display:block;}
-p {margin: 0 0 1.5em 0;}
+p {margin: 1em 0;}
li p, td p {display:inline;}
h1 {color:#000; font-size: 3em; line-height:1.5em; margin: 0.7em 0; }
h2 {color:#B30A0A; font-size: 2.5em; line-height:1.4em; margin: 1em 0 0.5em 0;}
@@ -91,7 +97,7 @@ img {
margin: 0 auto;
}
#toc {
- width:40%;
+ width: 80%;
margin: 0 10%;
}
.left {
@@ -104,6 +110,7 @@ img {
#footer {background: #B6B6B2; color:#eee; border-top:1px solid #999; text-shadow: 0 -1px 0 #999;}
+/*
pre {
background:#FFF;
margin:5px 0;
@@ -116,6 +123,27 @@ pre {
overflow:auto;
font-size:0.9em;
}
+*/
+ pre {
+ font-size: 90%;
+ font-weight: bold;
+ line-height: 120%;
+ padding-top: 0.5em;
+ padding-bottom: 0.5em;
+ padding-left: 1em;
+ padding-right: 1em;
+ border-style: solid;
+ border-left-width: 1em;
+ border-top-width: thin;
+ border-right-width: thin;
+ border-bottom-width: thin;
+ border-color: #95ABD0;
+ color: #00428C;
+ background-color: #FFF;
+ margin: 0px;
+ max-height: 500px;
+ overflow: auto;
+ }
/* #preamble {position: absolute;right: 0;top: -370px;} */
.toctitle {color:#969692;}
.toclevel1 {font-size:1.2em; margin-top:10px;}
@@ -369,3 +397,14 @@ pre {
}
+span.run, span.see {
+ border: 1px solid black;
+ padding: 8px;
+ font-size: 1.2em;
+ border-radius: 8px;
+ background: #DFD;
+ display: inline;
+ position: relative;
+ top: -45px;
+ float: right;
+}

0 comments on commit 9ef2110

Please sign in to comment.