github-markup 3.0.1 → 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.dockerignore +1 -0
- data/.gitignore +1 -1
- data/.gitmodules +3 -0
- data/.travis.yml +4 -1
- data/Dockerfile +39 -0
- data/HISTORY.md +4 -0
- data/README.md +11 -2
- data/github-markup.gemspec +2 -1
- data/lib/github-markup.rb +1 -1
- data/lib/github/commands/pod62html +10 -0
- data/lib/github/markup.rb +1 -0
- data/lib/github/markup/implementation.rb +5 -1
- data/lib/github/markups.rb +1 -0
- data/test/markup_test.rb +2 -3
- data/test/markups/README.pod6 +151 -0
- data/test/markups/README.pod6.html +128 -0
- data/vendor/Pod-To-HTML/LICENSE +201 -0
- data/vendor/Pod-To-HTML/META6.json +20 -0
- data/vendor/Pod-To-HTML/README.md +96 -0
- data/vendor/Pod-To-HTML/README.pod6 +42 -0
- data/vendor/Pod-To-HTML/TODO +5 -0
- data/vendor/Pod-To-HTML/lib/Pod/To/HTML.pm +691 -0
- data/vendor/Pod-To-HTML/resources/examples/01-parse-files.p6 +7 -0
- data/vendor/Pod-To-HTML/resources/examples/README.md +13 -0
- data/vendor/Pod-To-HTML/resources/examples/main.mustache +26 -0
- data/vendor/Pod-To-HTML/resources/examples/render.p6 +17 -0
- data/vendor/Pod-To-HTML/resources/templates/main.mustache +32 -0
- data/vendor/Pod-To-HTML/t/010-basic.t +29 -0
- data/vendor/Pod-To-HTML/t/020-code.t +49 -0
- data/vendor/Pod-To-HTML/t/030-comment.t +15 -0
- data/vendor/Pod-To-HTML/t/040-lists.t +82 -0
- data/vendor/Pod-To-HTML/t/050-format-x-index.t +47 -0
- data/vendor/Pod-To-HTML/t/060-table.t +108 -0
- data/vendor/Pod-To-HTML/t/070-headings.t +45 -0
- data/vendor/Pod-To-HTML/t/075-defn.t +45 -0
- data/vendor/Pod-To-HTML/t/080-lang.t +14 -0
- data/vendor/Pod-To-HTML/t/090-css.t +16 -0
- data/vendor/Pod-To-HTML/t/100-issue-37.t +16 -0
- data/vendor/Pod-To-HTML/t/110-issue-41.t +18 -0
- data/vendor/Pod-To-HTML/t/120-templates.t +42 -0
- data/vendor/Pod-To-HTML/t/templates/main.mustache +33 -0
- metadata +39 -6
@@ -0,0 +1,13 @@
|
|
1
|
+
# Some examples for the module.
|
2
|
+
|
3
|
+
Test
|
4
|
+
|
5
|
+
perl6 -I../../lib render.p6
|
6
|
+
|
7
|
+
which uses the local [template `main.mustache`](main.mustache) instead of the default one. Add a pod6 or pm6 file at the end if you want to check a different file.
|
8
|
+
|
9
|
+
Change to the upper dir, and run
|
10
|
+
|
11
|
+
perl6 -Ilib resources/examples/01-parse-files.p6
|
12
|
+
|
13
|
+
for a similar version which uses the same file.
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html lang="{{ lang }}">
|
3
|
+
<head>
|
4
|
+
<title>{{ title }}</title>
|
5
|
+
<meta charset="UTF-8" />
|
6
|
+
<style>
|
7
|
+
kbd { font-family: "Droid Sans Mono", "Luxi Mono", "Inconsolata", monospace }
|
8
|
+
samp, code { font-family: "Terminus", "Courier", "Lucida Console", monospace }
|
9
|
+
|
10
|
+
.nested {
|
11
|
+
margin-left: 3em;
|
12
|
+
}
|
13
|
+
aside, u { opacity: 0.7 }
|
14
|
+
a[id^="fn-"]:target { background: #ff0 }
|
15
|
+
</style>
|
16
|
+
</head>
|
17
|
+
<body class="pod">
|
18
|
+
<div id="___top"></div>
|
19
|
+
{{{ header }}}
|
20
|
+
{{# title }}<h1 class='title'>{{ title }}</h1>{{/ title }}
|
21
|
+
{{# subtitle }}<p class='subtitle'>{{ subtitle }}</p>{{/ subtitle }}
|
22
|
+
<div class="pod-body no-toc">
|
23
|
+
{{# body }}{{{ . }}}{{/ body }}
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env perl6
|
2
|
+
|
3
|
+
use v6;
|
4
|
+
use MONKEY-SEE-NO-EVAL;
|
5
|
+
use Pod::To::HTML;
|
6
|
+
|
7
|
+
sub MAIN( $file = "../../README.pod6" ) {
|
8
|
+
my $file-content = $file.IO.slurp;
|
9
|
+
die "No pod here" if not $file-content ~~ /\=begin \s+ pod/;
|
10
|
+
my $pod;
|
11
|
+
try {
|
12
|
+
$pod = EVAL($file-content ~ "\n\$=pod");
|
13
|
+
};
|
14
|
+
die "Pod fails: $!" if $!;
|
15
|
+
my $result = pod2html( $pod, templates => '.' );
|
16
|
+
say $result;
|
17
|
+
}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html lang="{{ lang }}">
|
3
|
+
<head>
|
4
|
+
<title>{{ title }}</title>
|
5
|
+
<meta charset="UTF-8" />
|
6
|
+
<style>
|
7
|
+
kbd { font-family: "Droid Sans Mono", "Luxi Mono", "Inconsolata", monospace }
|
8
|
+
samp { font-family: "Terminus", "Courier", "Lucida Console", monospace }
|
9
|
+
u { text-decoration: none }
|
10
|
+
.nested {
|
11
|
+
margin-left: 3em;
|
12
|
+
}
|
13
|
+
aside, u { opacity: 0.7 }
|
14
|
+
a[id^="fn-"]:target { background: #ff0 }
|
15
|
+
</style>
|
16
|
+
{{# css }}<link rel="stylesheet" href="{{ css }}">{{/ css }}
|
17
|
+
{{# metadata }}{{{ metadata }}}{{/ metadata }}
|
18
|
+
{{{ head }}}
|
19
|
+
</head>
|
20
|
+
<body class="pod">
|
21
|
+
<div id="___top"></div>
|
22
|
+
{{{ header }}}
|
23
|
+
{{# title }}<h1 class='title'>{{ title }}</h1>{{/ title }}
|
24
|
+
{{# subtitle }}<p class='subtitle'>{{ subtitle }}</p>{{/ subtitle }}
|
25
|
+
{{# toc }}{{{ toc }}}{{/ toc }}
|
26
|
+
<div class="pod-body{{^ toc }} no-toc{{/ toc }})">
|
27
|
+
{{# body }}{{{ . }}}{{/ body }}
|
28
|
+
</div>
|
29
|
+
{{# footnotes }}{{{ footnotes }}}{{/ footnotes }}
|
30
|
+
{{{ footer }}}
|
31
|
+
</body>
|
32
|
+
</html>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
use Test; # -*- mode: perl6 -*-
|
2
|
+
use Pod::To::HTML;
|
3
|
+
plan 3;
|
4
|
+
|
5
|
+
# XXX Need a module to walk HTML trees
|
6
|
+
|
7
|
+
=begin foo
|
8
|
+
=end foo
|
9
|
+
|
10
|
+
my $r = node2html $=pod[0];
|
11
|
+
ok $r ~~ ms/'<section>' '<h1>' foo '</h1>' '</section>' /;
|
12
|
+
|
13
|
+
=begin foo
|
14
|
+
some text
|
15
|
+
=end foo
|
16
|
+
|
17
|
+
$r = node2html $=pod[1];
|
18
|
+
ok $r ~~ ms/'<section>' '<h1>' foo '</h1>' '<p>' some text '</p>' '</section>'/;
|
19
|
+
|
20
|
+
=head1 Talking about Perl 6
|
21
|
+
|
22
|
+
if $*PERL.compiler.name eq 'rakudo'
|
23
|
+
and $*PERL.compiler.version before v2018.06 {
|
24
|
+
skip "Your rakudo is too old for this test. Need 2018.06 or newer";
|
25
|
+
}
|
26
|
+
else {
|
27
|
+
$r = node2html $=pod[2];
|
28
|
+
nok $r ~~ m:s/Perl 6/, "no-break space is not converted to other space";
|
29
|
+
}
|
@@ -0,0 +1,49 @@
|
|
1
|
+
use Test;
|
2
|
+
use Pod::To::HTML;
|
3
|
+
plan 3;
|
4
|
+
my $r;
|
5
|
+
|
6
|
+
=begin pod
|
7
|
+
This ordinary paragraph introduces a code block:
|
8
|
+
|
9
|
+
$this = 1 * code('block');
|
10
|
+
$which.is_specified(:by<indenting>);
|
11
|
+
=end pod
|
12
|
+
|
13
|
+
$r = node2html $=pod[0];
|
14
|
+
ok $r ~~ ms[[
|
15
|
+
'<p>' 'This ordinary paragraph introduces a code block:' '</p>'
|
16
|
+
'<pre class="pod-block-code">$this = 1 * code('block');'
|
17
|
+
'$which.is_specified(:by<indenting>);</pre>']];
|
18
|
+
|
19
|
+
=begin pod
|
20
|
+
This is an ordinary paragraph
|
21
|
+
|
22
|
+
While this is not
|
23
|
+
This is a code block
|
24
|
+
|
25
|
+
=head1 Mumble: "mumble"
|
26
|
+
|
27
|
+
Suprisingly, this is not a code block
|
28
|
+
(with fancy indentation too)
|
29
|
+
|
30
|
+
But this is just a text. Again
|
31
|
+
|
32
|
+
=end pod
|
33
|
+
|
34
|
+
$r = node2html $=pod[1];
|
35
|
+
ok $r ~~ ms[['<p>' 'This is an ordinary paragraph' '</p>'
|
36
|
+
'<pre class="pod-block-code">While this is not'
|
37
|
+
'This is a code block</pre>'
|
38
|
+
'<h1 id="Mumble:_"mumble"">' '<a class="u" href="#___top" title="go to top of document">'
|
39
|
+
'Mumble: "mumble"'
|
40
|
+
'</a>' '</h1>'
|
41
|
+
'<p>' 'Suprisingly, this is not a code block (with fancy indentation too)' '</p>'
|
42
|
+
'<p>' 'But this is just a text. Again' '</p>']];
|
43
|
+
|
44
|
+
my %*POD2HTML-CALLBACKS = code => sub (:$node, :&default) {
|
45
|
+
ok $node.contents ~~ /:i code/, 'Callback called';
|
46
|
+
}
|
47
|
+
|
48
|
+
# say $=pod[0].perl;
|
49
|
+
pod2html $=pod[0];
|
@@ -0,0 +1,82 @@
|
|
1
|
+
use Test;
|
2
|
+
use Pod::To::HTML;
|
3
|
+
plan 3;
|
4
|
+
my $r;
|
5
|
+
|
6
|
+
=begin pod
|
7
|
+
The seven suspects are:
|
8
|
+
|
9
|
+
=item Happy
|
10
|
+
=item Dopey
|
11
|
+
=item Sleepy
|
12
|
+
=item Bashful
|
13
|
+
=item Sneezy
|
14
|
+
=item Grumpy
|
15
|
+
=item Keyser Soze
|
16
|
+
=end pod
|
17
|
+
|
18
|
+
$r = pod2html $=pod[0];
|
19
|
+
ok $r ~~ ms[[
|
20
|
+
'<p>' 'The seven suspects are:' '</p>'
|
21
|
+
'<ul>'
|
22
|
+
'<li>' '<p>' Happy '</p>' '</li>'
|
23
|
+
'<li>' '<p>' Dopey '</p>' '</li>'
|
24
|
+
'<li>' '<p>' Sleepy '</p>' '</li>'
|
25
|
+
'<li>' '<p>' Bashful '</p>' '</li>'
|
26
|
+
'<li>' '<p>' Sneezy '</p>' '</li>'
|
27
|
+
'<li>' '<p>' Grumpy '</p>' '</li>'
|
28
|
+
'<li>' '<p>' Keyser Soze '</p>' '</li>'
|
29
|
+
'</ul>'
|
30
|
+
]];
|
31
|
+
|
32
|
+
=begin pod
|
33
|
+
=item1 Animal
|
34
|
+
=item2 Vertebrate
|
35
|
+
=item2 Invertebrate
|
36
|
+
|
37
|
+
=item1 Phase
|
38
|
+
=item2 Solid
|
39
|
+
=item2 Liquid
|
40
|
+
=item2 Gas
|
41
|
+
=item2 Chocolate
|
42
|
+
=end pod
|
43
|
+
|
44
|
+
$r = pod2html $=pod[1];
|
45
|
+
ok $r ~~ ms[[
|
46
|
+
'<ul>'
|
47
|
+
'<li>' '<p>' Animal '</p>' '</li>'
|
48
|
+
'<ul>'
|
49
|
+
'<li>' '<p>' Vertebrate '</p>' '</li>'
|
50
|
+
'<li>' '<p>' Invertebrate '</p>' '</li>'
|
51
|
+
'</ul>'
|
52
|
+
'<li>' '<p>' Phase '</p>' '</li>'
|
53
|
+
'<ul>'
|
54
|
+
'<li>' '<p>' Solid '</p>' '</li>'
|
55
|
+
'<li>' '<p>' Liquid '</p>' '</li>'
|
56
|
+
'<li>' '<p>' Gas '</p>' '</li>'
|
57
|
+
'<li>' '<p>' Chocolate '</p>' '</li>'
|
58
|
+
'</ul>'
|
59
|
+
'</ul>'
|
60
|
+
]];
|
61
|
+
|
62
|
+
=begin pod
|
63
|
+
=comment CORRECT...
|
64
|
+
=begin item1
|
65
|
+
The choices are:
|
66
|
+
=end item1
|
67
|
+
=item2 Liberty
|
68
|
+
=item2 Death
|
69
|
+
=item2 Beer
|
70
|
+
=end pod
|
71
|
+
|
72
|
+
$r = pod2html $=pod[2];
|
73
|
+
ok $r ~~ ms[[
|
74
|
+
'<ul>'
|
75
|
+
'<li>' '<p>' 'The choices are:' '</p>' '</li>'
|
76
|
+
'<ul>'
|
77
|
+
'<li>' '<p>' Liberty '</p>' '</li>'
|
78
|
+
'<li>' '<p>' Death '</p>' '</li>'
|
79
|
+
'<li>' '<p>' Beer '</p>' '</li>'
|
80
|
+
'</ul>'
|
81
|
+
'</ul>'
|
82
|
+
]];
|
@@ -0,0 +1,47 @@
|
|
1
|
+
use Test;
|
2
|
+
use Pod::To::HTML;
|
3
|
+
plan 3;
|
4
|
+
|
5
|
+
=begin pod
|
6
|
+
X<|behavior> L<http://www.doesnt.get.rendered.com>
|
7
|
+
=end pod
|
8
|
+
|
9
|
+
my $r = pod2html $=pod, :url({ $_ });
|
10
|
+
ok $r ~~ m/'href="http://www.doesnt.get.rendered.com"'/;
|
11
|
+
|
12
|
+
=begin pod
|
13
|
+
|
14
|
+
When indexing X<an item> the X<X format> is used.
|
15
|
+
|
16
|
+
It is possible to index X<an item> in repeated places.
|
17
|
+
=end pod
|
18
|
+
|
19
|
+
$r = node2html $=pod[1];
|
20
|
+
|
21
|
+
like $r, /
|
22
|
+
'When indexing'
|
23
|
+
\s* '<a name="index-entry-an_item">'
|
24
|
+
\s* '<span ' .* '>an item</span>'
|
25
|
+
.+ 'the'
|
26
|
+
.+ '<span ' .+ '>X format</span>'
|
27
|
+
.+ 'to index'
|
28
|
+
.+ '<span' .+ '>an item</span>'
|
29
|
+
.+ 'in repeated places.'
|
30
|
+
/, 'X format in text';
|
31
|
+
|
32
|
+
=begin pod
|
33
|
+
|
34
|
+
When indexing X<an item|Define an item> another text can be used for the index.
|
35
|
+
|
36
|
+
It is possible to index X<hierarchical items|defining, a term>with hierarchical levels.
|
37
|
+
|
38
|
+
And then index the X<same place|Same; Place> with different index entries.
|
39
|
+
=end pod
|
40
|
+
|
41
|
+
$r = node2html $=pod[2];
|
42
|
+
like $r, /
|
43
|
+
'When indexing <a name="index-entry-Define_an_item-an_item">'
|
44
|
+
.* '<span' .+ '>an item</span>'
|
45
|
+
.+ 'to index ' .+ 'index-entry-defining__a_term-hierarchical_items' .+ '<span' .+ '>hierarchical items</span>'
|
46
|
+
.+ 'index the ' .+ '>same place</span>'
|
47
|
+
/, 'Text with indexed items correct';
|
@@ -0,0 +1,108 @@
|
|
1
|
+
use Test; # -*- mode: perl6 -*-
|
2
|
+
use Pod::To::HTML;
|
3
|
+
|
4
|
+
plan 4;
|
5
|
+
|
6
|
+
my $r;
|
7
|
+
|
8
|
+
=table
|
9
|
+
col1 col2
|
10
|
+
|
11
|
+
$r = pod2html $=pod[0];
|
12
|
+
#say $r.perl;
|
13
|
+
ok $r ~~ ms[[
|
14
|
+
'<table class="pod-table">'
|
15
|
+
'<tbody>'
|
16
|
+
'<tr>'
|
17
|
+
'<td>' col1 '</td>'
|
18
|
+
'<td>' col2 '</td>'
|
19
|
+
'</tr>'
|
20
|
+
'</tbody>'
|
21
|
+
'</table>'
|
22
|
+
]];
|
23
|
+
|
24
|
+
=table
|
25
|
+
H1 H2
|
26
|
+
-- --
|
27
|
+
col1 col2
|
28
|
+
|
29
|
+
$r = pod2html $=pod[1];
|
30
|
+
#say $r.perl;
|
31
|
+
ok $r ~~ ms[[
|
32
|
+
'<table class="pod-table">'
|
33
|
+
'<thead>'
|
34
|
+
'<tr>'
|
35
|
+
'<th>' H1 '</th>'
|
36
|
+
'<th>' H2 '</th>'
|
37
|
+
'</tr>'
|
38
|
+
'</thead>'
|
39
|
+
'<tbody>'
|
40
|
+
'<tr>'
|
41
|
+
'<td>' col1 '</td>'
|
42
|
+
'<td>' col2 '</td>'
|
43
|
+
'</tr>'
|
44
|
+
'</tbody>'
|
45
|
+
'</table>'
|
46
|
+
]];
|
47
|
+
|
48
|
+
|
49
|
+
=begin table :class<sorttable>
|
50
|
+
|
51
|
+
H1 H2
|
52
|
+
-- --
|
53
|
+
col1 col2
|
54
|
+
|
55
|
+
col1 col2
|
56
|
+
|
57
|
+
=end table
|
58
|
+
|
59
|
+
$r = pod2html $=pod[2];
|
60
|
+
#say $r.perl;
|
61
|
+
ok $r ~~ ms[[
|
62
|
+
'<table class="pod-table sorttable">'
|
63
|
+
'<thead>'
|
64
|
+
'<tr>'
|
65
|
+
'<th>' H1 '</th>'
|
66
|
+
'<th>' H2 '</th>'
|
67
|
+
'</tr>'
|
68
|
+
'</thead>'
|
69
|
+
'<tbody>'
|
70
|
+
'<tr>'
|
71
|
+
'<td>' col1 '</td>'
|
72
|
+
'<td>' col2 '</td>'
|
73
|
+
'</tr>'
|
74
|
+
'<tr>'
|
75
|
+
'<td>' col1 '</td>'
|
76
|
+
'<td>' col2 '</td>'
|
77
|
+
'</tr>'
|
78
|
+
'</tbody>'
|
79
|
+
'</table>'
|
80
|
+
]];
|
81
|
+
|
82
|
+
=begin table :caption<Test Caption>
|
83
|
+
|
84
|
+
H1 H2
|
85
|
+
-- --
|
86
|
+
col1 col2
|
87
|
+
|
88
|
+
=end table
|
89
|
+
|
90
|
+
$r = pod2html $=pod[3];
|
91
|
+
# say $r;
|
92
|
+
ok $r ~~ ms[[
|
93
|
+
'<table class="pod-table">'
|
94
|
+
'<caption>' 'Test Caption' '</caption>'
|
95
|
+
'<thead>'
|
96
|
+
'<tr>'
|
97
|
+
'<th>' H1 '</th>'
|
98
|
+
'<th>' H2 '</th>'
|
99
|
+
'</tr>'
|
100
|
+
'</thead>'
|
101
|
+
'<tbody>'
|
102
|
+
'<tr>'
|
103
|
+
'<td>' col1 '</td>'
|
104
|
+
'<td>' col2 '</td>'
|
105
|
+
'</tr>'
|
106
|
+
'</tbody>'
|
107
|
+
'</table>'
|
108
|
+
]];
|
@@ -0,0 +1,45 @@
|
|
1
|
+
use v6;
|
2
|
+
use Test;
|
3
|
+
use Pod::To::HTML;
|
4
|
+
|
5
|
+
plan 3;
|
6
|
+
|
7
|
+
=begin pod
|
8
|
+
|
9
|
+
=head1 Heading 1
|
10
|
+
|
11
|
+
=head2 Heading 1.1
|
12
|
+
|
13
|
+
=head2 Heading 1.2
|
14
|
+
|
15
|
+
=head1 Heading 2
|
16
|
+
|
17
|
+
=head2 Heading 2.1
|
18
|
+
|
19
|
+
=head2 Heading 2.2
|
20
|
+
|
21
|
+
=head2 <a href="/routine/message#class_Exception">(Exception) method message</a>
|
22
|
+
|
23
|
+
=head3 Heading 2.2.1
|
24
|
+
|
25
|
+
=head3 X<Heading> 2.2.2
|
26
|
+
|
27
|
+
=head1 Heading C<3>
|
28
|
+
|
29
|
+
=end pod
|
30
|
+
|
31
|
+
my $html = pod2html $=pod;
|
32
|
+
|
33
|
+
#put $html;
|
34
|
+
|
35
|
+
($html ~~ m:g/ ('2.2.2') /);
|
36
|
+
|
37
|
+
is so ($0 && $1 && $2), True, 'hierarchical numbering';
|
38
|
+
|
39
|
+
($html ~~ m:g/ 'href="#Heading_3"' /);
|
40
|
+
|
41
|
+
is so $0, True, 'link down to heading';
|
42
|
+
|
43
|
+
($html ~~ m:g/ ('name="index-entry-Heading"') /);
|
44
|
+
|
45
|
+
is so ($0 || $1), True, 'no X<> anchors in ToC';
|