Skip to content
GitLab
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
8e2fbe9d
Commit
8e2fbe9d
authored
Apr 04, 2011
by
Michael Witrant
Browse files
debut wiki
parent
22553978
Changes
1
Hide whitespace changes
Inline
Side-by-side
convert
View file @
8e2fbe9d
...
...
@@ -18,9 +18,10 @@ data = File.read('Amdts_spectre_1.txt')
require
'rubygems'
require
'pp'
require
'nokogiri'
require
'unindent'
sections
=
data
.
scan
(
%r(<Amend>.+?</Amend>)m
)
amendements
=
sections
.
map
do
|
xml
|
sections
.
each
do
|
xml
|
doc
=
Nokogiri
::
XML
(
xml
)
num
,
note
=
doc
.
css
(
'NumAm'
).
text
.
split
(
' '
,
2
)
...
...
@@ -34,7 +35,7 @@ amendements = sections.map do |xml|
when
"++"
"red"
when
"+"
"
lightr
ed"
"
IndianR
ed"
when
""
"lightgrey"
else
...
...
@@ -54,15 +55,36 @@ amendements = sections.map do |xml|
amendement_rows
<<
amendement
end
{
:num
=>
num
,
:note
=>
note
,
:color
=>
color
,
:members
=>
doc
.
css
(
'Members'
).
text
,
:article
=>
doc
.
css
(
'Article'
).
text
,
:commission_rows
=>
commission_rows
,
:amendement_rows
=>
amendement_rows
,
}
commission_rows
,
amendement_rows
=
[
commission_rows
,
amendement_rows
].
map
do
|
rows
|
rows
.
delete_if
{
|
row
|
row
.
nil?
or
row
.
empty?
}
rows
.
join
(
"
\n
"
)
end
members
=
doc
.
css
(
'Members'
).
text
article
=
doc
.
css
(
'Article'
).
text
puts
<<-
TEXT
.
unindent
== Amendement
#{
num
}
==
{| border="1" style="border-spacing:0;" cellpadding="3"
|-
! colspan="2" style="background-color:
#{
color
}
;" |
Amendement
#{
num
}
<br/>
#{
article
}
<br/>
#{
members
}
<br/>
#{
note
}
|-
|
#{
commission_rows
}
||
#{
amendement_rows
}
|-
| colspan="2" |
<!-- Commentaires -->
|}
TEXT
end
puts
amendements
.
to_yaml
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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