Skip to content

Improper X<> in =head #4550

Open
Open
@finanalyst

Description

tl;dr headings with =head and X<> have several forms, all but three fit a few relatively simple regexes. The three seem to be typos and easily fixed.

The 'Usage' one leads to a loss of text because the rendering regexes do not catch the last X<>, changing the other two have no effect on rendering.

They are

	=head2 X<sub USAGE|Tutorial,USAGE>X<|Tutorial,$*USAGE>
in file: raku-docs/Language/create-cli.rakudoc

	=head2 dbm functionsX<|Other languages,dbm - perlfunc>
in file: raku-docs/Language/5to6-perlfunc.rakudoc

	=head2 __FILE__X<|Other languages,__FILE__ - perlfunc>
in file: raku-docs/Language/5to6-perlfunc.rakudoc

Replace with (respectively)

=head2 X<sub USAGE|Tutorial,USAGE> and X<C«$*USAGE»|Tutorial,$*USAGE>
=head2 X<dbm functions|Other languages,dbm - perlfunc>
=head2 X<__FILE__|Other languages,__FILE__ - perlfunc>

FWIW: The analysis program is as follows (naive regexes to do the analysis quickly)

#!/usr/bin/env raku
use v6.d;
my $dir = 'raku-docs/';
my @todo = $dir.IO;
my @srcs;
while @todo {
    for @todo.pop.dir -> $path {
        if $path.d {
            @todo.push: $path
        }
        else {
            @srcs.push: $path
        }
    }
}
my %count;
my @unmatched;

my regex head { ^ '=head' \d* \s };
for @srcs -> $fn {
    for $fn.lines {
        next unless m/ <head> /;
        when / <head> <-[<]>+ [ 'X<'] <-[|]>+ '|' <-[>]>+ '>' $ / {
            %count<text-comp-index>.push: $_
        }
        when / <head> 'X«' <-[|]>+ '|' <-[ » ]>+ '»' $ / {
            %count<comp-index-only>.push: $_
        }
        when / <head> 'X<' <-[|]>+ '|' <-[>]>+ '>' $ / {
            %count<comp-index-only>.push: $_
        }
        when / <head> [ 'X<' <-[|]>+ '|' <-[>]>+ '>' [',' \s ]? [\s+ 'and' \s+]? ]+ $ / {
            %count<duplicated-comp-index>.push: $_
        }
        when / <head> [ 'X<' | 'X«' ] <-[>]>+ '>' $ / { 
            %count<simple-index-only>.push: $_
        }
        when / <head> [ 'X<' | 'X«' ] <-[|]>+ '|' <-[>]>+ '>' <-[<]>+  $ / {
            %count<comp-index-text>.push: $_
        }
        when / <head> [ 'X<' | 'X«' ] <-[>]>+ '>' <-[<]>+ $ / { 
            %count<simple-index-text>.push: $_
        }
        when / <head> .*? 'L<' / {
            %count<got-link>.push: $_
        }
        when / <head> .*? [ 'C<' | 'C«' ]/ {
            %count<got-code>.push: $_
        }
        when / <head> 'sub infix:' / {
            %count<infix-foo>.push: $_
        }
        when / <head> [
            '<>' | '$<' | 'I<' | '(<=)' | '(<)'
            | <-[<]>
            ]+ $ / {
            %count<text-only>.push: $_
        }
        default {
            @unmatched.push: [$fn, $_] ;
        }
    }
}
for %count.kv -> $k, $v { say "\n$k"; say "\t$_" for $v.list }
say "\n{+@unmatched} unmatched:";
say "\n\t" ~ .[1] ~ "\nin file: " ~ .[0] for @unmatched;

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions