# HG changeset patch # User Matti Hamalainen # Date 1451451487 -7200 # Node ID 72bf6267e34f0135ca3f576222dc9c325796bc6b # Parent 7615bf7f980f92759e5f1e493a3cf58ffb5743f1 Use underlines for multiword material names in plaintext format alloy list. diff -r 7615bf7f980f -r 72bf6267e34f materials/parsealloys.pl --- 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 () { 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)"; }