Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
LQDN Adminsys
amendments
Commits
b9e29983
Commit
b9e29983
authored
Mar 31, 2013
by
Michael Witrant
Browse files
use template to render amendments
parent
9929d956
Changes
2
Hide whitespace changes
Inline
Side-by-side
extract_amendments.rb
View file @
b9e29983
...
...
@@ -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
template.erb
0 → 100644
View file @
b9e29983
=== 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:
|}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment