Commit 30650a96 authored by Michael Witrant's avatar Michael Witrant

render all amendments in template

parent 7410766c
......@@ -97,11 +97,10 @@ class AmendmentExtractor
doc_amend = amend_doc.xpath("//DocAmend").first.text
article = amend_doc.xpath("//Article").first.text
amendment = {
num: num_am,
doc: doc_amend,
article: article,
}
amendment = OpenStruct.new
amendment.num = num_am
amendment.doc = doc_amend
amendment.article = article
debug amendment
......@@ -145,7 +144,7 @@ class AmendmentExtractor
raise "amendment changes not found" if changes.size == 0
debug changes: changes
amendment[:changes] = changes
amendment.changes = changes
amendments << amendment
......@@ -155,13 +154,8 @@ class AmendmentExtractor
debug "rendering amendments"
template = ERB.new File.read('template.erb'), nil, '-'
result = []
amendments.each do |amendment|
amendment_binding = OpenStruct.new(amendment).instance_eval { binding }
output = template.result(amendment_binding)
result << output
end
result.join("\n")
erb_binding = OpenStruct.new(amendments: amendments).instance_eval { binding }
output = template.result(erb_binding)
end
end
......
=== Amendment <%= num %> ===
<% amendments.each do |amendment| -%>
=== Amendment <%= amendment.num %> ===
{| border="1" style="border-spacing:0;" cellpadding="3" width="100%"
|-
! colspan="2" style="background-color: lightgrey;" |
Amendement <%= num %>
Amendement <%= amendment.num %>
<br/>
<%= article %>
<% changes.each do |original, changed| -%>
<%= amendment.article %>
<% amendment.changes.each do |original, changed| -%>
|-
|width="50%"|
<%= original %>
......@@ -17,3 +18,4 @@ Amendement <%= num %>
Comments:
|}
<% end -%>
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