Commit b9e29983 authored by Michael Witrant's avatar Michael Witrant

use template to render amendments

parent 9929d956
......@@ -5,6 +5,8 @@ require 'bundler/setup'
require 'zippy'
require 'clik'
require 'nokogiri'
require 'erb'
require 'ostruct'
xml_dump_path = nil
def debug(values)
......@@ -126,3 +128,12 @@ amend_nodes.each do |nodes|
break if parse_only_one
end
template = ERB.new File.read('template.erb'), nil, '-'
amendments.each do |amendment|
amendment_binding = OpenStruct.new(amendment).instance_eval { binding }
output = template.result(amendment_binding)
puts output
end
=== Amendment <%= am_num %> ===
{| border="1" style="border-spacing:0;" cellpadding="3"
|-
! colspan="2" style="background-color: transparent;" |
Amendement <%= am_num %>
<br/>
<%= article %>
<% changes.each do |original, changed| -%>
|-
|width="50%"|
<%= original %>
|width="50%"|
<%= changed %>
<% end -%>
|-
| colspan="2" |
Comments:
|}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment