diff --git a/ebooks.mk b/ebooks.mk index 87cbb3f..663d56c 100644 --- a/ebooks.mk +++ b/ebooks.mk @@ -25,16 +25,15 @@ html: $(name).html %.pdf: $(name).html cp tutorial-simple.css tutorial.css ebook-convert $< $@ \ - --margin-bottom 25 \ - --margin-top 25 \ - --margin-left 20 \ - --margin-right 20 \ + --margin-bottom 5 \ + --margin-top 5 \ + --margin-left 5 \ + --margin-right 5 \ --no-chapters-in-toc \ --book-producer 'agentzh' \ - --pdf-default-font-size 1 \ - --pdf-mono-font-size 1 \ - --paper-size a4 \ - --output-profile kindle \ + --pdf-default-font-size 12 \ + --pdf-mono-font-size 12 \ + --paper-size letter \ --title "$(title)" --publisher 'agentzh' \ --language $(lang2) --authors 'agentzh' git co tutorial.css diff --git a/en/01-NginxVariables01.tut b/en/01-NginxVariables01.tut index d8d0381..fc45645 100644 --- a/en/01-NginxVariables01.tut +++ b/en/01-NginxVariables01.tut @@ -183,7 +183,7 @@ around the variable name (excluding the C<$> prefix), as in C<${first}>. Let's test this sample: :bash - $ curl 'http://localhost:8080/test + $ curl 'http://localhost:8080/test' hello world == Variable Declaration and Creation == diff --git a/en/01-NginxVariables02.tut b/en/01-NginxVariables02.tut index 1b076cc..a0bebeb 100644 --- a/en/01-NginxVariables02.tut +++ b/en/01-NginxVariables02.tut @@ -97,7 +97,7 @@ request being processed, and is irrelevant to C. The Nginx variables we have seen so far are all (implicitly) created by directives like L. We usually call such variables "user-defined -varaibles", or simply "user variables". There is also another kind of Nginx +variables", or simply "user variables". There is also another kind of Nginx variables that are I by either the Nginx core or Nginx modules. Let's call this kind of variables "built-in variables". diff --git a/en/01-NginxVariables05.tut b/en/01-NginxVariables05.tut index 46dba1c..f279e23 100644 --- a/en/01-NginxVariables05.tut +++ b/en/01-NginxVariables05.tut @@ -5,7 +5,7 @@ === A Detour to Subrequests === We have seen earlier that the lifetime of variable containers is bound to the -request, but I own you a formal definition of "requests" there. You might have +request, but I owe you a formal definition of "requests" there. You might have assumed that the "requests" in that context are just those HTTP requests initiated from the client side. In fact, there are two kinds of "requests" in the Nginx world. One is called "main requests", and the other is called diff --git a/en/01-NginxVariables08.tut b/en/01-NginxVariables08.tut index 55df923..e600d51 100644 --- a/en/01-NginxVariables08.tut +++ b/en/01-NginxVariables08.tut @@ -135,7 +135,7 @@ is requested: :bash - $ curl 'http://localhost:8080/test?names=Tom,Jim,Bob + $ curl 'http://localhost:8080/test?names=Tom,Jim,Bob' [Tom] [Jim] [Bob] Clearly module L make it easier to handle inputs with variable diff --git a/en/02-NginxDirectiveExecOrder01.tut b/en/02-NginxDirectiveExecOrder01.tut index e95b558..71dd83c 100644 --- a/en/02-NginxDirectiveExecOrder01.tut +++ b/en/02-NginxDirectiveExecOrder01.tut @@ -24,7 +24,7 @@ variable C<$a> has been reset after command L "is executed". Really? the reality is: :bash - $ curl 'http://localhost:8080/test + $ curl 'http://localhost:8080/test' 56 56 diff --git a/utils/gen-html-index-cn.pl b/utils/gen-html-index-cn.pl index 936d37f..a989a24 100755 --- a/utils/gen-html-index-cn.pl +++ b/utils/gen-html-index-cn.pl @@ -1,6 +1,7 @@ #!/usr/bin/env perl -use encoding 'utf8'; +use v5.10.1; +use utf8; use strict; use warnings; @@ -85,7 +86,7 @@ $res .= "\n"; for my $infile (@ARGV) { - open my $in, $infile + open my $in, "<:encoding(utf-8)", $infile or die "Cannot open $infile for reading: $!\n"; $res .= do { local $/; <$in> }; close $in; @@ -94,7 +95,7 @@ $res .= ""; if ($outfile) { - open my $out, ">:encoding(UTF-8)", $outfile + open my $out, ">:encoding(utf-8)", $outfile or die "Cannot open $outfile for writing: $!\n"; print $out $res; diff --git a/utils/gen-html-index-en.pl b/utils/gen-html-index-en.pl index 59ea7fc..06588fc 100755 --- a/utils/gen-html-index-en.pl +++ b/utils/gen-html-index-en.pl @@ -1,6 +1,7 @@ #!/usr/bin/env perl -use encoding 'utf8'; +use v5.10.1; +use utf8; use strict; use warnings; @@ -91,7 +92,7 @@ $res .= "
\n"; for my $infile (@ARGV) { - open my $in, $infile + open my $in, "<:encoding(utf-8)", $infile or die "Cannot open $infile for reading: $!\n"; $res .= "
\n"; my $c = do { local $/; <$in> }; diff --git a/utils/tut2wiki-cn.pl b/utils/tut2wiki-cn.pl index 145903b..0689855 100755 --- a/utils/tut2wiki-cn.pl +++ b/utils/tut2wiki-cn.pl @@ -1,8 +1,9 @@ #!/usr/bin/env perl +use v5.10.1; +use utf8; use strict; use warnings; -use encoding 'utf8'; use Getopt::Std; my %opts; @@ -36,7 +37,7 @@ my $infile = shift or usage(); -open my $in, "<:encoding(UTF-8)", $infile +open my $in, "<:encoding(utf-8)", $infile or die "cannot open $infile for reading: $!\n"; my $prev; @@ -74,7 +75,9 @@ close $in; -open $in, "<:encoding(UTF-8)", \$src; +utf8::encode($src); + +open $in, "<:encoding(utf-8)", \$src or die $!; my $wiki = ''; undef $prev; @@ -209,7 +212,7 @@ $wiki =~ s/^\s+|\s+$//sg; if ($outfile) { - open my $out, ">:encoding(UTF-8)", $outfile + open my $out, ">:encoding(utf-8)", $outfile or die "Cannot open $outfile for writing: $!\n"; print $out $wiki; @@ -225,4 +228,3 @@ sub usage { die "Usage: $0 [-o ] \n"; } - diff --git a/utils/tut2wiki-en.pl b/utils/tut2wiki-en.pl index 0288544..b90c5de 100755 --- a/utils/tut2wiki-en.pl +++ b/utils/tut2wiki-en.pl @@ -1,8 +1,9 @@ #!/usr/bin/env perl +use v5.10.1; +use utf8; use strict; use warnings; -use encoding 'utf8'; use Getopt::Std; my %opts; diff --git a/utils/wiki2html-cn.pl b/utils/wiki2html-cn.pl index cab37b6..5d3c66e 100755 --- a/utils/wiki2html-cn.pl +++ b/utils/wiki2html-cn.pl @@ -1,6 +1,7 @@ #!/usr/bin/env perl -use encoding 'utf8'; +use v5.10.1; +use utf8; use strict; use warnings; @@ -44,7 +45,7 @@ die "Bad input file $infile\n"; } -open my $in, "<:encoding(UTF-8)", $infile +open my $in, "<:encoding(utf-8)", $infile or die "Cannot open $infile for reading: $!\n"; my $ctx = {}; @@ -96,7 +97,7 @@ #$html .= " \n\n"; if ($outfile) { - open my $out, ">:encoding(UTF-8)", $outfile + open my $out, ">:encoding(utf-8)", $outfile or die "Cannot open $outfile for writing: $!\n"; print $out $html; @@ -232,4 +233,3 @@ sub fmt_code { sub usage { die "Usage: $0 [-o ] \n"; } - diff --git a/utils/wiki2html-en.pl b/utils/wiki2html-en.pl index b2fd679..51a5c68 100755 --- a/utils/wiki2html-en.pl +++ b/utils/wiki2html-en.pl @@ -1,6 +1,7 @@ #!/usr/bin/env perl -use encoding 'utf8'; +use v5.10.1; +use utf8; use strict; use warnings; diff --git a/zh-cn/01-NginxVariables01.tut b/zh-cn/01-NginxVariables01.tut index fc171eb..4742907 100644 --- a/zh-cn/01-NginxVariables01.tut +++ b/zh-cn/01-NginxVariables01.tut @@ -128,7 +128,7 @@ C<$> 字符给转义 名围起来,比如这里的 C<${first}>. 上面这个例子的输出是: :bash - $ curl 'http://localhost:8080/test + $ curl 'http://localhost:8080/test' hello world L 指令(以及前面提到的 L diff --git a/zh-cn/01-NginxVariables08.tut b/zh-cn/01-NginxVariables08.tut index 1670861..987b208 100644 --- a/zh-cn/01-NginxVariables08.tut +++ b/zh-cn/01-NginxVariables08.tut @@ -115,7 +115,7 @@ C 和 C 这三条配置指令,其含 : :bash - $ curl 'http://localhost:8080/test?names=Tom,Jim,Bob + $ curl 'http://localhost:8080/test?names=Tom,Jim,Bob' [Tom] [Jim] [Bob] 我们看到,使用 L 模块可以很方便地处理这样具有不 diff --git a/zh-cn/02-NginxDirectiveExecOrder01.tut b/zh-cn/02-NginxDirectiveExecOrder01.tut index 12f40b4..5543204 100644 --- a/zh-cn/02-NginxDirectiveExecOrder01.tut +++ b/zh-cn/02-NginxDirectiveExecOrder01.tut @@ -25,7 +25,7 @@ C<$a>. 然而不幸的是,事实并非如此: :bash - $ curl 'http://localhost:8080/test + $ curl 'http://localhost:8080/test' 56 56