|
50 | 50 | $version_count = preg_match_all('/<h2>Nextcloud (\d+)/', $content, $versions); |
51 | 51 | fprintf(STDERR, "✓ Found %d version sections: %s\n", $version_count, implode(', ', $versions[1])); |
52 | 52 |
|
53 | | -// Validate documentation links format (should be /server/VERSION/) |
54 | | -$docs_links = array_filter($external_links, fn($l) => preg_match('~docs\.[^/]+/server/~', $l)); |
55 | | - |
56 | | -if (!empty($docs_links)) { |
57 | | - $invalid_docs = array_filter($docs_links, fn($l) => |
58 | | - !preg_match('~/server/(latest|stable|\d+)/~', $l) |
| 53 | +// Validate documentation links format (should be server/VERSION/) |
| 54 | +// Check both relative links (server/latest, server/stable, etc.) and external docs links |
| 55 | +$relative_docs_links = array_filter($relative_links, fn($l) => preg_match('~^server/(latest|stable|\d+)/~', $l)); |
| 56 | +$external_docs_links = array_filter($external_links, fn($l) => preg_match('~docs\.[^/]+/server/~', $l)); |
| 57 | +$all_docs_links = array_merge($relative_docs_links, $external_docs_links); |
| 58 | + |
| 59 | +if (!empty($all_docs_links)) { |
| 60 | + $invalid_docs = array_filter($all_docs_links, fn($l) => |
| 61 | + !preg_match('~(server|/server)/(latest|stable|\d+)/~', $l) |
59 | 62 | ); |
60 | 63 |
|
61 | 64 | if (!empty($invalid_docs)) { |
|
64 | 67 | fprintf(STDERR, " - %s\n", $link); |
65 | 68 | } |
66 | 69 | } else { |
67 | | - fprintf(STDERR, "✓ All %d documentation links are properly formatted\n", count($docs_links)); |
| 70 | + fprintf(STDERR, "✓ All %d documentation links are properly formatted\n", count($all_docs_links)); |
68 | 71 | } |
69 | 72 | } |
70 | 73 |
|
|
0 commit comments