retter 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/.travis.yml +1 -0
- data/README.md +54 -4
- data/bin/retter +2 -0
- data/lib/retter/command.rb +37 -41
- data/lib/retter/config.rb +94 -84
- data/lib/retter/entries.rb +93 -0
- data/lib/retter/entry.rb +46 -9
- data/lib/retter/generator/skel/images/orange/ic_li01.gif +0 -0
- data/lib/retter/generator/skel/layouts/article.html.haml +16 -3
- data/lib/retter/generator/skel/layouts/entries.html.haml +2 -2
- data/lib/retter/generator/skel/layouts/entry.html.haml +17 -3
- data/lib/retter/generator/skel/layouts/index.html.haml +14 -4
- data/lib/retter/generator/skel/stylesheets/base.css +1 -1
- data/lib/retter/generator/skel/stylesheets/orange.css +17 -2
- data/lib/retter/page/view_helper.rb +33 -0
- data/lib/retter/page.rb +86 -0
- data/lib/retter/pages/archive.rb +13 -0
- data/lib/retter/pages/article.rb +35 -0
- data/lib/retter/pages/entry.rb +28 -0
- data/lib/retter/pages/feed.rb +46 -0
- data/lib/retter/pages/index.rb +13 -0
- data/lib/retter/pages/profile.rb +13 -0
- data/lib/retter/pages.rb +40 -0
- data/lib/retter/preprint.rb +21 -0
- data/lib/retter/{stationery/renderer.rb → renderer.rb} +1 -1
- data/lib/retter/repository.rb +21 -0
- data/lib/retter/version.rb +1 -1
- data/lib/retter.rb +36 -3
- data/retter.gemspec +31 -0
- data/spec/command/callback_spec.rb +1 -1
- data/spec/command/commit_spec.rb +1 -1
- data/spec/command/edit_spec.rb +1 -1
- data/spec/command/invoke_after_spec.rb +2 -2
- data/spec/command/list_spec.rb +47 -0
- data/spec/command/open_spec.rb +1 -1
- data/spec/command/preview_spec.rb +1 -1
- data/spec/command/rebind_spec.rb +8 -8
- data/spec/spec_helper.rb +2 -0
- data/spec/support/stream_capture.rb +16 -0
- metadata +84 -39
- data/lib/retter/stationery/binder.rb +0 -150
- data/lib/retter/stationery/previewer.rb +0 -64
- data/lib/retter/stationery/view.rb +0 -68
- data/lib/retter/stationery.rb +0 -47
data/lib/retter/stationery.rb
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
module Retter::Stationery
|
4
|
-
class << self
|
5
|
-
def scan(path)
|
6
|
-
entries = find_markup_files(path).map {|file|
|
7
|
-
date = file.basename('.*').to_s
|
8
|
-
mkup = File.open(file, &:read)
|
9
|
-
Retter::Entry.new date: Date.parse(date), body: markupper.render(mkup)
|
10
|
-
}
|
11
|
-
|
12
|
-
entries.sort_by(&:date).reverse
|
13
|
-
end
|
14
|
-
|
15
|
-
def find_markup_files(path)
|
16
|
-
path = Pathname.new(path).realpath
|
17
|
-
Dir.open(path, &:to_a).grep(/^\d{4}(?:0[1-9]|1[012])(?:0[1-9]|[12][0-9]|3[01])\.(md)$/).map {|f| path.join f }
|
18
|
-
end
|
19
|
-
|
20
|
-
def markupper
|
21
|
-
@markupper ||= ::Redcarpet::Markdown.new(
|
22
|
-
Renderer,
|
23
|
-
autolink: true,
|
24
|
-
space_after_headers: true,
|
25
|
-
fenced_code_blocks: true,
|
26
|
-
strikethrough: true,
|
27
|
-
superscript: true,
|
28
|
-
fenced_code_blocks: true,
|
29
|
-
tables: true
|
30
|
-
)
|
31
|
-
end
|
32
|
-
|
33
|
-
def previewer(config, date)
|
34
|
-
Previewer.new config, date
|
35
|
-
end
|
36
|
-
|
37
|
-
def binder(config)
|
38
|
-
Binder.new config
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
require 'retter/stationery/renderer'
|
44
|
-
require 'retter/stationery/view'
|
45
|
-
require 'retter/stationery/previewer'
|
46
|
-
require 'retter/stationery/binder'
|
47
|
-
|