Browse files

Merge branch 'css-style'

  • Loading branch information...
2 parents 1788444 + 40930c2 commit fe3db782f55ceb8a10cd08ce439072250091d54c @agentzh agentzh committed Mar 10, 2013
Showing with 98 additions and 7 deletions.
  1. +83 −0 tutorial.css
  2. +0 −2 utils/gen-html-index-cn.pl
  3. +12 −4 utils/gen-html-index-en.pl
  4. +3 −1 utils/wiki2html-en.pl
View
83 tutorial.css
@@ -1,3 +1,86 @@
+body {
+ font-size: 1em;
+}
+
+h1, h2, h3, h4, h5, h6 {
+ border-bottom: 1px solid #aaa;
+ padding-top: .5em;
+ padding-bottom: .17em;
+ margin: 0;
+}
+
+ul {
+ line-height: 1.4em;
+}
+li {
+ margin-bottom: .1em;
+}
+
+h1.page-title {
+ margin-top: 0;
+ margin-bottom: .1em;
+ line-height: 1.2em;
+ padding-bottom: 0;
+}
+
+article h1 {
+ margin-bottom: .6em;
+ font-size: 150%;
+}
+
+code {
+ font-family: monospace,Courier;
+ color: black;
+ font-size: .9em;
+ background-color: #eee;
+ padding: 0 2px;
+}
+
+.content {
+ padding: 1.5em;
+}
+
+code.block {
+ display: block;
+ line-height: 1.3em;
+ padding: 1em;
+ border: 1px dashed #2f6fab;
+ margin: 1em 0px;
+ background-color: #f9f9f9;
+}
+
+@media screen {
+ @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}
+
+ .toc {
+ width: 190px;
+ border: 1px solid #aaa;
+ background-color: #f9f9f9;
+ padding: 5px;
+ font-size: 95%;
+ position: fixed; left: 10px; top: 100px;
+ }
+ .toc ul {
+ padding-left: 24px;
+ }
+ .content {
+ margin-left: 200px;
+ }
+
+ .content .con-title .anchor {
+ opacity: 0;
+ font-family: 'Octicons Regular';
+ color: blue; text-decoration: none; font-size: .8em;
+ }
+ .content .con-title:hover .anchor {
+ opacity: 1;
+ }
+ .content .con-title:target .anchor {
+ opacity: 1;
+ color: red;
+ }
+}
+
div.thumb img.thumbimage {
background-color: #FFFFFF;
}
View
2 utils/gen-html-index-cn.pl
@@ -18,8 +18,6 @@
二十
);
-my @infiles = @ARGV;
-
my $res = <<_EOC_;
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh" lang="zh">
<head>
View
16 utils/gen-html-index-en.pl
@@ -18,8 +18,6 @@
20
);
-my @infiles = @ARGV;
-
my $res = <<_EOC_;
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
@@ -42,7 +40,8 @@
</script>
</head>
- <body><h2>agentzh's Nginx Tutorials (version $ver)</h2>
+ <body><h1 class="page-title">agentzh's Nginx Tutorials (version $ver)</h1>
+ <section class="toc">
<h3>Table of Contents</h3>
_EOC_
@@ -87,14 +86,23 @@
}
$res .= "</ul>\n";
+$res .= "</section>\n";
+
+$res .= "<section class=\"content\">\n";
for my $infile (@ARGV) {
open my $in, $infile
or die "Cannot open $infile for reading: $!\n";
- $res .= do { local $/; <$in> };
+ $res .= "<article>\n";
+ my $c = do { local $/; <$in> };
+ $c =~ s/<(h[1-6]) id="([^"]+)">(.+?)<\/\1>/<$1 class="con-title" id="$2">$3 <a class="anchor" href="#$2">&#61532;<\/a><\/$1>/g;
+ $res .= $c;
+ $res .= "</article>\n";
close $in;
}
+$res .= "</section>\n";
+
$res .= "</body></html>";
if ($outfile) {
View
4 utils/wiki2html-en.pl
@@ -144,7 +144,7 @@ sub fmt_para {
if (/^<geshi/) {
$ctx->{code} = 1;
- return "<code>";
+ return "<code class=\"block\">";
}
if (m{^</geshi>}) {
@@ -253,6 +253,8 @@ sub fmt_html {
sub fmt_code {
my $s = shift;
+ # new template do not need the space indent
+ $s =~ s/^ {4}//g;
$s = fmt_html($s);
$s =~ s{\n}{<br/>\n}sg;
$s;

0 comments on commit fe3db78

Please sign in to comment.