madowu 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES +9 -3
- data/VERSION +1 -1
- data/bin/madowu +1 -0
- data/example/Rakefile +1 -1
- data/lib/madowu/htmlgenerator.rb +5 -3
- data/madowu.gemspec +2 -2
- data/test/test_htmlgenerator.rb +19 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 842434c81b4af71f9c00d84b50b2a73c390431ec
|
4
|
+
data.tar.gz: b787fd00346ef0fc5f825b28fbadf03640b7e4fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f467f49afb17e46c71e2ffaa50b617b3e55d5e7973e28b5553550376217ae9e6eecd48d0fc75bcd6bd1a6866d2fbc800395fd1435fc19f98864a0a5e479a7579
|
7
|
+
data.tar.gz: 93fd286befa44549ea9e76a0431ea28c40540a840dd133dd03966a9fc5ff46bfe668d541d352eca9ed86c579f4a950dd42211a4c2c1eab221e3c7f1f189a83b5
|
data/CHANGES
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
= THIS_GEM changelog
|
2
2
|
|
3
|
-
== Master (for 0.0.
|
3
|
+
== Master (for 0.0.3)
|
4
4
|
|
5
|
-
== Version 0.0.
|
6
|
-
|
5
|
+
== Version 0.0.2 [2015-10-20]
|
6
|
+
* Add -C (--charset) option and default encoding is set to be 'us-ascii'
|
7
|
+
|
8
|
+
== Version 0.0.1 [2015-10-20]
|
9
|
+
* Add ' ' into title in dirmap.
|
10
|
+
|
11
|
+
== Version 0.0.0 [2015-10-20]
|
12
|
+
First release.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
data/bin/madowu
CHANGED
@@ -18,6 +18,7 @@ op.banner = [
|
|
18
18
|
" You can see help with '#{File.basename("#{__FILE__}")} --help'.",
|
19
19
|
].join("\n")
|
20
20
|
op.on("-c css_file", "--css=file", "Indicate css file"){|v| OPTIONS[:css] = v}
|
21
|
+
op.on("-C charset", "--charset=str", "Indicate charset like 'UTF-8'"){|v| OPTIONS[:charset] = v}
|
21
22
|
op.on("-o" , "--outline" , "Embed outline"){ OPTIONS[:outline] = true}
|
22
23
|
op.on("-d" , "--dirmap-side", "Embed sideber of directory map"){OPTIONS[:dirmap] = true}
|
23
24
|
op.on("-s file" , "--side", "Read file for sidebar"){|v|OPTIONS[:sidebar] = v}
|
data/example/Rakefile
CHANGED
@@ -40,7 +40,7 @@ html_files.each do |html_file|
|
|
40
40
|
#file html_file => [md_file, dirmap] do
|
41
41
|
file html_file => [md_file, dirpath, dirpath.parent] do
|
42
42
|
#sh "madowu -o -s #{dirmap} -c madowu.css #{md_file}"
|
43
|
-
sh "madowu -o -d -c madowu.css #{md_file}"
|
43
|
+
sh "madowu -o -d -c madowu.css -C UTF-8 #{md_file}"
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
data/lib/madowu/htmlgenerator.rb
CHANGED
@@ -38,7 +38,7 @@ class Madowu::HtmlGenerator
|
|
38
38
|
end
|
39
39
|
|
40
40
|
result = [
|
41
|
-
make_header(options[:css]),
|
41
|
+
make_header(options[:css], options[:charset]),
|
42
42
|
@markup_lines,
|
43
43
|
"</div></div></body></html>",
|
44
44
|
''
|
@@ -77,16 +77,18 @@ class Madowu::HtmlGenerator
|
|
77
77
|
@markup_lines = outlines + new_lines
|
78
78
|
end
|
79
79
|
|
80
|
-
def make_header(css)
|
80
|
+
def make_header(css, charset)
|
81
81
|
#title = `grep -E '^#' #{@md_file} | head -n 1`.sub(/^#\s*/, '').strip
|
82
82
|
title = self.class.get_title(@md_file)
|
83
83
|
|
84
|
+
charset ||= 'us-ascii'
|
85
|
+
|
84
86
|
results = []
|
85
87
|
results << "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>"
|
86
88
|
results << "<HTML lang=\'ja\'>"
|
87
89
|
results << "<head>"
|
88
90
|
results << " <title>#{title}</title>"
|
89
|
-
results << " <meta http-equiv='Content-Type' content='text/html; charset
|
91
|
+
results << " <meta http-equiv='Content-Type' content='text/html; charset=#{charset}'>"
|
90
92
|
|
91
93
|
if css
|
92
94
|
if File.exist? css
|
data/madowu.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: madowu 0.0.
|
5
|
+
# stub: madowu 0.0.2 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "madowu"
|
9
|
-
s.version = "0.0.
|
9
|
+
s.version = "0.0.2"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
data/test/test_htmlgenerator.rb
CHANGED
@@ -24,7 +24,7 @@ class TC_HtmlGenerator < Test::Unit::TestCase
|
|
24
24
|
correct << "<HTML lang=\'ja\'>"
|
25
25
|
correct << "<head>"
|
26
26
|
correct << " <title></title>"
|
27
|
-
correct << " <meta http-equiv='Content-Type' content='text/html; charset=
|
27
|
+
correct << " <meta http-equiv='Content-Type' content='text/html; charset=us-ascii'>"
|
28
28
|
correct << "</head>"
|
29
29
|
correct << "<body>"
|
30
30
|
correct << "<div class='main'>"
|
@@ -35,6 +35,23 @@ class TC_HtmlGenerator < Test::Unit::TestCase
|
|
35
35
|
correct = correct.join("\n")
|
36
36
|
assert_equal( correct, @h00.generate)
|
37
37
|
|
38
|
+
# charset
|
39
|
+
correct = []
|
40
|
+
correct << "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>"
|
41
|
+
correct << "<HTML lang=\'ja\'>"
|
42
|
+
correct << "<head>"
|
43
|
+
correct << " <title></title>"
|
44
|
+
correct << " <meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>"
|
45
|
+
correct << "</head>"
|
46
|
+
correct << "<body>"
|
47
|
+
correct << "<div class='main'>"
|
48
|
+
correct << "<div class='body'>"
|
49
|
+
correct << ""
|
50
|
+
correct << "</div></div></body></html>"
|
51
|
+
correct << ""
|
52
|
+
correct = correct.join("\n")
|
53
|
+
assert_equal( correct, @h00.generate({:charset => "UTF-8"}))
|
54
|
+
|
38
55
|
|
39
56
|
h04 = Madowu::HtmlGenerator.new("test/subdir/empty.md")
|
40
57
|
options = {:css => "test/test.css"}
|
@@ -43,7 +60,7 @@ class TC_HtmlGenerator < Test::Unit::TestCase
|
|
43
60
|
correct << "<HTML lang=\'ja\'>"
|
44
61
|
correct << "<head>"
|
45
62
|
correct << " <title></title>"
|
46
|
-
correct << " <meta http-equiv='Content-Type' content='text/html; charset=
|
63
|
+
correct << " <meta http-equiv='Content-Type' content='text/html; charset=us-ascii'>"
|
47
64
|
correct << " <link rel='stylesheet' type='text/css' href='../test.css' media='all'>"
|
48
65
|
correct << "</head>"
|
49
66
|
correct << "<body>"
|