diff --git a/Gemfile b/Gemfile index c6489f6..be26c5a 100644 --- a/Gemfile +++ b/Gemfile @@ -11,3 +11,5 @@ gem 'mustache' gem 'markaby' gem 'tenjin' gem 'handlebars' +# gem 'liquor' +# gem 'parkaby', github: 'judofyr/parkaby' diff --git a/benchmark.rb b/benchmark.rb index 70549f6..a994f90 100755 --- a/benchmark.rb +++ b/benchmark.rb @@ -53,6 +53,10 @@ Workbench::Benchmark.describe_engines( class: Workbench::Wrappers::Handlebars, extension: 'handlebars' }, + # parkaby: { + # class: Workbench::Wrappers::Parkaby, + # extension: 'mab' + # }, ) templates = {} diff --git a/lib/workbench.rb b/lib/workbench.rb index 8ae23fc..6fa9099 100644 --- a/lib/workbench.rb +++ b/lib/workbench.rb @@ -13,6 +13,7 @@ require 'liquid' require 'mustache' require 'tenjin' require 'handlebars' +# require 'parkaby' require 'tilt/erb' require 'tilt/erubis' require 'tilt/haml' @@ -24,3 +25,4 @@ require 'workbench/wrappers/mustache' require 'workbench/wrappers/slim' require 'workbench/wrappers/tenjin' require 'workbench/wrappers/handlebars' +require 'workbench/wrappers/parkaby' diff --git a/lib/workbench/wrappers/parkaby.rb b/lib/workbench/wrappers/parkaby.rb new file mode 100644 index 0000000..d3b88e5 --- /dev/null +++ b/lib/workbench/wrappers/parkaby.rb @@ -0,0 +1,14 @@ +module Workbench + module Wrappers + class Parkaby < Base + def initialize path + @engine = ::Parkaby::Template.string(File.read(path)) + end + + def render context, args = {} + @engine.render(OpenStruct.new(args)) + end + end + end +end + diff --git a/templates/markaby/big.mab b/templates/markaby/big.mab index 9b4224e..f1cd297 100644 --- a/templates/markaby/big.mab +++ b/templates/markaby/big.mab @@ -1,26 +1,26 @@ -html do - head do +html { + head { title 'Customers List' - end - body do + } + body { customers.each do |customer| - dl do + dl { dt 'Name:' dd customer['name'] dt 'Age:' dd customer['age'] dt 'Address:' - dd do + dd { [ customer['zip'], customer['country'], customer['city'], customer['address'] ].join("\n") - end + } dt 'Employer:' dd customer['employer'] - end - end - end -end + } + } + } +} diff --git a/templates/markaby/small.mab b/templates/markaby/small.mab index c446d9c..05f4a30 100644 --- a/templates/markaby/small.mab +++ b/templates/markaby/small.mab @@ -1,10 +1,10 @@ -html do - head do +html { + head { title window_title - end - body do + } + body { h1 "Hello, #{username}!" - p do + p { <<-END Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim @@ -14,6 +14,6 @@ html do occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. END - end - end -end + } + } +} diff --git a/templates/parkaby/big.mab b/templates/parkaby/big.mab new file mode 100644 index 0000000..f1cd297 --- /dev/null +++ b/templates/parkaby/big.mab @@ -0,0 +1,26 @@ +html { + head { + title 'Customers List' + } + body { + customers.each do |customer| + dl { + dt 'Name:' + dd customer['name'] + dt 'Age:' + dd customer['age'] + dt 'Address:' + dd { + [ + customer['zip'], + customer['country'], + customer['city'], + customer['address'] + ].join("\n") + } + dt 'Employer:' + dd customer['employer'] + } + } + } +} diff --git a/templates/parkaby/small.mab b/templates/parkaby/small.mab new file mode 100644 index 0000000..05f4a30 --- /dev/null +++ b/templates/parkaby/small.mab @@ -0,0 +1,19 @@ +html { + head { + title window_title + } + body { + h1 "Hello, #{username}!" + p { + <<-END + Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod + tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim + veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea + commodo consequat. Duis aute irure dolor in reprehenderit in voluptate + velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint + occaecat cupidatat non proident, sunt in culpa qui officia deserunt + mollit anim id est laborum. + END + } + } +}