16956: update our zenweb/liquid package to support liquid 4+
authorWard Vandewege <ward@curii.com>
Tue, 6 Oct 2020 18:02:17 +0000 (14:02 -0400)
committerWard Vandewege <ward@curii.com>
Tue, 6 Oct 2020 18:02:17 +0000 (14:02 -0400)
Arvados-DCO-1.1-Signed-off-by: Ward Vandewege <ward@curii.com>

doc/install/install-compute-ping.html.textile.liquid
doc/sdk/go/example.html.textile.liquid
doc/user/tutorials/git-arvados-guide.html.textile.liquid
doc/zenweb-liquid.rb

index be3f58b61ed3d7ffaffa9f30106f9348b3166d37..37b36f597f2e32a6713939c3fc1983384288bd00 100644 (file)
@@ -11,4 +11,4 @@ SPDX-License-Identifier: CC-BY-SA-3.0
 
 When a new elastic compute node is booted, it needs to contact Arvados to register itself.  Here is an example ping script to run on boot.
 
-<notextile> {% code 'compute_ping_rb' as ruby %} </notextile>
+<notextile> {% code compute_ping_rb as ruby %} </notextile>
index fd62bb67e04c97e49274b927488a8c41f9ab87ca..688c45bf34b2681243dbc2816f60e5a04911203e 100644 (file)
@@ -1,7 +1,7 @@
 ---
 layout: default
 navsection: sdk
-navmenu: Python
+navmenu: Go
 title: Examples
 ...
 {% comment %}
@@ -76,6 +76,6 @@ h2. Example program
 
 You can save this source as a .go file and run it:
 
-<notextile>{% code 'example_sdk_go' as go %}</notextile>
+<notextile>{% code example_sdk_go as go %}</notextile>
 
 A few more usage examples can be found in the "services/keepproxy":https://dev.arvados.org/projects/arvados/repository/revisions/master/show/services/keepproxy and "sdk/go/keepclient":https://dev.arvados.org/projects/arvados/repository/revisions/master/show/sdk/go/keepclient directories in the arvados source tree.
index ad719a66e4e80ceacbbe8bcb8d925971e32ecbb3..a552e4ee000abff673010fdf1c92e0d00fb6099d 100644 (file)
@@ -64,7 +64,7 @@ First, create a simple CWL CommandLineTool:
 
 notextile. <pre>~/tutorials$ <code class="userinput">nano hello.cwl</code></pre>
 
-<notextile> {% code 'tutorial_hello_cwl' as yaml %} </notextile>
+<notextile> {% code tutorial_hello_cwl as yaml %} </notextile>
 
 Next, add the file to the git repository.  This tells @git@ that the file should be included on the next commit.
 
index baa8fe42db39ddbcd320c9b0cae48ac06bb301f3..3e8672e0216e0290982556b82f83eac964a34534 100644 (file)
@@ -50,7 +50,7 @@ module Zenweb
       Liquid::Tag.instance_method(:initialize).bind(self).call(tag_name, markup, tokens)
 
       if markup =~ Syntax
-        @template_name = $1
+        @template_name_expr = $1
         @language = $3
         @attributes    = {}
       else
@@ -61,9 +61,14 @@ module Zenweb
     def render(context)
       require 'coderay'
 
-      partial = load_cached_partial(context)
+      partial = load_cached_partial(@template_name_expr, context)
       html = ''
 
+      # be explicit about errors
+      context.exception_renderer = lambda do |exc|
+        exc.is_a?(Liquid::InternalError) ? "Liquid error: #{exc.cause.message}" : exc
+      end
+
       context.stack do
         html = CodeRay.scan(partial.root.nodelist.join, @language).div
       end
@@ -98,6 +103,11 @@ module Zenweb
         partial = partial[1..-1]
       end
 
+      # be explicit about errors
+      context.exception_renderer = lambda do |exc|
+        exc.is_a?(Liquid::InternalError) ? "Liquid error: #{exc.cause.message}" : exc
+      end
+
       context.stack do
         html = CodeRay.scan(partial, @language).div
       end