File tree Expand file tree Collapse file tree 1 file changed +55
-0
lines changed
Expand file tree Collapse file tree 1 file changed +55
-0
lines changed Original file line number Diff line number Diff line change 1+ # !/usr/bin/env raku
2+
3+ = begin overview
4+
5+ Avoid I < bare > URLs that are not links; URLs should go inside C < L <> > markup.
6+
7+ = end overview
8+
9+ use experimental : rakuast;
10+
11+ use Test ;
12+ use RakuDoc::Test::Files;
13+
14+ my @ files = RakuDoc::Test::Files. pods;
15+
16+ if @ files {
17+ plan + @ files ;
18+ } else {
19+ plan : skip-all<No rakudoc files specified >
20+ }
21+
22+ sub walk ($ node ) {
23+ my @ children ;
24+ if $ node ~~ RakuAST::Doc::Paragraph {
25+ @ children = $ node . atoms;
26+ } elsif $ node ~~ RakuAST::Doc::Block {
27+ return if $ node . type eq ' code' | ' implicit-code' | ' comment' | ' table' ;
28+ @ children = $ node . paragraphs;
29+ } elsif $ node ~~ RakuAST::Doc::Markup {
30+ return if $ node . letter eq ' L' ;
31+ @ children = $ node . atoms;
32+ } else {
33+ # If this hits, need to adapt test
34+ flunk " new node type: $ node .^name" ;
35+ }
36+
37+ for @ children -> $ child {
38+ if $ child ~~ Str {
39+ if $ child ~~ / $ < url > =[ 'http' 's' ? '://' <- [ / ] >* '/' ? ] / {
40+ flunk " URL found: $ < url > " ;
41+ }
42+ } else {
43+ walk($ child );
44+ }
45+ }
46+ }
47+
48+ for @ files -> $ file {
49+ % * ENV <RAKUDO_RAKUAST >= 1 ;
50+ subtest $ file => {
51+ for $ file . IO . slurp . AST . rakudoc -> $ pod {
52+ walk($ pod );
53+ }
54+ }
55+ }
You can’t perform that action at this time.
0 commit comments