From 730f175cb742ac4b79207f0c8b25eef2b9da1f07 Mon Sep 17 00:00:00 2001 From: Martin Date: Mon, 25 Dec 2017 12:20:22 +0800 Subject: [PATCH 1/5] nginx vars: Nginx Variables (05): a typo fix. Signed-off-by: Yichun Zhang (agentzh) --- en/01-NginxVariables05.tut | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 5e044d0dc61fe17a80cda7ee384235a777f6154f Mon Sep 17 00:00:00 2001 From: "Yichun Zhang (agentzh)" Date: Wed, 31 Jul 2019 10:08:07 -0700 Subject: [PATCH 2/5] fixed utf8 handling for recent versions of perl. --- ebooks.mk | 1 - utils/gen-html-index-cn.pl | 7 ++++--- utils/gen-html-index-en.pl | 5 +++-- utils/tut2wiki-cn.pl | 7 ++++--- utils/tut2wiki-en.pl | 3 ++- utils/wiki2html-cn.pl | 5 +++-- utils/wiki2html-en.pl | 3 ++- 7 files changed, 18 insertions(+), 13 deletions(-) diff --git a/ebooks.mk b/ebooks.mk index 88a488f..e7307c9 100644 --- a/ebooks.mk +++ b/ebooks.mk @@ -25,7 +25,6 @@ html: $(name).html %.pdf: $(name).html cp tutorial-simple.css tutorial.css ebook-convert $< $@ \ - --override-profile-size \ --margin-bottom 10 \ --margin-top 10 \ --margin-left 10 \ 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 ca6899f..0689855 100755 --- a/utils/tut2wiki-cn.pl +++ b/utils/tut2wiki-cn.pl @@ -1,5 +1,6 @@ #!/usr/bin/env perl +use v5.10.1; use utf8; use strict; use warnings; @@ -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; @@ -76,7 +77,7 @@ utf8::encode($src); -open $in, "<:encoding(UTF-8)", \$src or die $!; +open $in, "<:encoding(utf-8)", \$src or die $!; my $wiki = ''; undef $prev; @@ -211,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; 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 b5f98f9..5d3c66e 100755 --- a/utils/wiki2html-cn.pl +++ b/utils/wiki2html-cn.pl @@ -1,5 +1,6 @@ #!/usr/bin/env perl +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; 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; From 014f8d3975e3776b69588eda5a5f4d540733bd7e Mon Sep 17 00:00:00 2001 From: "Yichun Zhang (agentzh)" Date: Thu, 19 Mar 2020 12:09:22 -0700 Subject: [PATCH 3/5] ebook: minor tweaks for the pdf output. --- ebooks.mk | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ebooks.mk b/ebooks.mk index e7307c9..663d56c 100644 --- a/ebooks.mk +++ b/ebooks.mk @@ -25,15 +25,15 @@ html: $(name).html %.pdf: $(name).html cp tutorial-simple.css tutorial.css ebook-convert $< $@ \ - --margin-bottom 10 \ - --margin-top 10 \ - --margin-left 10 \ - --margin-right 10 \ + --margin-bottom 5 \ + --margin-top 5 \ + --margin-left 5 \ + --margin-right 5 \ --no-chapters-in-toc \ --book-producer 'agentzh' \ --pdf-default-font-size 12 \ --pdf-mono-font-size 12 \ - --paper-size a4 \ + --paper-size letter \ --title "$(title)" --publisher 'agentzh' \ --language $(lang2) --authors 'agentzh' git co tutorial.css From e6c57a5b107f9e534a38a04cb5820bd0c0d04d21 Mon Sep 17 00:00:00 2001 From: imba-tjd <109224573@qq.com> Date: Thu, 19 Mar 2020 22:01:14 +0800 Subject: [PATCH 4/5] Added missing apostrophe --- en/01-NginxVariables01.tut | 2 +- en/02-NginxDirectiveExecOrder01.tut | 2 +- zh-cn/01-NginxVariables01.tut | 2 +- zh-cn/02-NginxDirectiveExecOrder01.tut | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) 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/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/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/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 From 9f7242b60f9f95bd840ec54388f83a17e3407ee3 Mon Sep 17 00:00:00 2001 From: Daniel Rafaj Date: Thu, 21 Jan 2021 11:20:50 +0100 Subject: [PATCH 5/5] doc: varaibles -> variables - fixed typo. (#19) --- en/01-NginxVariables02.tut | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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".