madowu 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,74 @@
1
+ #! /usr/bin/env ruby
2
+ # coding: utf-8
3
+
4
+ require 'pp'
5
+ #Amazon::Ecs.debug = true
6
+
7
+ #
8
+ #
9
+ #
10
+ class Madowu::Isbn
11
+
12
+ ROOT_KEY_FILE = ENV['HOME'] + '/.aws/rootkey.csv'
13
+ ASSOCIATEID_FILE = ENV['HOME'] + '/.aws/associateid'
14
+
15
+ class AccountFileError < StandardError; end
16
+
17
+ #
18
+ def initialize(isbn)
19
+ @isbn = isbn
20
+ [ROOT_KEY_FILE, ASSOCIATEID_FILE].each do |file|
21
+ raise AccountFileError, "Not found #{file}" unless File.exist? file
22
+ end
23
+
24
+ hash = {}
25
+ hash[:associate_tag] = File.open(ASSOCIATEID_FILE, 'r').gets.chomp
26
+ File.open(ROOT_KEY_FILE, 'r').readlines.each do |i|
27
+ /(.*)=(.*)/ =~ i
28
+ key, val = $1, $2
29
+ hash[:AWS_access_key_id] = val.chomp if key == 'AWSAccessKeyId'
30
+ hash[:AWS_secret_key] = val.chomp if key == 'AWSSecretKey'
31
+ end
32
+
33
+ Amazon::Ecs.options = hash
34
+ #pp Amazon::Ecs.options
35
+ #exit
36
+
37
+ @info = Amazon::Ecs.item_search(
38
+ isbn,
39
+ {:search_index => 'Books', :response_group => 'Medium', :country => 'jp'}
40
+ )
41
+ #pp @info
42
+ #exit
43
+ end
44
+
45
+ def title
46
+ @info.items.each { |item| return item.get('ItemAttributes/Title') }
47
+ end
48
+
49
+ def author
50
+ @info.items.each { |item| return item.get('ItemAttributes/Author') }
51
+ end
52
+
53
+ def isbn
54
+ @info.items.each { |item| return item.get('ItemAttributes/ISBN') }
55
+ end
56
+
57
+ def publisher
58
+ @info.items.each { |item| return item.get('ItemAttributes/Publisher') }
59
+ end
60
+
61
+ def publication_date
62
+ @info.items.each { |item| return item.get('ItemAttributes/PublicationDate') }
63
+ end
64
+
65
+ def url
66
+ @info.items.each { |item| return item.get('DetailPageURL') }
67
+ end
68
+
69
+ def img_url
70
+ @info.items.each { |item| return item.get('SmallImage/URL') }
71
+ end
72
+
73
+ end
74
+
data/lib/madowu.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  module Madowu; end
2
2
 
3
+ require 'pathname'
4
+ require 'amazon/ecs'
3
5
  require 'madowu/htmlgenerator.rb'
4
6
  require 'madowu/directorymapper.rb'
5
- require 'pathname'
7
+ require 'madowu/isbn.rb'
data/madowu.gemspec CHANGED
@@ -2,19 +2,19 @@
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.3 ruby lib
5
+ # stub: madowu 0.0.4 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "madowu"
9
- s.version = "0.0.3"
9
+ s.version = "0.0.4"
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"]
13
13
  s.authors = ["ippei94da"]
14
- s.date = "2016-02-26"
14
+ s.date = "2016-04-23"
15
15
  s.description = "Markdown to HTML with table of contents, sidebar to neighboring directories."
16
16
  s.email = "ippei94da@gmail.com"
17
- s.executables = ["dirmap", "madowu", "tex2image"]
17
+ s.executables = ["dirmap", "isbninfo", "madowu", "tex2image", "urltitle"]
18
18
  s.extra_rdoc_files = [
19
19
  "LICENSE.txt",
20
20
  "README.rdoc"
@@ -28,19 +28,19 @@ Gem::Specification.new do |s|
28
28
  "Rakefile",
29
29
  "VERSION",
30
30
  "bin/dirmap",
31
+ "bin/isbninfo",
31
32
  "bin/madowu",
32
33
  "bin/tex2image",
33
- "doc/.dirmap.md",
34
- "doc/.gitignore",
35
- "doc/Rakefile",
36
- "doc/index.md",
37
- "doc/madowu.css",
34
+ "bin/urltitle",
38
35
  "example/.gitignore",
39
36
  "example/Rakefile",
37
+ "example/dot.aws/associateid",
38
+ "example/dot.aws/rootkey.csv",
40
39
  "example/enum.md",
41
40
  "example/eq.tex",
42
41
  "example/heading.md",
43
42
  "example/index.md",
43
+ "example/isbn.md",
44
44
  "example/list.md",
45
45
  "example/madowu.css",
46
46
  "example/subdir/Rakefile",
@@ -49,14 +49,24 @@ Gem::Specification.new do |s|
49
49
  "example/subdir/subdir2/Rakefile",
50
50
  "example/subdir/subdir2/index.md",
51
51
  "example/subdir/subdir2/madowu.css",
52
+ "example/template/.gitignore",
53
+ "example/template/Rakefile",
54
+ "example/template/index.md",
55
+ "example/template/madowu.css",
52
56
  "example/tex2image/.gitignore",
53
57
  "example/tex2image/eq.tex",
58
+ "example/urltitle/Rakefile",
59
+ "example/urltitle/index.md",
60
+ "example/urltitle/madowu.css",
61
+ "example/urltitle/url.dat",
54
62
  "lib/madowu.rb",
55
63
  "lib/madowu/directorymapper.rb",
56
64
  "lib/madowu/htmlgenerator.rb",
65
+ "lib/madowu/isbn.rb",
57
66
  "madowu.gemspec",
58
67
  "test/directorymapper/.gitignore",
59
68
  "test/directorymapper/dir1/foo.md",
69
+ "test/directorymapper/dir2/bar.txt",
60
70
  "test/directorymapper/dir2/dir/index.md",
61
71
  "test/directorymapper/dir2/foo.md",
62
72
  "test/directorymapper/dir2/index.html",
@@ -67,16 +77,18 @@ Gem::Specification.new do |s|
67
77
  "test/empty.md",
68
78
  "test/head.md",
69
79
  "test/head1.md",
80
+ "test/head_pandoc.md",
70
81
  "test/helper.rb",
71
82
  "test/subdir/empty.md",
72
83
  "test/test.css",
73
84
  "test/test_directorymapper.rb",
74
85
  "test/test_htmlgenerator.rb",
86
+ "test/test_isbn.rb",
75
87
  "test/test_madowu.rb"
76
88
  ]
77
89
  s.homepage = "http://github.com/ippei94da/madowu"
78
90
  s.licenses = ["MIT"]
79
- s.rubygems_version = "2.2.2"
91
+ s.rubygems_version = "2.5.1"
80
92
  s.summary = "Madowu, MArkDOWn to markUp, to build html"
81
93
 
82
94
  if s.respond_to? :specification_version then
@@ -88,12 +100,14 @@ Gem::Specification.new do |s|
88
100
  s.add_development_dependency(%q<bundler>, ["~> 1.11"])
89
101
  s.add_development_dependency(%q<jeweler>, ["~> 2.0"])
90
102
  s.add_development_dependency(%q<simplecov>, ["~> 0.11"])
103
+ s.add_development_dependency(%q<amazon-ecs>, ["~> 2.4"])
91
104
  else
92
105
  s.add_dependency(%q<test-unit>, ["~> 3.1"])
93
106
  s.add_dependency(%q<rdoc>, ["~> 4.2"])
94
107
  s.add_dependency(%q<bundler>, ["~> 1.11"])
95
108
  s.add_dependency(%q<jeweler>, ["~> 2.0"])
96
109
  s.add_dependency(%q<simplecov>, ["~> 0.11"])
110
+ s.add_dependency(%q<amazon-ecs>, ["~> 2.4"])
97
111
  end
98
112
  else
99
113
  s.add_dependency(%q<test-unit>, ["~> 3.1"])
@@ -101,6 +115,7 @@ Gem::Specification.new do |s|
101
115
  s.add_dependency(%q<bundler>, ["~> 1.11"])
102
116
  s.add_dependency(%q<jeweler>, ["~> 2.0"])
103
117
  s.add_dependency(%q<simplecov>, ["~> 0.11"])
118
+ s.add_dependency(%q<amazon-ecs>, ["~> 2.4"])
104
119
  end
105
120
  end
106
121
 
File without changes
@@ -0,0 +1 @@
1
+ <h1 id="section">pandoc</h1>
@@ -133,54 +133,18 @@ class TC_HtmlGenerator < Test::Unit::TestCase
133
133
  @h02.embed_outline(true)
134
134
  assert_equal( correct, @h02.markup_lines)
135
135
 
136
- #correct = []
137
- #correct << "<div class='header'>"
138
- #correct << "<p>Outline:</p>"
139
- #correct << "<ul class='outline'>"
140
- #correct << " <li><a href='#0'>head1</a></ll>"
141
- #correct << " <li><a href='#1'> + head2</a></ll>"
142
- #correct << " <li><a href='#2'> + + head3</a></ll>"
143
- #correct << " <li><a href='#3'> + + + head4</a></ll>"
144
- #correct << " <li><a href='#4'> + + + + head5</a></ll>"
145
- #correct << " <li><a href='#5'> + + + + + head6</a></ll>"
146
- #correct << "</ul>"
147
- #correct << "</div>"
148
- #correct << "<h1><a name='0'>head1</a></h1>"
149
- #correct << ""
150
- #correct << "<p>line1</p>"
151
- #correct << ""
152
- #correct << "<h2><a name='1'>head2</a></h2>"
153
- #correct << ""
154
- #correct << "<p>line2</p>"
155
- #correct << ""
156
- #correct << "<h3><a name='2'>head3</a></h3>"
157
- #correct << ""
158
- #correct << "<p>line3</p>"
159
- #correct << ""
160
- #correct << "<h4><a name='3'>head4</a></h4>"
161
- #correct << ""
162
- #correct << "<p>line4</p>"
163
- #correct << ""
164
- #correct << "<h5><a name='4'>head5</a></h5>"
165
- #correct << ""
166
- #correct << "<p>line5</p>"
167
- #correct << ""
168
- #correct << "<h6><a name='5'>head6</a></h6>"
169
- #correct << ""
170
- #correct << "<p>line6</p>"
171
- #@h01.embed_outline
172
- #assert_equal( correct, @h01.markup_lines)
136
+ h03 = Madowu::HtmlGenerator.new("test/head_pandoc.md")
137
+ correct = []
138
+ correct << "<div class='header'>"
139
+ correct << "<p>Outline:</p>"
140
+ correct << "<ul>"
141
+ correct << '<li><a href="#0">pandoc</a></li>'
142
+ correct << "</ul>"
143
+ correct << "</div>"
144
+ correct << "<h1 id=\"section\"><a name='0' href='#0'>pandoc</a></h1>"
145
+ h03.embed_outline(true)
146
+ assert_equal( correct, h03.markup_lines)
173
147
 
174
- #correct = []
175
- #correct << "<div class='header'>"
176
- #correct << "<p>Outline:</p>"
177
- #correct << "<ul class='outline'>"
178
- #correct << " <li><a href='#0'>head1</a></ll>"
179
- #correct << "</ul>"
180
- #correct << "</div>"
181
- #correct << "<h1><a name='0' href='#0'>head1</a></h1>"
182
- #@h02.embed_outline(true)
183
- #assert_equal( correct, @h02.markup_lines)
184
148
  end
185
149
 
186
150
  def test_embed_sidebar
data/test/test_isbn.rb ADDED
@@ -0,0 +1,56 @@
1
+ #! /usr/bin/env ruby
2
+ # coding: utf-8
3
+
4
+ ## This test depends on Amazon Web Service...
5
+
6
+ require "pp"
7
+ require "helper"
8
+ #require "test/unit"
9
+ #require "pkg/klass.rb"
10
+
11
+
12
+ class Madowu::Isbn
13
+ attr_accessor :info
14
+ end
15
+
16
+ #I00 = Madowu::Isbn.new('479803925X')
17
+
18
+ class TC_Isbn < Test::Unit::TestCase
19
+ #def setup
20
+ # #@i00 = Madowu::Isbn.new('', 'test/isbn/479803925X.xml')
21
+ #end
22
+
23
+ #def test_title
24
+ # assert_equal('プログラムはこうして作られるプログラマの頭の中をのぞいてみよう',
25
+ # I00.title)
26
+ #end
27
+
28
+ #def test_author
29
+ # assert_equal('平山 尚(株式会社セガ)', I00.author)
30
+ #end
31
+
32
+ #def test_isbn
33
+ # assert_equal('479803925X', I00.isbn)
34
+ #end
35
+
36
+ #def test_publisher
37
+ # assert_equal('秀和システム', I00.publisher)
38
+ #end
39
+
40
+ #def test_publicationDate
41
+ # assert_equal('2013-09-25', I00.publication_date)
42
+ #end
43
+ #
44
+ #
45
+
46
+ # def test_url
47
+ # assert_equal("http://www.amazon.co.jp/%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%A0%E3%81%AF%E3%81%93%E3%81%86%E3%81%97%E3%81%A6%E4%BD%9C%E3%82%89%E3%82%8C%E3%82%8B%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%9E%E3%81%AE%E9%A0%AD%E3%81%AE%E4%B8%AD%E3%82%92%E3%81%AE%E3%81%9E%E3%81%84%E3%81%A6%E3%81%BF%E3%82%88%E3%81%86-%E5%B9%B3%E5%B1%B1-%E5%B0%9A-%E6%A0%AA%E5%BC%8F%E4%BC%9A%E7%A4%BE%E3%82%BB%E3%82%AC/dp/479803925X%3FSubscriptionId%3DAKIAIRDYXYLFLVKUASUQ%26tag%3Dippei94da-22%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D479803925X", I00.url)
48
+ # end
49
+ #
50
+ # def test_img_url
51
+ # assert_equal("http://ecx.images-amazon.com/images/I/41td-P03xmL._SL75_.jpg",
52
+ # I00.img_url)
53
+ #
54
+ # end
55
+ end
56
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: madowu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - ippei94da
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-26 00:00:00.000000000 Z
11
+ date: 2016-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-unit
@@ -80,12 +80,28 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0.11'
83
+ - !ruby/object:Gem::Dependency
84
+ name: amazon-ecs
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '2.4'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '2.4'
83
97
  description: Markdown to HTML with table of contents, sidebar to neighboring directories.
84
98
  email: ippei94da@gmail.com
85
99
  executables:
86
100
  - dirmap
101
+ - isbninfo
87
102
  - madowu
88
103
  - tex2image
104
+ - urltitle
89
105
  extensions: []
90
106
  extra_rdoc_files:
91
107
  - LICENSE.txt
@@ -99,19 +115,19 @@ files:
99
115
  - Rakefile
100
116
  - VERSION
101
117
  - bin/dirmap
118
+ - bin/isbninfo
102
119
  - bin/madowu
103
120
  - bin/tex2image
104
- - doc/.dirmap.md
105
- - doc/.gitignore
106
- - doc/Rakefile
107
- - doc/index.md
108
- - doc/madowu.css
121
+ - bin/urltitle
109
122
  - example/.gitignore
110
123
  - example/Rakefile
124
+ - example/dot.aws/associateid
125
+ - example/dot.aws/rootkey.csv
111
126
  - example/enum.md
112
127
  - example/eq.tex
113
128
  - example/heading.md
114
129
  - example/index.md
130
+ - example/isbn.md
115
131
  - example/list.md
116
132
  - example/madowu.css
117
133
  - example/subdir/Rakefile
@@ -120,14 +136,24 @@ files:
120
136
  - example/subdir/subdir2/Rakefile
121
137
  - example/subdir/subdir2/index.md
122
138
  - example/subdir/subdir2/madowu.css
139
+ - example/template/.gitignore
140
+ - example/template/Rakefile
141
+ - example/template/index.md
142
+ - example/template/madowu.css
123
143
  - example/tex2image/.gitignore
124
144
  - example/tex2image/eq.tex
145
+ - example/urltitle/Rakefile
146
+ - example/urltitle/index.md
147
+ - example/urltitle/madowu.css
148
+ - example/urltitle/url.dat
125
149
  - lib/madowu.rb
126
150
  - lib/madowu/directorymapper.rb
127
151
  - lib/madowu/htmlgenerator.rb
152
+ - lib/madowu/isbn.rb
128
153
  - madowu.gemspec
129
154
  - test/directorymapper/.gitignore
130
155
  - test/directorymapper/dir1/foo.md
156
+ - test/directorymapper/dir2/bar.txt
131
157
  - test/directorymapper/dir2/dir/index.md
132
158
  - test/directorymapper/dir2/foo.md
133
159
  - test/directorymapper/dir2/index.html
@@ -138,11 +164,13 @@ files:
138
164
  - test/empty.md
139
165
  - test/head.md
140
166
  - test/head1.md
167
+ - test/head_pandoc.md
141
168
  - test/helper.rb
142
169
  - test/subdir/empty.md
143
170
  - test/test.css
144
171
  - test/test_directorymapper.rb
145
172
  - test/test_htmlgenerator.rb
173
+ - test/test_isbn.rb
146
174
  - test/test_madowu.rb
147
175
  homepage: http://github.com/ippei94da/madowu
148
176
  licenses:
@@ -164,7 +192,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
164
192
  version: '0'
165
193
  requirements: []
166
194
  rubyforge_project:
167
- rubygems_version: 2.2.2
195
+ rubygems_version: 2.5.1
168
196
  signing_key:
169
197
  specification_version: 4
170
198
  summary: Madowu, MArkDOWn to markUp, to build html
data/doc/.dirmap.md DELETED
@@ -1,9 +0,0 @@
1
- Parent directory:
2
-
3
- * [../](../)
4
-
5
- Current directory:
6
-
7
- * [Rakefile](Rakefile)
8
- * [index.html](index.html) (Madowu, MArkDOWn to markUp)
9
- * [madowu.css](madowu.css)
data/doc/.gitignore DELETED
@@ -1,2 +0,0 @@
1
- *.html
2
- **/.dirmap.md
data/doc/index.md DELETED
@@ -1,166 +0,0 @@
1
- <!-- vim:syntax=markdown
2
- -->
3
-
4
- # Madowu, MArkDOWn to markUp
5
-
6
- 「まどう」と読みます。
7
-
8
- Markdown で書かれたドキュメントを、
9
- ヘッダフッタ付きのちゃんとした HTML にします。
10
- なお、このページは madowu によって生成されています。
11
-
12
-
13
- ## インストール
14
- gem install madowu
15
-
16
- ## 基本的な動作
17
-
18
- 一つの md ファイルを受け取り、
19
- 拡張子を html に変更したファイルを生成します。
20
- 元々存在しても、確認なしに上書きします。
21
-
22
- `madowu *.md` のように 複数ファイルを一度に扱えるようにはしていません。
23
- 今のところ、これは make や rake が分担すべき仕事だと考えています。
24
-
25
- ## HTML head の title 要素
26
- HTML ではファイルで表現される文書のタイトルを
27
- head 要素の title 要素で指定しますが、
28
- markdown ではこれを指定する方法がありません。
29
- Madowu では、md ファイル内で現れる最初の見出し(「#」で始まる行。レベルは1と限らない)
30
- をページ全体のタイトルとして扱います。
31
- すなわち、Madowu ではファイル内に h1 要素を生成するレベル1 の
32
- 「#」が 1つだけであり、これが全ての見出しの中で最初に出現することを想定しています。
33
-
34
- ## オプション
35
- madowu -h
36
- でヘルプが出ます。
37
-
38
- ### -o オプション, outline を埋め込む
39
- 見出しをまとめた outline を body の先頭に埋め込みます。
40
- markdown 処理されたマークアップテキストに、さらにアンカーとリンクを追加します。
41
-
42
- スタイルシートを適切に準備しておけば幸せになれるでしょう。
43
- example/madowu.css を参考にされると良いでしょう。
44
- また、一度 example で rake を実行し、
45
- ブラウザで生成された html 群を見てみると良いと思います。
46
-
47
- ### -O オプション, タイトル行そのものをその行へのリンクにする。
48
- -o の機能に追加して、タイトル行そのものをその行へのリンクにします。
49
-
50
- ### -d オプション, sidebar にディレクトリマップを埋め込む
51
- ファイルが存在するディレクトリ周囲のファイルへのリンクをまとめ、sidebar に配置します。
52
-
53
- 親ディレクトリ、同一ディレクトリ内のエントリの2種類に分類します。
54
- ディレクトリへのリンクに関しては、index.html or index.md があれば index.html
55
- へのリンクを作り、存在しなければ ディレクトリ自体にリンクします。
56
- 同一ディレクトリのファイルは、`foo.md` は `foo.html` になるものとして、html の名前でリンクを生成します。
57
- また、md もしくは html ファイルでタイトル相当の情報があれば、
58
- これを 括弧内で補助的に表示します。
59
-
60
- これも、
61
- スタイルシートを適切に準備しておけば幸せになれるでしょう。
62
-
63
- ### -c オプション, css ファイル指定
64
- html 表示に適用するスタイルシートのパスを指定します。
65
- 元となる markdown ファイルのパスと指定された css ファイルのパスとの
66
- 相対パスに変換して埋め込みます。
67
-
68
- ### -C オプション, charset 指定
69
- HTML ヘッダで指定するファイルの文字エンコーディングを指定します。
70
- 指定しない場合のデフォルト値は US-ASCII です。
71
-
72
- ### -s オプション
73
- サイドバーに埋め込む内容のファイルを指定します。
74
- このファイルを Markdown 処理して埋め込みます。
75
-
76
-
77
- ### -m オプション
78
- 使用する markdown コマンドを指定します。
79
- 方言を含む markdown like な処理系を指定することも可能です。
80
-
81
- ## 支援コマンド
82
-
83
- ### tex2image
84
-
85
- LaTeX の出力を画像にします。
86
- 数式の貼り込みなどに便利だと思います。
87
- デフォルトでは png 形式で書き出します。
88
-
89
- * -j, --jpg オプション。png ではなく、jpg 形式で書き出します。
90
- * -d, --density=val オプション。解像度を指定します。
91
-
92
- ### dirmap
93
-
94
- 親子関係で隣接したディレクトリへのリンクを表す .dirmap.md ファイルを Markdown
95
- 形式で書き出します。
96
-
97
- .dirmap.md と内容に変更がなければ書き出さず、タイムスタンプを維持します。
98
-
99
- ## example
100
- ウェブサイトのように、ディレクトリ丸々 markdown から html に変換するような場合に
101
- 使える Rakefile のサンプルが example/ 以下にあります。
102
- とりあえず rake して生成される index.html と
103
- 他の html を見るとだいたい感じがつかめると思います。
104
-
105
-
106
- <!--
107
- ### ディレクトリ更新の追従
108
- この Rakefile では html ファイル生成が md ファイルのみに依存するようになっている
109
- ため、
110
- ディレクトリへのファイルの追加・削除のみがあった場合には自動的にそれを補うように
111
- 更新されません。
112
- そのため、このような目的のためには手動で強制的に html を生成する必要があります。
113
-
114
- #### このような仕様になっている理由
115
-
116
- ディレクトリに依存するとして Rakefile を記述すると、追加・削除がなくとも、
117
- どれか一つのファイルを更新する度にディレクトリ内のファイルが全て madowu 処理
118
- されることになります。
119
- ディレクトリ内のファイルエントリが変更されなければディレクトリのタイムスタンプ
120
- は本来更新されないのですが、
121
- vim や emacs は foo.swp のようなスワップファイルを生成・削除するため、
122
- ディレクトリのタイムスタンプが更新されてしまいます。
123
- ファイル編集は通常エディタで行うことが想定されますので、
124
- この挙動は受け入れるべきです。
125
- そのため、1つのファイルを更新すると同時にディレクトリの更新時刻も更新され、
126
- そのディレクトリに依存する全ての html ファイルの更新が必要と判断されるということになります。
127
- ところが、このような挙動は多数の `*.md` ファイルが存在するディレクトリで
128
- 1つのファイルを更新しても、
129
- rake をかけるたびに全てのファイルを更新することになり、
130
- 確認しながらの編集がストレスフルなものとなってしまいます。
131
- このデメリットが
132
- ディレクトリ更新を自動的に補足するメリットよりも大きいと判断したため、
133
- example/Rakefile ではディレクトリのタイムスタンプは見ない、
134
- という仕様に今のところなっています。
135
-
136
- .dirmap.html のようなファイルを生成して
137
- これを読み込むようにもしてみたことがありますが、
138
- この場合もディレクトリの更新時刻が更新されます。
139
- 毎回 .dirmap.html が更新されるので、毎回全てのファイルが更新されてしまいます。
140
-
141
- .dirmap.html を生成しておいて、
142
- ファイル内容をチェックし、変更があればこれを更新、というのは一つの手かもしれません。
143
- しかし、挙動が複雑な割に得られるメリットが少ない気がします。
144
- -->
145
-
146
- ### 再帰的なターゲッティング
147
- この Rakefile では `**.md` のように
148
- 1つの Rakefile で再帰的にターゲッティングしていますが、
149
- 運用によってはこのようにせず、各ディレクトリで Rakefile を配置する方が良いかもしれません。
150
-
151
- ## 関連プログラム
152
- freestyle wiki からのデータ移動を考えている方は、
153
- tefil に同梱してある fswiki2md が少し便利かもしれません。
154
-
155
-
156
- <script>
157
- (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
158
- (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
159
- m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
160
- })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
161
-
162
- ga('create', 'UA-68497868-1', 'auto');
163
- ga('send', 'pageview');
164
- </script>
165
-
166
-