Browse Source

* Text::Dokuwiki::Regexps : steal empty lines after block

master
Alex 'AdUser' Z 10 years ago
parent
commit
2ca3a4da01
  1. 7
      lib/Text/Dokuwiki/Regexps.pm

7
lib/Text/Dokuwiki/Regexps.pm

@ -6,11 +6,13 @@ use utf8;
my $SP = '[\ \t]'; my $SP = '[\ \t]';
my $EOL = '\r?\n'; my $EOL = '\r?\n';
my $TAIL = '(?:^\s*$)*';
our $regexps = {}; our $regexps = {};
$regexps->{header} = qr{ $regexps->{header} = qr{
^ (?<header> .+ ) $EOL ^ (?<header> .+ ) $EOL
^ (?<line> [=-]+ ) (?: $EOL | $) ^ (?<line> [=-]+ ) (?: $EOL | $)
$TAIL
}mx; }mx;
$regexps->{codeblock} = qr% $regexps->{codeblock} = qr%
@ -39,6 +41,7 @@ $SP? # maybe one leading space
</\g{tag}> # the same tag as in first line </\g{tag}> # the same tag as in first line
$SP* # maybe any number of trailing spaces $SP* # maybe any number of trailing spaces
(?: $EOL | $) # end of last line (?: $EOL | $) # end of last line
$TAIL # one or more empty lines
%mx; %mx;
$regexps->{table} = qr/ $regexps->{table} = qr/
@ -53,6 +56,7 @@ $regexps->{table} = qr/
(?: $EOL | $ ) # newline or file end (?: $EOL | $ ) # newline or file end
)+ # one or more such lines )+ # one or more such lines
) )
$TAIL # one or more empty lines
/mx; /mx;
$regexps->{pre} = qr/ $regexps->{pre} = qr/
@ -64,6 +68,7 @@ $regexps->{pre} = qr/
(?: $EOL | $ ) # newline or file end (?: $EOL | $ ) # newline or file end
)+ # one or more lines )+ # one or more lines
) )
$TAIL # one or more empty lines
/mx; /mx;
$regexps->{blockquote} = qr/ $regexps->{blockquote} = qr/
@ -76,6 +81,7 @@ $regexps->{blockquote} = qr/
(?: $EOL | $ ) # newline or file end (?: $EOL | $ ) # newline or file end
)+ # one or more lines )+ # one or more lines
) )
$TAIL # one or more empty lines
/mx; /mx;
$regexps->{list} = qr/ $regexps->{list} = qr/
@ -88,6 +94,7 @@ $regexps->{list} = qr/
(?: $EOL | $ ) # newline or file end (?: $EOL | $ ) # newline or file end
)+ # one or more lines )+ # one or more lines
) )
$TAIL # one or more empty lines
/mx; /mx;
1; 1;

Loading…
Cancel
Save