App-phoebe
view release on metacpan or search on metacpan
script/ijirait view on Meta::CPAN
}
sub to_text {
my $text = shift;
$text =~ s/^[23].*\n//; # skip headers
$text =~ s/^=> \S+ (type|Back)\n//gm; # drop type command from the list, and the help page
my @lines = split(/\n/, $text);
my $section = "";
for (@lines) {
if ($section =~ /^(Hidden )?(Exits|Things)$/
and s/^=> \S+\s+(.*?) \((\S+)\)$/"* $1 (" . colored($2, 'bold') . ")"/e) {
# exits and things come in lists and their shortcuts are bold
} elsif (s/^=> \/play\/ijirait\S*\s+(.*)/"* " . colored($1, 'bold')/e) {
# internal links are commands, come in lists, and they are all bold
} elsif (s/^=> \/\/(\S+)\s+(.*)/"* " . colored($2, 'italic') . " â gemini:\/\/$1"/e) {
# external links without protocol come in lists, italic, and the URL
# is printed separately for clicking in a terminal emulator, with gemini:
# scheme added
} elsif (s/^=> (\S+)\s+(.*)/"* " . colored($2, 'italic') . " â $1"/e) {
# external links are treated as above but gemini: is not prefixed to the
# URL
} elsif (s/^# (.*)/colored($1, 'bold underline')/e) {
$_ = $wrapper->wrap($_);
} elsif (s/^## (.*)/colored($1, 'underline')/e) {
$section = $1;
$_ = $wrapper->wrap($_);
} elsif (s/^### (.*)/colored($1, 'italic')/e) {
$_ = $wrapper->wrap($_);
} elsif (s/^> *(.*)/colored($1, 'italic')/e) {
$wrapper->par_start(" ");
$wrapper->body_start(" ");
$_ = $wrapper->wrap($_);
( run in 2.013 seconds using v1.01-cache-2.11-cpan-d8267643d1d )