Skip to content

Commit 24dd32b

Browse files
authored
Merge pull request #1 from perl6/master
update
2 parents 8406291 + f5ea68c commit 24dd32b

File tree

14 files changed

+101
-19
lines changed

14 files changed

+101
-19
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
.precomp/
2-
1+
*~
2+
.precomp

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ language: perl6
55
sudo: false
66
perl6:
77
- latest
8+
- '2017.12'
89
install:
910
- rakudobrew build-zef
1011
- zef --debug install .

META6.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
{
22
"perl" : "6.*",
33
"name" : "Pod::To::HTML",
4-
"version" : "0.3.22",
4+
"version" : "0.4.0",
5+
"author" : "Perl 6",
56
"description" : "Convert Perl 6 Pod to HTML",
67
"license" : "Artistic-2.0",
7-
"depends" : ["URI", "Template::Mustache"],
8+
"depends" : [
9+
"URI",
10+
"Template::Mustache"
11+
],
812
"test-depends" : ["Test::Output"],
913
"provides" : {
1014
"Pod::To::HTML" : "lib/Pod/To/HTML.pm"

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ This module is in the [Perl 6 ecosystem](https://modules.perl6.org), so you inst
1616
simply disregard the test and install with `--force` if that
1717
particular feature is of no use to you.
1818

19+
**Note**: Perl6 2018.11 introduced handling of Definition blocks,
20+
`Defn`. Please upgrade if you are using that feature in the
21+
documentation.
22+
1923
## SYNOPSIS
2024

2125
From the command line:
@@ -55,8 +59,12 @@ say Pod::To::HTML.render($pod,
5559
lang => "document language (defaults to 'en')",
5660
default-title => 'No =title was found so we use this');
5761

58-
```
62+
# If you want to use a specific template
63+
say pod2html $=pod[0], :templates("lib/templates");
64+
# main.mustache should be in that directory
65+
5966

67+
```
6068
## DESCRIPTION
6169

6270
`Pod::To::HTML` takes a Pod 6 tree and outputs correspondingly
@@ -70,6 +78,9 @@ Optionally, a custom header/fooder/head-fields can be
7078
provided. These can be used to link to custom CSS stylesheets and
7179
JavaScript libraries.
7280

81+
## Examples
82+
83+
Check the [`examples`](resources/examples/README.md) directory (which should have been installed with your distribution, or is right here if you download from source) for a few illustrative examples.
7384

7485
## DEBUGGING
7586

README.pod6

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ Render Pod6 as HTML
55
66
=begin SYNOPSIS
77
8-
=item
8+
Use it integrated with Perl 6 documentation system
9+
910
perl6 --doc=HTML lib/FancyModule.pm > FancyModule.html
1011
11-
=begin item
12-
=begin code
13-
=pod My I<super B<awesome>> embedded C<pod>
14-
document!
12+
Or as an external function to render your documentation
13+
14+
=begin code
15+
=pod My I<super B<awesome>> embedded C<pod> document!
1516
16-
say Pod::To::HTML.render($=pod[0]);
17-
=end code
18-
=end item
17+
say Pod::To::HTML.render($=pod[0]);
18+
=end code
1919
2020
=end SYNOPSIS
2121

lib/Pod/To/HTML.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ sub assemble-list-items(:@content, :$node, *% ) {
157157
}
158158

159159

160-
#| Converts a Pod tree to a HTML document.
160+
#| Converts a Pod tree to a HTML document using templates
161161
sub pod2html(
162162
$pod,
163163
:&url = -> $url { $url },
@@ -171,7 +171,7 @@ sub pod2html(
171171
--> Str ) is export {
172172

173173
my $template-file = %?RESOURCES<templates/main.mustache>;
174-
with $templates {
174+
with $templates {
175175
if "$templates/main.mustache".IO ~~ :f {
176176
$template-file = "$templates/main.mustache".IO
177177
}
File renamed without changes.

resources/examples/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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.

resources/examples/main.mustache

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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>

resources/examples/render.p6

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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 commit comments

Comments
 (0)