Commit 8e2fbe9d authored by Michael Witrant's avatar Michael Witrant

debut wiki

parent 22553978
...@@ -18,9 +18,10 @@ data = File.read('Amdts_spectre_1.txt') ...@@ -18,9 +18,10 @@ data = File.read('Amdts_spectre_1.txt')
require 'rubygems' require 'rubygems'
require 'pp' require 'pp'
require 'nokogiri' require 'nokogiri'
require 'unindent'
sections = data.scan(%r(<Amend>.+?</Amend>)m) sections = data.scan(%r(<Amend>.+?</Amend>)m)
amendements = sections.map do |xml| sections.each do |xml|
doc = Nokogiri::XML(xml) doc = Nokogiri::XML(xml)
num, note = doc.css('NumAm').text.split(' ', 2) num, note = doc.css('NumAm').text.split(' ', 2)
...@@ -34,7 +35,7 @@ amendements = sections.map do |xml| ...@@ -34,7 +35,7 @@ amendements = sections.map do |xml|
when "++" when "++"
"red" "red"
when "+" when "+"
"lightred" "IndianRed"
when "" when ""
"lightgrey" "lightgrey"
else else
...@@ -54,15 +55,36 @@ amendements = sections.map do |xml| ...@@ -54,15 +55,36 @@ amendements = sections.map do |xml|
amendement_rows << amendement amendement_rows << amendement
end end
{ commission_rows, amendement_rows = [commission_rows, amendement_rows].map do |rows|
:num => num, rows.delete_if { |row| row.nil? or row.empty? }
:note => note, rows.join("\n")
:color => color, end
:members => doc.css('Members').text,
:article => doc.css('Article').text, members = doc.css('Members').text
:commission_rows => commission_rows, article = doc.css('Article').text
:amendement_rows => amendement_rows,
} 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 end
puts amendements.to_yaml
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