Rev 11480 | Rev 14815 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 11480 | Rev 11793 | ||
---|---|---|---|
Line 4... | Line 4... | ||
4 | use locale; |
4 | use locale; |
5 | use warnings; |
5 | use warnings; |
6 | $/ = undef; |
6 | $/ = undef; |
7 | ### most of these "mistakes" has been done by the Msg2wims |
7 | ### most of these "mistakes" has been done by the Msg2wims |
8 | ### should be better to correct it but more difficult ! |
8 | ### should be better to correct it but more difficult ! |
- | 9 | ### introduction of \n can break the inline folds ... |
|
9 | my $file=$ARGV[0]; |
10 | my $file=$ARGV[0]; |
10 | open (IN ,$file) ; |
11 | open (IN ,$file) ; |
11 | my $text = <IN>; |
12 | my $text = <IN>; |
12 | ##multiple <p> |
13 | ##multiple <p> |
13 | $text =~ s:(<p>\s*){2,}:<p> |
14 | $text =~ s:(<p>\s*){2,}:<p>:g; |
14 | ## close br and hr |
15 | ## close br and hr |
15 | $text =~ s:<(b|h)r>:<$1r/>:g; |
16 | $text =~ s:<(b|h)r>:<$1r/>:g; |
16 | $text =~ s:<p>\s*(<li>|</?ul>|</?ol>): |
17 | $text =~ s:<p>\s*(<li>|</?ul>|</?ol>):$1:g; |
17 | ## delete <p> before <li><ul><ol> |
18 | ## delete <p> before <li><ul><ol> |
18 | $text =~ s:<br ?/?>\s*(<li>|</?ul>|</?ol>): |
19 | $text =~ s:<br ?/?>\s*(<li>|</?ul>|</?ol>):$1:g; |
19 | ## delete <li> empty |
20 | ## delete <li> empty |
20 | $text =~ s:<li>\s*</(u|o)l>:</$1l>:g; |
21 | $text =~ s:<li>\s*</(u|o)l>:</$1l>:g; |
21 | ## transform some hr |
22 | ## transform some hr |
22 | $text =~ s|<hr\s+width="(\d+)%"\s*/?/>|<hr style="width:$1%"/>|g; |
23 | $text =~ s|<hr\s+width="(\d+)%"\s*/?/>|<hr style="width:$1%"/>|g; |
23 | ## delete <br/> before table ? |
24 | ## delete <br/> before table ? |
24 | $text =~ s|<br ?/></table>|</table>|g; |
25 | $text =~ s|<br ?/></table>|</table>|g; |
25 | ## delete multiple <br> |
26 | ## delete multiple <br> |
26 | $text =~ s:(<br ?/>\s*)+:<br/> |
27 | $text =~ s:(<br ?/>\s*)+:<br/>:g; |
27 | $text =~ s:</div>\s+</div>:</div> |
28 | $text =~ s:</div>\s+</div>:</div></div>:g; |
28 | $text =~ s:</div>\s*<br/>\s*</div>:</div> |
29 | $text =~ s:</div>\s*<br/>\s*</div>:</div></div>:g; |
- | 30 | ## delete <br/> before div |
|
- | 31 | $text =~ s:<br/>\s*<div:<div:g; |
|
- | 32 | $text =~ s:<br/> *!:<br/>\n!:g; |
|
- | 33 | $text =~ s:\n{3,}:\n\n:g; |
|
29 | close(IN); |
34 | close(IN); |
30 | 35 | ||
31 | open (OUT, ">$file"); |
36 | open (OUT, ">$file"); |
32 | print OUT $text ; close OUT; |
37 | print OUT $text ; close OUT; |