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
30650a96
Commit
30650a96
authored
Mar 31, 2013
by
Michael Witrant
Browse files
render all amendments in template
parent
7410766c
Changes
2
Hide whitespace changes
Inline
Side-by-side
extract_amendments.rb
View file @
30650a96
...
...
@@ -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
...
...
template.erb
View file @
30650a96
=== 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
-%>
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