Skip to content

Commit b729c96

Browse files
committed
Make extract-examples script recognize only token and add an exclude list for Language/ section
1 parent 877fe8e commit b729c96

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

util/extract-examples.p6

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ multi sub walk(Pod::Block::Code $_, @context is copy) {
2323
if ($content.lines.».trim.map( {(.starts-with('multi') ||
2424
.starts-with('method') ||
2525
.starts-with('proto') ||
26+
.starts-with('only') ||
2627
.starts-with('sub')) &&
2728
(not .ends-with('}'))} ).all) {
2829
$content = $content.subst("\n", " \{\}\n", :g) ~ ' {' ~ '}';
@@ -50,9 +51,13 @@ my &verbose = sub (|c) {};
5051

5152
sub MAIN(Str :$source-path!, Str :$prefix!, Str :$exclude = ".git", Bool :v(:verbose($v)), Bool :$force, *@files) {
5253
my \exclude = none(flat <. ..>, $exclude.split(','));
54+
# We exclude these files from examples list
55+
my @exclude-list = '5to6', 'rb', 'module', 'nativecall', 'testing', 'traps', 'packages';
5356

5457
@files ||= gather for $source-path {
55-
take .IO when .IO.f && .Str.ends-with('.pod6');
58+
take .IO when .IO.f
59+
&& .Str.ends-with('.pod6')
60+
&& !.basename.starts-with(any @exclude-list);
5661
.IO.dir(test => exclude)».&?BLOCK when .IO.d
5762
}
5863

0 commit comments

Comments
 (0)