Rosetta Code/Run examples: Difference between revisions

Content added Content deleted
m (syntax highlighting fixup automation)
m (→‎{{header|Raku}}: minimal changes to allow it to work with relocated site and new markup)
Line 1,399: Line 1,399:


my $client = HTTP::UserAgent.new;
my $client = HTTP::UserAgent.new;
my $url = 'http://rosettacode.org/mw';
my $url = 'https://rosettacode.org/w';


my %c = ( # text colors
my %c = ( # text colors
Line 1,477: Line 1,477:
uh-oh("Whoops, can't find page: $url/$title :check spelling.\n\n{fuzzy-search($title)}", 'warn')
uh-oh("Whoops, can't find page: $url/$title :check spelling.\n\n{fuzzy-search($title)}", 'warn')
and next if $page.elems == 0;
and next if $page.elems == 0;
say "Getting code from: http://rosettacode.org/wiki/{ $title.subst(' ', '_', :g) }#%l<language>";
say "Getting code from: https://rosettacode.org/wiki/{ $title.subst(' ', '_', :g) }#%l<language>";


$entry = $page.comb(rx:i/'=={{header|' $(%l<header>) '}}==' .+? [<?before \n'=='<-[={]>*'{{header'> || $] /).Str //
$entry = $page.comb(rx:i/'=={{header|' $(%l<header>) '}}==' .+? [<?before \n'=='<-[={]>*'{{header'> || $] /).Str //
Line 1,669: Line 1,669:
multi load-lang ('raku') { ( # Language specific variables. Adjust to suit.
multi load-lang ('raku') { ( # Language specific variables. Adjust to suit.
language => 'Raku', # language category name
language => 'Raku', # language category name
exe => 'raku', # executable name to run raku in a shell
exe => 'raku', # executable name to run perl6 in a shell
ext => '.raku', # file extension for raku code (optional, but nice to have)
ext => '.raku', # file extension for perl6 code (optional, but nice to have)
dir => 'raku', # directory to save tasks to
dir => 'raku', # directory to save tasks to
header => 'Raku', # header text (=={{header|Raku}}==)
header => 'Raku', # header text (=={{header|Raku}}==)
Line 1,676: Line 1,676:
# and to avoid getting tripped up when trying to run _this_ task.
# and to avoid getting tripped up when trying to run _this_ task.
# note that this tag only selects the syntax highlighting, continue to
# note that this tag only selects the syntax highlighting, continue to
# use 'perl6' until 'raku' as added on the site.
# leave 'perl6' as an option, 'raku' is now live on the site.
tag => rx/<?after '<syntaxhighlight lang="' 'perl6' '">' > .*? <?before '</' 'lang>'>/,
tag => rx/:i <?after '<syntaxhighlight lang="' ['perl6'|'raku'] '"' ' line'? '>' > .*? <?before '</' 'syntaxhighlight>'>/,
) }
) }


Line 1,686: Line 1,686:
dir => 'perl',
dir => 'perl',
header => 'Perl',
header => 'Perl',
tag => rx/:i <?after '<syntaxhighlight lang="' 'perl' '">' > .*? <?before '</' 'lang>'>/,
tag => rx/:i <?after '<syntaxhighlight lang="' 'perl' '"' ' line'? '>' > .*? <?before '</' 'lang>'>/,
) }
) }


Line 1,695: Line 1,695:
dir => 'python',
dir => 'python',
header => 'Python',
header => 'Python',
tag => rx/:i <?after '<syntaxhighlight lang="' 'python' '">' > .*? <?before '</' 'lang>'>/,
tag => rx/:i <?after '<syntaxhighlight lang="' 'python' '"' ' line'? '>' > .*? <?before '</' 'lang>'>/,
) }
) }


Line 1,704: Line 1,704:
dir => 'go',
dir => 'go',
header => 'Go',
header => 'Go',
tag => rx/:i <?after '<syntaxhighlight lang="' 'go' '">' > .*? <?before '</' 'lang>'>/,
tag => rx/:i <?after '<syntaxhighlight lang="' 'go' '"' ' line'? '>' > .*? <?before '</' 'lang>'>/,
) }
) }


Line 1,713: Line 1,713:
dir => 'tcl',
dir => 'tcl',
header => 'Tcl',
header => 'Tcl',
tag => rx/:i <?after '<syntaxhighlight lang="' 'tcl' '">' > .*? <?before '</' 'lang>'>/,
tag => rx/:i <?after '<syntaxhighlight lang="' 'tcl' '"' ' line'? '>' > .*? <?before '</' 'lang>'>/,
) }
) }