• R/O
  • SSH
  • HTTPS

ttssh2: Commit


Commit MetaInfo

Revision9665 (tree)
Time2022-01-03 16:21:44
Authorzmatsuo

Log Message

2sjis.pl を installer/ から doc/ へ移動

Change Summary

Incremental Difference

--- trunk/doc/2sjis.pl (nonexistent)
+++ trunk/doc/2sjis.pl (revision 9665)
@@ -0,0 +1,104 @@
1+#!/usr/bin/perl -w
2+
3+require 5.24.0;
4+use strict;
5+use warnings;
6+use Encode;
7+use utf8;
8+use Getopt::Long qw(:config posix_default no_ignore_case gnu_compat);
9+
10+my $PERL = $^X;
11+
12+sub MarkdownToHTML {
13+ my $buf = $_[0];
14+
15+ my $cmd = "$PERL Markdown_1.0.1/Markdown.pl";
16+# my $cmd = 'cat';
17+
18+ my $out_file = "MD_TO_HTML_$$" . "_md";
19+ my $in_file = "MD_TO_HTML_$$" . "_html";
20+
21+ my $OUT;
22+ open ($OUT, ">:unix:encoding(utf8)", $out_file) or die("error :$! $out_file");
23+ print $OUT $buf;
24+ close $OUT;
25+
26+ my $sys = "$cmd < $out_file > $in_file";
27+ my $r = system($sys);
28+ if ($r != 0) {
29+ print "r=$r\n";
30+ exit($r);
31+ # Can't spawn "cmd.exe" ... -> check $PATH
32+ }
33+
34+ my $IN;
35+ open ($IN, "<:crlf:encoding(utf8)", $in_file) or die("error :$! $in_file");
36+ $buf = join "", <$IN>;
37+ close $IN;
38+
39+ unlink $in_file;
40+ unlink $out_file;
41+
42+ $buf;
43+}
44+
45+binmode STDOUT, ":utf8";
46+
47+my($in, $out, $result);
48+
49+# default setting
50+my $coding = "shiftjis";
51+my $lf = "crlf";
52+my $type = "text";
53+my $zlib_special;
54+
55+$result = GetOptions('in|i=s' => \$in,
56+ 'out|o=s' => \$out,
57+ 'coding|c=s' => \$coding,
58+ 'lf|l=s' => \$lf,
59+ 'type|t=s' => \$type,
60+ 'zlib_special' => \$zlib_special);
61+
62+if (!(defined($in) && defined($out))) {
63+ die "Usage: $0 --in file --out file [ --coding input_encoding ] [ --lf line_format ] [ --type type ]\n";
64+}
65+
66+if ($in =~/\.md/) {
67+ $type = "markdown";
68+ $coding = "utf8";
69+}
70+
71+my $IN;
72+if ($in eq "-") {
73+ binmode STDIN, ":$lf:encoding($coding)";
74+ $IN = *STDIN;
75+} else {
76+ open ($IN, "<:$lf:encoding($coding)", $in) or die("error :$! $in");
77+}
78+if ($zlib_special) {
79+ while (<$IN>) {
80+ last if $_ =~ /Copyright notice:/;
81+ }
82+}
83+my $buf = join "", <$IN>;
84+$buf =~ s/\x{FEFF}//g; # remove all bom
85+close $IN;
86+
87+if ($type =~ /markdown/i ) {
88+ $buf = &MarkdownToHTML($buf);
89+}
90+
91+my $OUT;
92+if ($out eq "-") {
93+ binmode STDOUT, ":crlf:encoding(shiftjis)";
94+ $OUT = *STDOUT;
95+} else {
96+ open ($OUT, '>:crlf:encoding(shiftjis)', $out);
97+}
98+print $OUT $buf;
99+close $OUT;
100+
101+if ($in ne "-") {
102+ my(@filestat) = stat $in;
103+ utime $filestat[8], $filestat[9], $out;
104+}
--- trunk/doc/convtext.bat (revision 9664)
+++ trunk/doc/convtext.bat (revision 9665)
@@ -1,4 +1,4 @@
1-set TOSJIS=perl ..\installer\2sjis.pl
1+set TOSJIS=perl 2sjis.pl
22 set REF_E=en\html\reference
33 set REF_J=ja\html\reference
44 %TOSJIS% -i ..\libs\oniguruma\COPYING -o %REF_E%\Oniguruma-LICENSE.txt -l unix
--- trunk/installer/2sjis.pl (revision 9664)
+++ trunk/installer/2sjis.pl (nonexistent)
@@ -1,104 +0,0 @@
1-#!/usr/bin/perl -w
2-
3-require 5.24.0;
4-use strict;
5-use warnings;
6-use Encode;
7-use utf8;
8-use Getopt::Long qw(:config posix_default no_ignore_case gnu_compat);
9-
10-my $PERL = $^X;
11-
12-sub MarkdownToHTML {
13- my $buf = $_[0];
14-
15- my $cmd = "$PERL Markdown_1.0.1/Markdown.pl";
16-# my $cmd = 'cat';
17-
18- my $out_file = "MD_TO_HTML_$$" . "_md";
19- my $in_file = "MD_TO_HTML_$$" . "_html";
20-
21- my $OUT;
22- open ($OUT, ">:unix:encoding(utf8)", $out_file) or die("error :$! $out_file");
23- print $OUT $buf;
24- close $OUT;
25-
26- my $sys = "$cmd < $out_file > $in_file";
27- my $r = system($sys);
28- if ($r != 0) {
29- print "r=$r\n";
30- exit($r);
31- # Can't spawn "cmd.exe" ... -> check $PATH
32- }
33-
34- my $IN;
35- open ($IN, "<:crlf:encoding(utf8)", $in_file) or die("error :$! $in_file");
36- $buf = join "", <$IN>;
37- close $IN;
38-
39- unlink $in_file;
40- unlink $out_file;
41-
42- $buf;
43-}
44-
45-binmode STDOUT, ":utf8";
46-
47-my($in, $out, $result);
48-
49-# default setting
50-my $coding = "shiftjis";
51-my $lf = "crlf";
52-my $type = "text";
53-my $zlib_special;
54-
55-$result = GetOptions('in|i=s' => \$in,
56- 'out|o=s' => \$out,
57- 'coding|c=s' => \$coding,
58- 'lf|l=s' => \$lf,
59- 'type|t=s' => \$type,
60- 'zlib_special' => \$zlib_special);
61-
62-if (!(defined($in) && defined($out))) {
63- die "Usage: $0 --in file --out file [ --coding input_encoding ] [ --lf line_format ] [ --type type ]\n";
64-}
65-
66-if ($in =~/\.md/) {
67- $type = "markdown";
68- $coding = "utf8";
69-}
70-
71-my $IN;
72-if ($in eq "-") {
73- binmode STDIN, ":$lf:encoding($coding)";
74- $IN = *STDIN;
75-} else {
76- open ($IN, "<:$lf:encoding($coding)", $in) or die("error :$! $in");
77-}
78-if ($zlib_special) {
79- while (<$IN>) {
80- last if $_ =~ /Copyright notice:/;
81- }
82-}
83-my $buf = join "", <$IN>;
84-$buf =~ s/\x{FEFF}//g; # remove all bom
85-close $IN;
86-
87-if ($type =~ /markdown/i ) {
88- $buf = &MarkdownToHTML($buf);
89-}
90-
91-my $OUT;
92-if ($out eq "-") {
93- binmode STDOUT, ":crlf:encoding(shiftjis)";
94- $OUT = *STDOUT;
95-} else {
96- open ($OUT, '>:crlf:encoding(shiftjis)', $out);
97-}
98-print $OUT $buf;
99-close $OUT;
100-
101-if ($in ne "-") {
102- my(@filestat) = stat $in;
103- utime $filestat[8], $filestat[9], $out;
104-}
Show on old repository browser