Changeset 2636 for cpc/trunk/project/batch
- Timestamp:
- Feb 10, 2012, 7:29:03 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpc/trunk/project/batch/amendements/cut_amdmt.pl
r2633 r2636 3 3 $file = shift; 4 4 use HTML::TokeParser; 5 use File::stat; 6 use Date::Format; 5 7 require ("../common/common.pm"); 6 8 … … 96 98 $line2 = $line; 97 99 $line2 =~ s/\s*\<\/?[^\>]+\>//g; 98 if (!($line2 =~ /\s*Adt\s+n°\s*$/)) { 100 $line2 =~ s/^[ \s]*//; 101 $line2 =~ s/[\s ]*$//; 102 if ($line2 !~ /^$/ && !($line2 =~ /\s*Adt\s+n°\s*$/)) { 99 103 $output = 'texte'; 100 104 if ($texte == 2) { $output = 'expose'; } … … 167 171 168 172 $string =~ s/\r//g; 173 $string =~ s/\t//g; 174 $string =~ s/\s*\n+\s*/\n/g; 169 175 $string =~ s/ / /g; 170 176 $string =~ s/\|(\W+)\|/$1/g; 171 $string =~ s/([^>]\s*)\n/\1/g; 177 $string =~ s/([^>])\n/\1/g; 178 $string =~ s/>\n([^<])/> \1/g; 172 179 foreach $line (split /\n/, $string) 173 180 { … … 314 321 $amdmt{'auteurs'} =~ s/([^,\s])\s*(les\s*membres.*groupe.*)$/\1, \2/i; 315 322 323 if (!$amdmt{'date'}) { 324 $time = stat($file)->mtime; 325 $amdmt{'date'} = time2str("%Y-%m-%d", $time); 326 } 327 if (!$amdmt{'sort'} && $amdmt{'texte'} =~ /amendement irrecevable/i) { 328 $amdmt{'sort'} = 'Irrecevable'; 329 } 330 316 331 print '{"source": "'.$source.'", "legislature": "'.$amdmt{'legislature'}.'", "loi": "'.$amdmt{'loi'}.'", "numero": "'.$amdmt{'numero'}.'", "serie": "'.$amdmt{'serie'}.'", "rectif": "'.$amdmt{'rectif'}.'", "parent": "'.$amdmt{'parent'}.'", "date": "'.$amdmt{'date'}.'", "auteurs": "'.$amdmt{'auteurs'}.'", "sort": "'.$amdmt{'sort'}.'", "sujet": "'.$amdmt{'sujet'}.'", "texte": "'.$amdmt{'texte'}.'", "expose": "'.$amdmt{'expose'}.'" } '."\n";
Note: See TracChangeset
for help on using the changeset viewer.