Ignore:
Timestamp:
Feb 10, 2012, 7:29:03 PM (9 years ago)
Author:
goya
Message:

fix amdmts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpc/trunk/project/batch/amendements/cut_amdmt.pl

    r2633 r2636  
    33$file = shift;
    44use HTML::TokeParser;
     5use File::stat;
     6use Date::Format;
    57require ("../common/common.pm");
    68
     
    9698    $line2 = $line;
    9799    $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*$/)) {
    99103        $output = 'texte';
    100104        if ($texte == 2) { $output = 'expose'; }
     
    167171
    168172$string =~ s/\r//g;
     173$string =~ s/\t//g;
     174$string =~ s/\s*\n+\s*/\n/g;
    169175$string =~ s/&nbsp;/ /g;
    170176$string =~ s/\|(\W+)\|/$1/g;
    171 $string =~ s/([^>]\s*)\n/\1/g;
     177$string =~ s/([^>])\n/\1/g;
     178$string =~ s/>\n([^<])/> \1/g;
    172179foreach $line (split /\n/, $string)
    173180{
     
    314321$amdmt{'auteurs'} =~ s/([^,\s])\s*(les\s*membres.*groupe.*)$/\1, \2/i;
    315322
     323if (!$amdmt{'date'}) {
     324  $time = stat($file)->mtime;
     325  $amdmt{'date'} = time2str("%Y-%m-%d", $time);
     326}
     327if (!$amdmt{'sort'} && $amdmt{'texte'} =~ /amendement irrecevable/i) {
     328  $amdmt{'sort'} = 'Irrecevable';
     329}
     330
    316331print '{"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.