|
|
1.1 ! root 1: # ! 2: # nono ! 3: # Copyright (C) 2020 nono project ! 4: # Licensed under nono-license.txt ! 5: # ! 6: ! 7: # ! 8: # xgettext の出力を整形する ! 9: # ! 10: ! 11: # ヘッダをこっちのものに差し替える ! 12: for ($i = 0; $i < 5; $i++) { ! 13: <>; ! 14: } ! 15: print "#\n"; ! 16: print "# nono\n"; ! 17: print "# Copyright (C) 2020 nono project\n"; ! 18: print "# Licensed under nono-license.txt\n"; ! 19: print "#\n"; ! 20: print "\n"; ! 21: ! 22: # コメント中のファイル名はほしいけど行番号はいらない ! 23: $in_comment = 0; ! 24: $buffered = ""; ! 25: for ($lines = 0; <>; $lines++) { ! 26: if ($in_comment == 0) { ! 27: # 地文中 ! 28: if (/^#: (.*)/) { ! 29: # コメントが来た ! 30: $in_comment = 1; ! 31: $buffered = $1; ! 32: } else { ! 33: # 地文の続き ! 34: print $_; ! 35: } ! 36: } else { ! 37: # コメント中 ! 38: if (/^#: (.*)/) { ! 39: # コメント継続 ! 40: $buffered .= " $1"; ! 41: } else { ! 42: # コメント終わり ! 43: $in_comment = 0; ! 44: $orig = $_; ! 45: ! 46: # ここまでに出てきたファイル名を uniq | sort ! 47: $buffered =~ s/:\d+//g; ! 48: my @list = split(/\s+/, $buffered); ! 49: my @list2 = (); ! 50: my $prev = ""; ! 51: foreach my $f (sort @list) { ! 52: if ($f ne $prev) { ! 53: push @list2, $f; ! 54: $prev = $f; ! 55: } ! 56: } ! 57: ! 58: # 出力 (手抜きにより行折り返しは考慮しない) ! 59: print "#:"; ! 60: foreach my $f (@list2) { ! 61: print " $f"; ! 62: } ! 63: print "\n"; ! 64: ! 65: print $orig; ! 66: } ! 67: } ! 68: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.