~ubuntu-branches/ubuntu/precise/nginx/precise-security

« back to all changes in this revision

Viewing changes to debian/modules/chunkin-nginx-module/util/wiki2pod.pl

  • Committer: Package Import Robot
  • Author(s): Kartik Mistry, Kartik Mistry, Michael Lustfield
  • Date: 2011-11-18 23:44:00 UTC
  • mfrom: (4.2.39 sid)
  • Revision ID: package-import@ubuntu.com-20111118234400-atj8d0zog78vgdte
Tags: 1.1.8-1
[Kartik Mistry]
* New upstream release.
* debian/modules/chunkin-nginx-module:
  + Removed as of now, as it breaks with Perl 5.14 (Closes: #649061)

[Michael Lustfield]
* debian/control:
  + Added Map module to nginx-light modules list.
* debian/rules:
  + Removed --without-http_map_module form nginx-light.
* debian/nginx-common.install:
  + Changed ufw profile installation (LP: #825349).
    - debian/ufw.profile -> debian/ufw/nginx.
* debian/nginx-common.preinst:
  + Cleanup of moved nginx profile.
* debian/conf/nginx.conf:
  + Added a default map for $server_https (on|off).
* debian/conf/fastcgi_params:
  + Pass HTTPS so $_SERVER['HTTPS'] is set (LP: #857831).
* debian/conf/mime.types:
  + Added json type (LP: #883440).
* debian/conf/sites-available/default:
  + Added notes about PHP (Closes: #642995).
  + Changed location /doc from root to alias.
  + Changed location /doc to /doc/ for people that don't bother reading or
    learning anything about Nginx configuration files (LP: #840358).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/env perl
2
 
 
3
 
use strict;
4
 
use warnings;
5
 
use bytes;
6
 
 
7
 
my @nl_counts;
8
 
my $last_nl_count_level;
9
 
 
10
 
my @bl_counts;
11
 
my $last_bl_count_level;
12
 
 
13
 
sub fmt_pos ($) {
14
 
    (my $s = $_[0]) =~ s{\#(.*)}{/"$1"};
15
 
    $s;
16
 
}
17
 
 
18
 
sub fmt_mark ($$) {
19
 
    my ($tag, $s) = @_;
20
 
    my $max_level = 0;
21
 
    while ($s =~ /([<>])\1*/g) {
22
 
        my $level = length $&;
23
 
        if ($level > $max_level) {
24
 
            $max_level = $level;
25
 
        }
26
 
    }
27
 
 
28
 
    my $times = $max_level + 1;
29
 
    if ($times > 1) {
30
 
        $s = " $s ";
31
 
    }
32
 
    return $tag . ('<' x $times) . $s . ('>' x $times);
33
 
}
34
 
 
35
 
print "=encoding utf-8\n\n";
36
 
 
37
 
while (<>) {
38
 
    if ($. == 1) {
39
 
        # strip the leading U+FEFF byte in MS-DOS text files
40
 
        my $first = ord(substr($_, 0, 1));
41
 
        #printf STDERR "0x%x", $first;
42
 
        #my $second = ord(substr($_, 2, 1));
43
 
        #printf STDERR "0x%x", $second;
44
 
        if ($first == 0xEF) {
45
 
            substr($_, 0, 1, '');
46
 
            #warn "Hit!";
47
 
        }
48
 
    }
49
 
    s{\[(http[^ \]]+) ([^\]]*)\]}{$2 (L<$1>)}gi;
50
 
    s{ \[\[ ( [^\]\|]+ ) \| ([^\]]*) \]\] }{"L<$2|" . fmt_pos($1) . ">"}gixe;
51
 
    s{<code>(.*?)</code>}{fmt_mark('C', $1)}gie;
52
 
    s{'''(.*?)'''}{fmt_mark('B', $1)}ge;
53
 
    s{''(.*?)''}{fmt_mark('I', $1)}ge;
54
 
    if (s{^\s*<[^>]+>\s*$}{}) {
55
 
        next;
56
 
    }
57
 
 
58
 
    if (/^\s*$/) {
59
 
        print "\n";
60
 
        next;
61
 
    }
62
 
 
63
 
=begin cmt
64
 
 
65
 
    if ($. == 1) {
66
 
        warn $_;
67
 
        for my $i (0..length($_) - 1) {
68
 
            my $chr = substr($_, $i, 1);
69
 
            warn "chr ord($i): ".ord($chr)." \"$chr\"\n";
70
 
        }
71
 
    }
72
 
 
73
 
=end cmt
74
 
=cut
75
 
 
76
 
    if (/(=+) (.*) \1$/) {
77
 
        #warn "HERE! $_" if $. == 1;
78
 
        my ($level, $title) = (length $1, $2);
79
 
        collapse_lists();
80
 
 
81
 
        print "\n=head$level $title\n\n";
82
 
    } elsif (/^(\#+) (.*)/) {
83
 
        my ($level, $txt) = (length($1) - 1, $2);
84
 
        if (defined $last_nl_count_level && $level != $last_nl_count_level) {
85
 
            print "\n=back\n\n";
86
 
        }
87
 
        $last_nl_count_level = $level;
88
 
        $nl_counts[$level] ||= 0;
89
 
        if ($nl_counts[$level] == 0) {
90
 
            print "\n=over\n\n";
91
 
        }
92
 
        $nl_counts[$level]++;
93
 
        print "\n=item $nl_counts[$level].\n\n";
94
 
        print "$txt\n";
95
 
    } elsif (/^(\*+) (.*)/) {
96
 
        my ($level, $txt) = (length($1) - 1, $2);
97
 
        if (defined $last_bl_count_level && $level != $last_bl_count_level) {
98
 
            print "\n=back\n\n";
99
 
        }
100
 
        $last_bl_count_level = $level;
101
 
        $bl_counts[$level] ||= 0;
102
 
        if ($bl_counts[$level] == 0) {
103
 
            print "\n=over\n\n";
104
 
        }
105
 
        $bl_counts[$level]++;
106
 
        print "\n=item *\n\n";
107
 
        print "$txt\n";
108
 
    } else {
109
 
        collapse_lists();
110
 
        print;
111
 
    }
112
 
}
113
 
 
114
 
collapse_lists();
115
 
 
116
 
sub collapse_lists {
117
 
    while (defined $last_nl_count_level && $last_nl_count_level >= 0) {
118
 
        print "\n=back\n\n";
119
 
        $last_nl_count_level--;
120
 
    }
121
 
    undef $last_nl_count_level;
122
 
    undef @nl_counts;
123
 
 
124
 
    while (defined $last_bl_count_level && $last_bl_count_level >= 0) {
125
 
        print "\n=back\n\n";
126
 
        $last_bl_count_level--;
127
 
    }
128
 
    undef $last_bl_count_level;
129
 
    undef @bl_counts;
130
 
}
131