# ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # File: iosevka-fonts-all-readme.pl # Copyright 🄯 2016—2023 Van de Bugger. # SPDX-License-Identifier: FSFAP # ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― use v5.30.0; use warnings; use open ':locale'; use FindBin; BEGIN { require "$FindBin::Bin/iosevka-fonts-all.pm" or die( $@ or $! ); Iosevka::Util->import; }; get_options(); @ARGV == 0 and die "$0: Not enough arguments.\n"; @ARGV > 1 and die "$0: Too many arguments.\n"; my $text = path( $ARGV[ 0 ] )->slurp_utf8(); # Remove the first centered

with following paragraph: $text =~ s{ \A \s*

.*?

\s*

.*?

\s* }{}isx; $text =~ s{

([^<>]*)

}{ $1 }egimx; # Replace links to .md files with links to .html files: $text =~ s{ () }{ $1 . $2 . '.html' . $3 }egimx; # Fix image links: $text =~ s{ (]* />) }{ $1 . $2 . $3 . $4 }egimx; # There is a problem in this fragment: # # ## Mirrors # # - TUNA (CN): https://mirrors.tuna.tsinghua.edu.cn/github-release/be5invis/Iosevka # - NJU (CN): https://mirrors.nju.edu.cn/github-release/be5invis/Iosevka # --- # # pandoc interprets the last item of the list as heading (because of "---"). Let's avoid it. # At convert addresses to liks. sub make_links($) { my ( $text ) = @_; $text =~ s{ ^ - \h+ ([^:]+): \h+ (https://[^\h]*) \h* \n }{ "- [$1]($2)\n" }egmx; return $text; }; $text =~ s{ ^ ( \#\# \h+ Mirrors \h* \n+ ) ( (?: - \h+ .* \n )+ ) \n* ( --- \n ) }{ $1 . make_links( $2 ) . "\n" . $3 }emx; $text =~ s{\Q![Family Matrix](images/matrix.light.svg#gh-light-mode-only)\E}{}em; $text =~ s{\Q![Family Matrix](images/matrix.dark.svg#gh-dark-mode-only)\E}{}em; STDOUT->print( $text ); # end of file #