File: 11docment_format.t

package info (click to toggle)
libtext-multimarkdown-perl 1.000035-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, stretch
  • size: 1,772 kB
  • ctags: 148
  • sloc: perl: 2,186; makefile: 8
file content (48 lines) | stat: -rw-r--r-- 1,474 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
use strict;
use warnings;
use Test::More tests => 5;

#1
use_ok( 'Text::MultiMarkdown');

my $instr = q{A trivial block of text};
my $m = Text::MultiMarkdown->new();
my $outstr = qq{<p>A trivial block of text</p>\n};

is( #2
    $m->markdown($instr) => $outstr, 
    'Markdown'
);

$m = Text::MultiMarkdown->new();
$outstr = qq{<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>\n\t<head>\n\t</head>\n<body>\n<p>A trivial block of text</p>\n</body>\n</html>};

is( #3
    $m->markdown($instr, {document_format => 'Complete'}) => $outstr, 
    'Markdown with complete xhtml doc'
);

$instr = q{title: A page title
css: somestyle.css
other: some metadata

A trivial block of text};

$outstr = qq{<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>\n\t<head>\n\t\t<link type="text/css" rel="stylesheet" href="somestyle.css" />
\t\t<meta name="other" content="some metadata" />
\t\t<title>A page title</title>\n\t</head>\n<body>\n<p>A trivial block of text</p>\n</body>\n</html>};

is( #4
    $m->markdown($instr, {document_format => 'complete'}) => $outstr, 
    'Markdown with complete xhtml doc (and metadata)'
);

$outstr = qq{css: somestyle.css<br />\nother: some metadata<br />\ntitle: A page title<br />\n
<p>A trivial block of text</p>\n};

is( #5 
    $m->markdown($instr) => $outstr, 
    'Markdown withmetadata, but no complete doc'
);