Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 85 lines (71 sloc) 1.756 kB
ee8ca1a @moritz use fully qualified names for Pod classes
moritz authored
1 my class Pod::Block {
2 has %.config;
3 has @.content;
5ceefd9 @tadzik Improve Pod::Block stringification, moritz++
tadzik authored
4
5 sub pod-gist(Pod::Block $pod, $level = 0) {
6 my $leading = ' ' x $level;
7 my %confs;
8 my @chunks;
9 for <config name level caption type> {
10 my $thing = $pod.?"$_"();
11 if $thing {
12 %confs{$_} = $thing ~~ Iterable ?? $thing.perl
13 !! $thing.Str;
14 }
15 }
16 @chunks = $leading, $pod.^name, (%confs.perl if %confs), "\n";
17 for $pod.content.list -> $c {
18 if $c ~~ Pod::Block {
19 @chunks.push: pod-gist($c, $level + 2);
20 }
21 elsif $c ~~ Positional {
22 @chunks.push: $c>>.Str.perl.indent($level + 2), "\n";
23 }
24 else {
1965724 @moritz run sigilless params tests
moritz authored
25 @chunks.push: $c.Str.indent($level + 2), "\n";
5ceefd9 @tadzik Improve Pod::Block stringification, moritz++
tadzik authored
26 }
27 }
28 @chunks.join;
29 }
30
31 method gist {
1965724 @moritz run sigilless params tests
moritz authored
32 pod-gist(self)
5ceefd9 @tadzik Improve Pod::Block stringification, moritz++
tadzik authored
33 }
ee8ca1a @moritz use fully qualified names for Pod classes
moritz authored
34 }
9d33af3 @tadzik Import as little Pod classes as needed, less hacky than before due to…
tadzik authored
35
ee8ca1a @moritz use fully qualified names for Pod classes
moritz authored
36 my class Pod::Block::Para is Pod::Block {
37 }
585cd06 @tadzik The Pod tree should not contain bare strings. Use Pod::Block::Para, a…
tadzik authored
38
ee8ca1a @moritz use fully qualified names for Pod classes
moritz authored
39 my class Pod::Block::Named is Pod::Block {
40 has $.name;
41 }
9d33af3 @tadzik Import as little Pod classes as needed, less hacky than before due to…
tadzik authored
42
ee8ca1a @moritz use fully qualified names for Pod classes
moritz authored
43 my class Pod::Block::Comment is Pod::Block { }
571755c @tadzik Handle code blocks properly, import 04-code.t
tadzik authored
44
ee8ca1a @moritz use fully qualified names for Pod classes
moritz authored
45 my class Pod::Block::Code is Pod::Block {
46 has @.allowed;
47 }
571755c @tadzik Handle code blocks properly, import 04-code.t
tadzik authored
48
ee8ca1a @moritz use fully qualified names for Pod classes
moritz authored
49 my class Pod::Block::Declarator is Pod::Block {
50 has $.WHEREFORE;
51 method set_docee($d) {
52 $!WHEREFORE = $d
71df76f @tadzik Push declarator blocks to $=POD as a Pod::Block::Declarator objects
tadzik authored
53 }
ee8ca1a @moritz use fully qualified names for Pod classes
moritz authored
54 method Str {
55 ~@.content
8787be2 @tadzik Parse tables, import 07-tables.t
tadzik authored
56 }
ee8ca1a @moritz use fully qualified names for Pod classes
moritz authored
57 method gist {
58 self.Stringy
c0e4135 @tadzik Implement Formatting Codes in Pod strings
tadzik authored
59 }
ee8ca1a @moritz use fully qualified names for Pod classes
moritz authored
60 }
c0e4135 @tadzik Implement Formatting Codes in Pod strings
tadzik authored
61
ee8ca1a @moritz use fully qualified names for Pod classes
moritz authored
62 my class Pod::Block::Table is Pod::Block {
63 has $.caption;
64 has @.headers; # optional, may be empty
65 }
0c0d929 @tadzik Generate Pod::Heading objects from =head directives
tadzik authored
66
ee8ca1a @moritz use fully qualified names for Pod classes
moritz authored
67 my class Pod::FormattingCode is Pod::Block {
68 has $.type;
69 }
276bfeb @tadzik Parse =config directives properly
tadzik authored
70
ee8ca1a @moritz use fully qualified names for Pod classes
moritz authored
71 my class Pod::Heading is Pod::Block {
72 has $.level;
73 }
74
75 my class Pod::Item is Pod::Block {
76 has $.level;
77 }
78
79 class Pod::Config {
80 has $.type;
81 has %.config;
3a828b7 @tadzik Parse lists properly, makes 06-lists.t
tadzik authored
82 }
83
9d33af3 @tadzik Import as little Pod classes as needed, less hacky than before due to…
tadzik authored
84 # vim: ft=perl6
Something went wrong with that request. Please try again.