Mercurial > hg > batmud > misc
changeset 315:72bf6267e34f misc
Use underlines for multiword material names in plaintext format alloy list.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 30 Dec 2015 06:58:07 +0200 |
parents | 7615bf7f980f |
children | fedf17494a35 |
files | materials/parsealloys.pl |
diffstat | 1 files changed, 11 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/materials/parsealloys.pl Tue Dec 29 15:59:28 2015 +0200 +++ b/materials/parsealloys.pl Wed Dec 30 06:58:07 2015 +0200 @@ -30,6 +30,14 @@ } +sub ul($) +{ + my $tmp = $_[0]; + $tmp =~ s/ /_/g; + return $tmp; +} + + ### ### Parse data from input, ignoring fumbled alloys ### @@ -50,6 +58,7 @@ $fumble = 0; } + while (<STDIN>) { chomp; if (/^You mix ([a-z ]+?) and ([a-z ]+?) and create a quantity of (.+?)\.?$/) @@ -204,7 +213,7 @@ { foreach my $min2 (sort { $a cmp $b } keys %{$final{$min1}}) { - printf "%-35s = ", $min1." + ".$min2; + printf "%-35s = ", ul($min1)." + ".ul($min2); my $n = 0; foreach my $res (sort { $final{$min1}{$min2}{$a} <=> $final{$min1}{$min2}{$b} @@ -212,7 +221,7 @@ $a cmp $b } keys %{$final{$min1}{$min2}}) { - print $res."[".$final{$min1}{$min2}{$res}."] "; + print ul($res)."[".$final{$min1}{$min2}{$res}."] "; $n++; } if ($n > 1) { print " (unstable)"; }