Skip to content

Commit fe3db78

Browse files
committed
Merge branch 'css-style'
2 parents 1788444 + 40930c2 commit fe3db78

File tree

4 files changed

+98
-7
lines changed

4 files changed

+98
-7
lines changed

tutorial.css

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,86 @@
1+
body {
2+
font-size: 1em;
3+
}
4+
5+
h1, h2, h3, h4, h5, h6 {
6+
border-bottom: 1px solid #aaa;
7+
padding-top: .5em;
8+
padding-bottom: .17em;
9+
margin: 0;
10+
}
11+
12+
ul {
13+
line-height: 1.4em;
14+
}
15+
li {
16+
margin-bottom: .1em;
17+
}
18+
19+
h1.page-title {
20+
margin-top: 0;
21+
margin-bottom: .1em;
22+
line-height: 1.2em;
23+
padding-bottom: 0;
24+
}
25+
26+
article h1 {
27+
margin-bottom: .6em;
28+
font-size: 150%;
29+
}
30+
31+
code {
32+
font-family: monospace,Courier;
33+
color: black;
34+
font-size: .9em;
35+
background-color: #eee;
36+
padding: 0 2px;
37+
}
38+
39+
.content {
40+
padding: 1.5em;
41+
}
42+
43+
code.block {
44+
display: block;
45+
line-height: 1.3em;
46+
padding: 1em;
47+
border: 1px dashed #2f6fab;
48+
margin: 1em 0px;
49+
background-color: #f9f9f9;
50+
}
51+
52+
@media screen {
53+
@font-face{font-family:'Octicons Regular';src:url("https://a248.e.akamai.net/assets.github.com/assets/octicons/octicons-regular-webfont-a20448aa13cf370506c8a675c4fc0efba750115c.eot");src:url("https://a248.e.akamai.net/assets.github.com/assets/octicons/octicons-regular-webfont-a20448aa13cf370506c8a675c4fc0efba750115c.eot#iefix") format("embedded-opentype"),url("https://a248.e.akamai.net/assets.github.com/assets/octicons/octicons-regular-webfont-46d3d8ac303cad13c0b2006f8e8149a472d9d4e5.woff") format("woff"),url("https://a248.e.akamai.net/assets.github.com/assets/octicons/octicons-regular-webfont-93f33ad81ec64b5f0980ad57a53cf82e8445cab9.ttf") format("truetype"),url("https://a248.e.akamai.net/assets.github.com/assets/octicons/octicons-regular-webfont-f963ccb8f0402b76e11107147fe5b2e275319280.svg#newFontRegular") format("svg");font-weight:normal;font-style:normal}
54+
55+
.toc {
56+
width: 190px;
57+
border: 1px solid #aaa;
58+
background-color: #f9f9f9;
59+
padding: 5px;
60+
font-size: 95%;
61+
position: fixed; left: 10px; top: 100px;
62+
}
63+
.toc ul {
64+
padding-left: 24px;
65+
}
66+
.content {
67+
margin-left: 200px;
68+
}
69+
70+
.content .con-title .anchor {
71+
opacity: 0;
72+
font-family: 'Octicons Regular';
73+
color: blue; text-decoration: none; font-size: .8em;
74+
}
75+
.content .con-title:hover .anchor {
76+
opacity: 1;
77+
}
78+
.content .con-title:target .anchor {
79+
opacity: 1;
80+
color: red;
81+
}
82+
}
83+
184
div.thumb img.thumbimage {
285
background-color: #FFFFFF;
386
}

utils/gen-html-index-cn.pl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
二十
1919
);
2020

21-
my @infiles = @ARGV;
22-
2321
my $res = <<_EOC_;
2422
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh" lang="zh">
2523
<head>

utils/gen-html-index-en.pl

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
20
1919
);
2020

21-
my @infiles = @ARGV;
22-
2321
my $res = <<_EOC_;
2422
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
2523
<head>
@@ -42,7 +40,8 @@
4240
4341
</script>
4442
</head>
45-
<body><h2>agentzh's Nginx Tutorials (version $ver)</h2>
43+
<body><h1 class="page-title">agentzh's Nginx Tutorials (version $ver)</h1>
44+
<section class="toc">
4645
<h3>Table of Contents</h3>
4746
_EOC_
4847

@@ -87,14 +86,23 @@
8786
}
8887

8988
$res .= "</ul>\n";
89+
$res .= "</section>\n";
90+
91+
$res .= "<section class=\"content\">\n";
9092

9193
for my $infile (@ARGV) {
9294
open my $in, $infile
9395
or die "Cannot open $infile for reading: $!\n";
94-
$res .= do { local $/; <$in> };
96+
$res .= "<article>\n";
97+
my $c = do { local $/; <$in> };
98+
$c =~ s/<(h[1-6]) id="([^"]+)">(.+?)<\/\1>/<$1 class="con-title" id="$2">$3 <a class="anchor" href="#$2">&#61532;<\/a><\/$1>/g;
99+
$res .= $c;
100+
$res .= "</article>\n";
95101
close $in;
96102
}
97103

104+
$res .= "</section>\n";
105+
98106
$res .= "</body></html>";
99107

100108
if ($outfile) {

utils/wiki2html-en.pl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ sub fmt_para {
144144

145145
if (/^<geshi/) {
146146
$ctx->{code} = 1;
147-
return "<code>";
147+
return "<code class=\"block\">";
148148
}
149149

150150
if (m{^</geshi>}) {
@@ -253,6 +253,8 @@ sub fmt_html {
253253

254254
sub fmt_code {
255255
my $s = shift;
256+
# new template do not need the space indent
257+
$s =~ s/^ {4}//g;
256258
$s = fmt_html($s);
257259
$s =~ s{\n}{<br/>\n}sg;
258260
$s;

0 commit comments

Comments
 (0)