From: Nishi <nishi@nishi.boats>
Date: Mon, 30 Sep 2024 15:33:36 +0000 (+0000)
Subject: add favicon
X-Git-Url: http://10.11.0.4:5575/?a=commitdiff_plain;h=824bfe494d3384350b0dd54766190d83287a32b4;p=docgen.git

add favicon

git-svn-id: file:///raid/svn-personal/docgen/trunk@9 44bc13e5-44cb-984e-b856-1907bf1ada44
---

diff --git a/docgen b/docgen
index 8d179dd..3ce787e 100755
--- a/docgen
+++ b/docgen
@@ -26,6 +26,7 @@ set input_directory ""
 set output_directory ""
 set title ""
 set icon ""
+set favicon ""
 set icon_height 0
 set footer ""
 set links ""
@@ -45,10 +46,18 @@ if { "$title" == "" } {
 	exit 1
 }
 
+if { "$icon" != "" && "$favicon" == "" } {
+	set favicon "$icon"
+}
+
 if { "$icon" != "" && ![file exists "$icon"] } {
 	puts "Icon $icon does not exist"
 	exit 1
 }
+if { "$favicon" != "" && ![file exists "$favicon"] } {
+	puts "Favicon $favicon does not exist"
+	exit 1
+}
 
 if { "$links" != "" } {
 	set links " | $links"
@@ -59,15 +68,15 @@ set genre_list {}
 puts "Docgen version $DOCGEN_VERSION"
 
 proc start_html {fid title toc dots} {
-	global links icon
+	global links favicon icon
 	puts $fid "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">"
 	puts $fid "<html>"
 	puts $fid "	<head>"
 	puts $fid "		<meta http-equiv=\"Content-Type\" content=\"text/html;charset=UTF-8\">"
 	puts $fid "		<title>$title</title>"
 	puts $fid "		<link rel=\"stylesheet\" href=\"$dots/style.css\">"
-	if { "$icon" != "" } {
-		puts $fid "		<link rel=\"icon\" href=\"$dots/[file tail "$icon"]\">"
+	if { "$favicon" != "" } {
+		puts $fid "		<link rel=\"icon\" href=\"$dots/[file tail "$favicon"]\">"
 	}
 	puts $fid "	</head>"
 	puts $fid "	<body>"
@@ -257,6 +266,10 @@ if { "$icon" != "" } {
 	file copy -force "$icon" "$output_directory/[file tail "$icon"]"
 }
 
+if { "$favicon" != "" } {
+	file copy -force "$favicon" "$output_directory/[file tail "$favicon"]"
+}
+
 set fid [open "$output_directory/style.css" "w"]
 
 set COLOR_PURPLE "#600060"
@@ -301,6 +314,7 @@ puts $fid "#toc {"
 puts $fid "	float: right;"
 puts $fid "	width: 13em;"
 puts $fid "	background-color: $COLOR_LIGHTGRAY;"
+puts $fid "	margin-bottom: 1em;"
 puts $fid "}"
 puts $fid "pre {"
 puts $fid "	background-color: $COLOR_LIGHTGRAY;"
@@ -326,6 +340,7 @@ puts $fid "	padding-left: 30px;"
 puts $fid "}"
 puts $fid "hr {"
 puts $fid "	border: solid 1px $COLOR_TEXT;"
+puts $fid "	clear: both;"
 puts $fid "}"
 puts $fid "h2 {"
 puts $fid "	font-size: 20px;"
diff --git a/example/docgen.conf b/example/docgen.conf
index b083dd3..1e6b6f6 100644
--- a/example/docgen.conf
+++ b/example/docgen.conf
@@ -4,6 +4,8 @@ set input_directory "input"
 set output_directory "output"
 set title "Example Project"
 set icon "icon.png"
+set favicon "favicon.png"
 set footer "Some good footer"
 set links "<a href=\"http://nishi.boats\">nishi.boats</a>"
 set icon_height 96
+set languages {jp en}
diff --git a/example/favicon.png b/example/favicon.png
new file mode 100644
index 0000000..0cd6a44
Binary files /dev/null and b/example/favicon.png differ