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
5cddf657
Commit
5cddf657
authored
Sep 26, 2011
by
Ollivier Robert
Browse files
Implement changes for Net Neutrality doc.
parent
71ba5f41
Changes
1
Hide whitespace changes
Inline
Side-by-side
Réso/convert
View file @
5cddf657
#!/usr/bin/env ruby
#!/usr/bin/env ruby
# Encoding: utf-8
# Pour lancer le script il faut ruby, rubygems et les gems nokogiri et htmldiff
# Pour lancer le script il faut ruby, rubygems et les gems nokogiri et htmldiff
require
'rubygems'
require
'rubygems'
...
@@ -7,9 +7,9 @@ require 'nokogiri'
...
@@ -7,9 +7,9 @@ require 'nokogiri'
require
'htmldiff'
require
'htmldiff'
require
'erb'
require
'erb'
IN
=
ARG
F
.
shift
IN
=
ARG
V
.
shift
data
=
File
.
read
(
"Amdts_spectre_
#{
i
}
.txt"
)
data
=
File
.
read
(
IN
)
sections
=
data
.
scan
(
%r(<Amend>.+?</Amend>)m
)
sections
=
data
.
scan
(
%r(<Amend>.+?</Amend>)m
)
Amendment
=
Struct
.
new
:num
,
:note
,
:color
,
:commission_rows
,
:amendement_rows
,
:members
,
:article
Amendment
=
Struct
.
new
:num
,
:note
,
:color
,
:commission_rows
,
:amendement_rows
,
:members
,
:article
...
@@ -50,8 +50,8 @@ amendments = sections.map do |xml|
...
@@ -50,8 +50,8 @@ amendments = sections.map do |xml|
raise
"Invalid note:
#{
note
.
inspect
}
"
raise
"Invalid note:
#{
note
.
inspect
}
"
end
end
infos
=
xml
.
scan
(
%r(
Text proposed by the Commiss
ion
\n
Amendment
\n
(.+)
\n
Or.)m
).
first
infos
=
xml
.
scan
(
%r(
Draft motion for a resolut
ion
\n
Amendment
\n
(.+)
\n
^(
Or.
<Original|C|T|)
)m
).
first
raise
"No info found"
unless
infos
raise
"No info found
#{
xml
}
"
unless
infos
infos
=
infos
.
first
.
split
(
/\n/
)
infos
=
infos
.
first
.
split
(
/\n/
)
...
@@ -65,7 +65,9 @@ amendments = sections.map do |xml|
...
@@ -65,7 +65,9 @@ amendments = sections.map do |xml|
amendement_rows
<<
diff
(
commission
,
amendment
).
to_s
.
gsub
(
%r(<del class=".+?">.+?</del>)
,
""
).
gsub
(
%r(<ins class=".+?">(.+?)</ins>)
,
"'''
\\
1'''"
)
amendement_rows
<<
diff
(
commission
,
amendment
).
to_s
.
gsub
(
%r(<del class=".+?">.+?</del>)
,
""
).
gsub
(
%r(<ins class=".+?">(.+?)</ins>)
,
"'''
\\
1'''"
)
end
end
members
=
doc
.
css
(
'Members'
).
text
members
=
doc
.
css
(
'Members'
).
text
.
split
(
%r{, }
).
map
{
|
m
|
"[[
#{
m
.
split
.
join
(
''
)
}
|
#{
m
}
]]"
}.
join
(
', '
)
article
=
doc
.
css
(
'Article'
).
text
article
=
doc
.
css
(
'Article'
).
text
Amendment
.
new
num
,
note
,
color
,
commission_rows
,
amendement_rows
,
members
,
article
Amendment
.
new
num
,
note
,
color
,
commission_rows
,
amendement_rows
,
members
,
article
...
...
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