|
|
@ -11,36 +11,34 @@ my $rx = $Text::Dokuwiki::Regexps::regexps; |
|
|
|
use re 'debugcolor'; |
|
|
|
use re 'debugcolor'; |
|
|
|
my $text = <<'TEXT'; |
|
|
|
my $text = <<'TEXT'; |
|
|
|
|
|
|
|
|
|
|
|
Header 1st level |
|
|
|
====== Header 1st level ====== |
|
|
|
================= |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TEXT |
|
|
|
TEXT |
|
|
|
my $matched = 'Header 1st level'; |
|
|
|
my $matched = 'Header 1st level'; |
|
|
|
|
|
|
|
|
|
|
|
my @matches = $text =~ m/$rx->{header}/; |
|
|
|
my @matches = $text =~ m/$rx->{header}/; |
|
|
|
is(scalar @matches, 2); |
|
|
|
is(scalar @matches, 2); |
|
|
|
|
|
|
|
is($+{line}, '======'); |
|
|
|
is($+{header}, $matched); |
|
|
|
is($+{header}, $matched); |
|
|
|
is($+{line}, '================='); |
|
|
|
is($matches[0], '======'); |
|
|
|
is($matches[0], $matched); |
|
|
|
is($matches[1], $matched); |
|
|
|
is($matches[1], '================='); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$text = <<'TEXT'; |
|
|
|
$text = <<'TEXT'; |
|
|
|
|
|
|
|
|
|
|
|
Header 2nd level |
|
|
|
===== Header 2nd level ===== |
|
|
|
----------------- |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TEXT |
|
|
|
TEXT |
|
|
|
$matched = 'Header 2nd level'; |
|
|
|
$matched = 'Header 2nd level'; |
|
|
|
@matches = $text =~ m/$rx->{header}/; |
|
|
|
@matches = $text =~ m/$rx->{header}/; |
|
|
|
is(scalar @matches, 2); |
|
|
|
is(scalar @matches, 2); |
|
|
|
is($matches[0], $matched); |
|
|
|
is($matches[0], '====='); |
|
|
|
is($matches[1], '-----------------'); |
|
|
|
is($matches[1], $matched); |
|
|
|
|
|
|
|
|
|
|
|
$text = "Header only\n-------------"; |
|
|
|
$text = "==== Header only ===="; |
|
|
|
$matched = 'Header only'; |
|
|
|
$matched = 'Header only'; |
|
|
|
@matches = $text =~ m/$rx->{header}/; |
|
|
|
@matches = $text =~ m/$rx->{header}/; |
|
|
|
is($matches[0], $matched); |
|
|
|
is($matches[0], '===='); |
|
|
|
is($matches[1], '-------------'); |
|
|
|
is($matches[1], $matched); |
|
|
|
|
|
|
|
|
|
|
|
$text = <<'TEXT'; |
|
|
|
$text = <<'TEXT'; |
|
|
|
|
|
|
|
|
|
|
|