Sha256: cff89ee9f653008cf245075518c11fd19ac7c73c9aff0aa53b55acb54a571382
Contents?: true
Size: 835 Bytes
Versions: 30
Compression:
Stored size: 835 Bytes
Contents
require_relative '../models/tutorial' require 'banzai' require 'yaml' module Nexmo module OAS module Renderer module Filters class Tutorials < Banzai::Filter def call(input) input.gsub(/```tutorials(.+?)```/m) do |_s| config = YAML.safe_load($1) @product = config['product'] @tutorials = Models::Tutorial.by_product(@product) # Default to plain layout, but allow people to override it config['layout'] = 'list/plain' unless config['layout'] erb = File.read("#{API.root}/views/tutorials/#{config['layout']}.html.erb") html = ERB.new(erb).result(binding) "FREEZESTART#{Base64.urlsafe_encode64(html)}FREEZEEND" end end end end end end end
Version data entries
30 entries across 30 versions & 1 rubygems