* Added README with information about building/viewing the docs.
authorPeter Amstutz <peter.amstutz@curoverse.com>
Mon, 10 Mar 2014 17:40:29 +0000 (13:40 -0400)
committerPeter Amstutz <peter.amstutz@curoverse.com>
Mon, 10 Mar 2014 17:40:29 +0000 (13:40 -0400)
* Added arvados_workbench_host
* Can now specify baseurl, arvados_workbench_host, and arvados_api_host on the command line to override _config.yml
* Added liquid tag {% code 'file' as language %} for syntax highlighting via coderay

12 files changed:
doc/README [new file with mode: 0644]
doc/Rakefile
doc/_config.yml
doc/_layouts/default.html.liquid
doc/css/code.css [new file with mode: 0644]
doc/index.html.liquid
doc/user/index.html.textile.liquid
doc/user/tutorials/running-external-program.html.textile.liquid
doc/user/tutorials/tutorial-firstscript.html.textile.liquid
doc/user/tutorials/tutorial-new-pipeline.html.textile.liquid
doc/user/tutorials/tutorial-parallel.html.textile.liquid
doc/zenweb-liquid.rb

diff --git a/doc/README b/doc/README
new file mode 100644 (file)
index 0000000..e7bd431
--- /dev/null
@@ -0,0 +1,28 @@
+Arvados Documentation
+
+0. Install dependencies
+
+  $ bundle install
+
+
+1. To build or update documentation:
+  $ rake generate
+
+
+2. To view documentation:
+  $ rake run
+[2014-03-10 09:03:41] INFO  WEBrick 1.3.1
+[2014-03-10 09:03:41] INFO  ruby 2.1.1 (2014-02-24) [x86_64-linux]
+[2014-03-10 09:03:41] INFO  WEBrick::HTTPServer#start: pid=8926 port=8000
+
+  Then go to http://localhost:8000
+
+
+2. You can set 'baseurl' (the URL prefix for all internal links),
+'arvados_api_host' and 'arvados_workbench_host' without changing _config.yml:
+
+ $ rake generate baseurl=/example arvados_api_host=example.com
+
+
+4. To delete generated files:
+  $ rake realclean
index a10d54cdee319411f83419fac5e731cb3eb26aec..d8af62f5e33b0bbae7a619044c3ce08739e01b0c 100644 (file)
@@ -3,6 +3,15 @@
 require "rubygems"
 require "colorize"
 
+task :generate do
+  vars = ['baseurl', 'arvados_api_host', 'arvados_workbench_host']
+  vars.each do |v|
+    if ENV[v]
+      website.config.h[v] = ENV[v]
+    end
+  end
+end
+
 require "zenweb/tasks"
 load "zenweb-textile.rb"
 load "zenweb-liquid.rb"
index dbf638979ebdc2a0e785f1527c4e36fd0e699e51..784ac61b9c42acc9b47dedd39c0ddd292dacd828 100644 (file)
@@ -3,11 +3,14 @@
 # file:///tmp/arvados/doc/.site). To make docs show up inside
 # workbench, use /doc here and add a symlink at
 # apps/workbench/public/doc pointing to ../../../doc/.site
+# You can also set these on the command line:
+# $ rake generate baseurl=/example arvados_api_host=example.comA
 
-baseurl: /doc
+baseurl: 
+arvados_api_host: localhost
+arvados_workbench_host: localhost
 
 exclude: ["Rakefile", "tmp", "vendor"]
-arvados_api_host: qr1hi.arvadosapi.com
 
 navbar:
   userguide:
index 732b2addda86672ca8f5a35daaeebc1949212261..1f42d80a6b9d2572572403b88eb9a0fdf4780c09 100644 (file)
@@ -11,6 +11,7 @@
     <link href="{{ site.baseurl }}/css/bootstrap.css" rel="stylesheet">
     <link href="{{ site.baseurl }}/css/nav-list.css" rel="stylesheet">
     <link href="{{ site.baseurl }}/css/badges.css" rel="stylesheet">
+    <link href="{{ site.baseurl }}/css/code.css" rel="stylesheet">
     <style>
       html {
       height:100%;
@@ -52,9 +53,6 @@
       text-align: center;
       margin-bottom: 1em;
       }
-      .userinput {
-      color: #d14;
-      }
       :target {
       padding-top: 61px;
       margin-top: -61px;
diff --git a/doc/css/code.css b/doc/css/code.css
new file mode 100644 (file)
index 0000000..59dc1be
--- /dev/null
@@ -0,0 +1,27 @@
+table.code {
+    font-family: Menlo,Monaco,Consolas,"Courier New",monospace;
+    display: block;
+    padding: 9.5px;
+    margin: 0px 0px 10px;
+    font-size: 13px;
+    line-height: 1.42857;
+    color: rgb(51, 51, 51);
+    word-break: break-all;
+    word-wrap: break-word;
+    background-color: rgb(245, 245, 245);
+    border: 1px solid rgb(204, 204, 204);
+    border-radius: 4px 4px 4px 4px;
+}
+
+table.code tr td {
+    white-space: pre;
+}
+
+table.code tr td:nth-child(2) {
+    color: #d14;
+    padding-left: .5em;
+}
+
+.userinput {
+    color: #d14;
+}
index 58fd03eb1acbdc08d1c907df6244aba75b546165..f9f51d67608a9d5687f6102daed8acb201460179 100644 (file)
@@ -26,19 +26,19 @@ title: Arvados | Documentation
     </div>
     <div class="col-sm-7" style="border-left: solid; border-width: 1px">
       <p>
-        <a href="{{ site.baseurl }}/user/">User Guide</a> &mdash; How to manage data and do analysis with Arvados.
+        <a href="{{ site.baseurl }}/user/index.html">User Guide</a> &mdash; How to manage data and do analysis with Arvados.
       </p>
       <p>
-        <a href="{{ site.baseurl }}/sdk/">SDK Reference</a> &mdash; Details about the accessing Arvados from various programming languages.
+        <a href="{{ site.baseurl }}/sdk/index.html">SDK Reference</a> &mdash; Details about the accessing Arvados from various programming languages.
       </p>
       <p>
-        <a href="{{ site.baseurl }}/api/">API Reference</a> &mdash; Details about the the Arvados REST API.
+        <a href="{{ site.baseurl }}/api/index.html">API Reference</a> &mdash; Details about the the Arvados REST API.
       </p>
       <p>
-        <a href="{{ site.baseurl }}/admin/">Admin Guide</a> &mdash; How to administer an Arvados system.
+        <a href="{{ site.baseurl }}/admin/index.html">Admin Guide</a> &mdash; How to administer an Arvados system.
       </p>
       <p>
-        <a href="{{ site.baseurl }}/install/">Install Guide</a> &mdash; How to install Arvados on a cloud platform.
+        <a href="{{ site.baseurl }}/install/index.html">Install Guide</a> &mdash; How to install Arvados on a cloud platform.
       </p>      
     </div>
   </div>
index 982b1c3fc3378dc741ecb3045036740d927b082c..48d3f86ebb17e4f573a1179279eea7cf33914201 100644 (file)
@@ -26,9 +26,9 @@ To get the most value out of this guide, you should be comfortable with the foll
 # Programming in @python@
 # Revision control using @git@
 
-The examples in this guide uses the public Arvados instance located at "https://workbench.{{ site.arvados_api_host }}/":https://workbench.{{ site.arvados_api_host }}/ .  You must have an account in order to use this service.  If you would like to request an account, please send an email to "arvados@curoverse.com":mailto:arvados@curoverse.com .
+The examples in this guide uses the Arvados instance located at "https://{{ site.arvados_workbench_host }}/":https://{{ site.arvados_workbench_host }}/ .  If you are using a different Arvados instance replace @{{ site.arvados_workbench_host }}@ with your private instance in all of the examples in this guide.
 
-If you are using a different Arvados instance replace @{{ site.arvados_api_host }}@ with your private instance in all of the examples in this guide.
+The Arvados public beta instance is located at "https://workbench.qr1hi.arvadosapi.com/":https://workbench.qr1hi.arvadosapi.com/ .  You must have an account in order to use this service.  If you would like to request an account, please send an email to "arvados@curoverse.com":mailto:arvados@curoverse.com .
 
 h2. Typographic conventions
 
@@ -36,11 +36,11 @@ This manual uses the following typographic conventions:
 
 <notextile>
 <ul>
-<li>Code blocks which are set aside from the text indicate user input to the system.  Commands that should be entered into a Unix shell are indicated by the directory where you should  enter the command ('~' indicates your home directory) followed by '$', followed by the highlighted <span class="userinput">command to enter</span> (do not enter the '$'), and possibly followed by example command output in black.  For example, the following block indicates that you should type "ls foo" while in your home directory and the expected output will be "foo".
-
+<li>Code blocks which are set aside from the text indicate user input to the system.  Commands that should be entered into a Unix shell are indicated by the directory where you should  enter the command ('~' indicates your home directory) followed by '$', followed by the highlighted <span class="userinput">command to enter</span> (do not enter the '$'), and possibly followed by example command output in black.  For example, the following block indicates that you should type "ls foo.*" while in your home directory and the expected output will be "foo.input" and "foo.output".
 <pre><code>~$ <span class="userinput">ls foo</span>
 foo
-</code></pre></li>
+</code></pre>
+</li>
 
 <li>Code blocks inline with text emphasize specific <code>programs</code>, <code>files</code>, or <code>options</code> that are being discussed.</li>
 <li>Bold text emphasizes <b>specific items</b> to look when discussing Arvados Workbench pages.</li>
index 7b31e17818318f178da36b46562f65fc6ff89bd0..be8496272ed842a2bddde2c1ba450b28c3fb66db 100644 (file)
@@ -27,7 +27,7 @@ notextile. <pre>~/<b>you</b>/crunch_scripts$ <code class="userinput">nano run-md
 
 Add the following code to use the @md5sum@ program to compute the hash of each file in a collection:
 
-<pre><code class="userinput">{% include 'run_md5sum_py' %}</code></pre>
+<notextile> {% code 'run_md5sum_py' as python %} </notextile>
 
 Make the file executable:
 
index 130f59117653fd321eafae41d1b572695246cc06..254d9db5c56fb519e3cf64c61f93a421bc02f312 100644 (file)
@@ -60,7 +60,7 @@ notextile. <pre>~/<b>you</b>/crunch_scripts$ <code class="userinput">nano hash.p
 
 Add the following code to compute the md5 hash of each file in a collection:
 
-<pre><code class="userinput">{% include 'tutorial_hash_script_py' %}</code></pre>
+<notextile> {% code 'tutorial_hash_script_py' as python %} </notextile>
 
 Make the file executable:
 
index d128b4b1951e04c887c4a8f57015237f0df65336..ed319b415eb8b15f6cb794811e547258cde429fe 100644 (file)
@@ -16,7 +16,7 @@ h2. Create a new script
 
 Our second script will filter the output of @parallel_hash.py@ and only include hashes that start with 0.  Create a new script in @crunch_scripts/@ called @0-filter.py@:
 
-<pre><code class="userinput">{% include '0_filter_py' %}</code></pre>
+<notextile> {% code '0_filter_py' as python %} </notextile>
 
 Now add it to git:
 
index be78506f5db5cad5aa4459af88426fcaff56e039..23b7cfbecdc3d782e71c3e6e108e583c0482f3e1 100644 (file)
@@ -23,7 +23,7 @@ notextile. <pre>~/<b>you</b>/crunch_scripts$ <code class="userinput">nano parall
 
 Add the following code to compute the md5 hash of each file in a 
 
-<pre><code class="userinput">{% include 'parallel_hash_script_py' %}</code></pre>
+<notextile> {% code 'parallel_hash_script_py' as python %} </notextile>
 
 Make the file executable:
 
index 545a0d8f5a31f58421e263288540c8eff9f4ecc7..0be882a48b45e15b5b7ec9bc8e0b2743390e60c0 100644 (file)
@@ -1,4 +1,5 @@
 require 'zenweb'
+require 'liquid'
 
 module ZenwebLiquid
   VERSION = '0.0.1'
@@ -15,7 +16,6 @@ module Zenweb
     ##
     # Render a page's liquid and return the intermediate result
     def liquid template, content, page, binding = TOPLEVEL_BINDING
-      require 'liquid'
       Liquid::Template.file_system = Liquid::LocalFileSystem.new(File.join(File.dirname(Rake.application().rakefile), "_includes"))
       unless defined? @liquid_template
         @liquid_template = Liquid::Template.parse(template)
@@ -38,4 +38,35 @@ module Zenweb
       @liquid_template.render(vars)
     end
   end
+
+  class LiquidCode < Liquid::Include
+    Syntax = /(#{Liquid::QuotedFragment}+)(\s+(?:as)\s+(#{Liquid::QuotedFragment}+))?/o
+
+    def initialize(tag_name, markup, tokens)
+      Liquid::Tag.instance_method(:initialize).bind(self).call(tag_name, markup, tokens)
+
+      if markup =~ Syntax
+        @template_name = $1
+        @language = $3
+        @attributes    = {}
+      else
+        raise SyntaxError.new("Error in tag 'code' - Valid syntax: include '[code_file]' as '[language]'")
+      end
+    end
+    
+    def render(context)
+      require 'coderay'
+
+      partial = load_cached_partial(context)
+      html = ''
+
+      context.stack do
+        html = CodeRay.scan(partial.root.nodelist.join, @language).div
+      end
+
+      html
+    end
+
+    Liquid::Template.register_tag('code', LiquidCode)    
+  end
 end