<commit_before>#!/usr/bin/env perl
use strict;
use warnings;
use feature "say";
use Data::Dumper;
use Getopt::Long qw(:config auto_abbrev);


# Parse options
my $size=34;
my $repo="";
my $icon_folder="svg";
GetOptions(
	"size=i"        => \$size,
	"repo=s"        => \$repo,
	"icon-folder=s" => \$icon_folder
);


# Query author/repo from shell if not supplied
unless($repo){
	$repo = `git remote get-url origin`;
	$repo =~ m/:(.+)\.git$/;
	$repo = $1;
}


my $input_path  = $ARGV[0];
my $output_path = $ARGV[1];

sub warnMissing {
	printf STDERR "No %s file specified.\n", $_[0];
	my $usage = "\x1B[1mUSAGE:\x1B[0m $0 input output\n";
	$usage =~ s/$_[0]/[\x1B[4m$&\x1B[0m]/i;
	printf STDERR $usage;
}

# Argument checking
unless($input_path) { warnMissing "input";  exit 2; }
unless($output_path){ warnMissing "output"; exit 2; }


my %codepoints = ();
my %table_rows = ();
my $output_src;


# Load existing character map
open(my $fh, "< :encoding(UTF-8)", $output_path);
{
	local $/=undef; # Slurp

	while(<$fh>){
		
		# Store file's contents for later
		$output_src = $_;
		
		# Grab which codepoints are already listed
		while($_ =~ m/<tbody.+<a name="([^"]+)".+<code>\\([0-9A-Fa-f]+)<\/code>.+<\/tbody>/ig){
			$codepoints{$2} = $1;
			$table_rows{$1} = $&;
		}
	}
	close($fh);
}

my $url = "https://cdn.rawgit.com/$repo/master/svg/%1\$s.svg";
my $row = '<tbody><tr><td align="center"><a name="%1$s" href="' . $url . '"><img src="' . $url .
	'" height="34" valign="bottom" hspace="3" alt=""/></a></td><td><b>%1$s</b></td><td><a name="%2$s"></a><code>\\%2$s</code></td></tr></tbody>';


# Pick up newly-defined characters from SVG font<commit_msg>Fix rows being sorted on codepoint<commit_after>#!/usr/bin/env perl
use strict;
use warnings;
use feature "say";
use Data::Dumper;
use Getopt::Long qw(:config auto_abbrev);


# Parse options
my $size=34;
my $repo="";
my $icon_folder="svg";
GetOptions(
	"size=i"        => \$size,
	"repo=s"        => \$repo,
	"icon-folder=s" => \$icon_folder
);


# Query author/repo from shell if not supplied
unless($repo){
	$repo = `git remote get-url origin`;
	$repo =~ m/:(.+)\.git$/;
	$repo = $1;
}


my $input_path  = $ARGV[0];
my $output_path = $ARGV[1];

sub warnMissing {
	printf STDERR "No %s file specified.\n", $_[0];
	my $usage = "\x1B[1mUSAGE:\x1B[0m $0 input output\n";
	$usage =~ s/$_[0]/[\x1B[4m$&\x1B[0m]/i;
	printf STDERR $usage;
}

# Argument checking
unless($input_path) { warnMissing "input";  exit 2; }
unless($output_path){ warnMissing "output"; exit 2; }


my %codepoints = ();
my %table_rows = ();
my $output_src;


# Load existing character map
open(my $fh, "< :encoding(UTF-8)", $output_path);
{
	local $/=undef; # Slurp

	while(<$fh>){
		
		# Store file's contents for later
		$output_src = $_;
		
		# Grab which codepoints are already listed
		while($_ =~ m/<tbody.+?<a name="([^"]+)".+<code>\\([0-9A-Fa-f]+)<\/code>.+<\/tbody>/ig){
			$codepoints{$2} = $1;
			$table_rows{$1} = $&;
		}
	}
	close($fh);
}

my $url = "https://cdn.rawgit.com/$repo/master/svg/%1\$s.svg";
my $row = '<tbody><tr><td align="center"><a name="%1$s" href="' . $url . '"><img src="' . $url .
	'" height="34" valign="bottom" hspace="3" alt=""/></a></td><td><b>%1$s</b></td><td><a name="%2$s"></a><code>\\%2$s</code></td></tr></tbody>';


# Pick up newly-defined characters from SVG font
{'fraction_non_alphanumeric': 0.24338146811071, 'fraction_numerical': 0.019253910950661854, 'mean_word_length': 4.007530120481928, 'pattern_counts': {'":': 0, '<': 55, '<?xml version=': 0, '>': 55, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6132753', 'n_tokens_mistral': 1448, 'n_tokens_neox': 1364, 'n_words': 298}