bobkit 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +37 -17
- data/lib/bobkit.rb +2 -0
- data/lib/bobkit/location_options.rb +4 -0
- data/lib/bobkit/markdown_bridge.rb +32 -0
- data/lib/bobkit/scope.rb +2 -0
- data/lib/bobkit/slim_bridge.rb +3 -2
- data/lib/bobkit/tasks.rb +1 -0
- data/lib/bobkit/version.rb +1 -1
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0d5ce22323d9500b5f9550aaee8eefcdb139087
|
4
|
+
data.tar.gz: d7a7214c3385c6f8342b52b94dc4856a0590a117
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d8f76201dd38ae07037e1834f55598a508cd5d1263465a1a428699c4eaa421c462b6b05177e7edc002273406f402a213cad43330c82625b218c39bc2aee3d01
|
7
|
+
data.tar.gz: 7f464bc9ed9f2780113a54b633327f65ccb7d6714ee49a53481611c981323e8c8a71d8fa46038c0e36531e91a87f82af18347cd661536b352b8f99054c0cff1f
|
data/README.md
CHANGED
@@ -8,19 +8,23 @@ Bobkit - Site Generation Toolkit
|
|
8
8
|
|
9
9
|
---
|
10
10
|
|
11
|
-
Bobkit is a lightweight
|
12
|
-
and CoffeeScript.
|
11
|
+
Bobkit is a lightweight toolkit for generating static websites with:
|
13
12
|
|
14
|
-
|
13
|
+
#### `Slim + SCSS + CoffeeScript + Markdown + I18n`
|
15
14
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
-
|
21
|
-
|
22
|
-
-
|
23
|
-
-
|
15
|
+
---
|
16
|
+
|
17
|
+
The design intentions were to:
|
18
|
+
|
19
|
+
- Provide easy to use wrapper methods for Slim, SCSS, CoffeeScript and
|
20
|
+
Markdown.
|
21
|
+
- Not impose any directory structure (this is not another blog generator...).
|
22
|
+
- Allow you to use standard ruby for generating your site how you see fit.
|
23
|
+
- Be packaged as a library, and not a command line tool.
|
24
|
+
- Provide sensible default locations that are easily overridable.
|
25
|
+
- Add `render` and `layout` support to Slim (Rails-like).
|
26
|
+
- Add i18n support to Slim (Rails-like).
|
27
|
+
- Add `@import 'globbing/*'` support to SCSS (Rails-like).
|
24
28
|
|
25
29
|
---
|
26
30
|
|
@@ -87,6 +91,9 @@ templates_folder 'views'
|
|
87
91
|
# Default: "#{templates_folder}/layouts"
|
88
92
|
layouts_folder 'my_layouts'
|
89
93
|
|
94
|
+
# Location of markdown files. Default: "markdown"
|
95
|
+
markdown_folder 'docs'
|
96
|
+
|
90
97
|
# Location of the source SCSS files. Default: "styles"
|
91
98
|
styles_folder 'styles'
|
92
99
|
|
@@ -115,7 +122,6 @@ scss_options cache: true, syntax: :scss, style: :nested
|
|
115
122
|
use_defaults
|
116
123
|
```
|
117
124
|
|
118
|
-
|
119
125
|
### Slim
|
120
126
|
|
121
127
|
```ruby
|
@@ -135,11 +141,16 @@ html = render 'user', layout: 'default', email: 'bob@kit.com'
|
|
135
141
|
|
136
142
|
# You can save to a file in the `output_folder`
|
137
143
|
render 'user', layout: 'default', email: 'bob@kit.com', output: 'bob'
|
144
|
+
|
145
|
+
# You can send an HTML string as the content of a layout
|
146
|
+
render content: "<h1>Hello</h1>", layout: 'default'
|
138
147
|
```
|
139
148
|
|
140
149
|
In addition, you can call `= render 'template'` from inside a slim
|
141
|
-
template.
|
150
|
+
template.
|
142
151
|
|
152
|
+
To check if a certain context variable was provided to a slim template,
|
153
|
+
you can use `if have? :varname`.
|
143
154
|
|
144
155
|
### SCSS
|
145
156
|
|
@@ -161,11 +172,23 @@ js = compile_js 'script'
|
|
161
172
|
compile_js 'script', output: 'main'
|
162
173
|
```
|
163
174
|
|
175
|
+
### Markdown
|
176
|
+
|
177
|
+
```ruby
|
178
|
+
# Compile a markdown file to HTML string
|
179
|
+
html = markdown 'article'
|
180
|
+
|
181
|
+
# Compile directly to a file, inside a slim layout
|
182
|
+
markdown 'article', layout: :default, output: 'article'
|
183
|
+
|
184
|
+
# All options pass through directly to the slim renderer
|
185
|
+
html = markdown 'article', layout: :default, sidebar: true
|
186
|
+
```
|
164
187
|
|
165
188
|
### Asset helpers
|
166
189
|
|
167
190
|
Anything other than CSS, Javascript and HTML is considered an asset.
|
168
|
-
These are some helpers to help you move them
|
191
|
+
These are some helpers to help you move them around from input to output
|
169
192
|
folders.
|
170
193
|
|
171
194
|
```ruby
|
@@ -208,7 +231,6 @@ create_folder 'my_folder'
|
|
208
231
|
create_folder_for 'some/folder/with/file.png'
|
209
232
|
```
|
210
233
|
|
211
|
-
|
212
234
|
### File Watcher
|
213
235
|
|
214
236
|
Bobkit comes bundled with FileWatcher, and has a shortcut method to
|
@@ -238,8 +260,6 @@ Todo
|
|
238
260
|
- [ ] Consider adding `input_root` which will prefix all others
|
239
261
|
- [ ] YAML loader (data_folder?)
|
240
262
|
- [ ] CSV Loader (data_folder?)
|
241
|
-
- [ ] Maybe: Render from/to Markdown
|
242
|
-
- [ ] Maybe: Render to JSON
|
243
263
|
|
244
264
|
|
245
265
|
[1]: https://github.com/DannyBen/bobkit/tree/master/examples
|
data/lib/bobkit.rb
CHANGED
@@ -5,6 +5,7 @@ require 'sass-globbing'
|
|
5
5
|
require 'slim'
|
6
6
|
require 'coffee_script'
|
7
7
|
require 'filewatcher'
|
8
|
+
require 'rdiscount'
|
8
9
|
|
9
10
|
require 'bobkit/options_base'
|
10
11
|
require 'bobkit/location_options'
|
@@ -17,6 +18,7 @@ require 'bobkit/sass_bridge'
|
|
17
18
|
require 'bobkit/slim_options'
|
18
19
|
require 'bobkit/slim_bridge'
|
19
20
|
require 'bobkit/coffee_bridge'
|
21
|
+
require 'bobkit/markdown_bridge'
|
20
22
|
require 'bobkit/assets'
|
21
23
|
require 'bobkit/watcher'
|
22
24
|
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Bobkit
|
2
|
+
module MarkdownBridge
|
3
|
+
def markdown(file, *args)
|
4
|
+
MarkdownHandler.instance.compile file, *args
|
5
|
+
end
|
6
|
+
|
7
|
+
class MarkdownHandler
|
8
|
+
include Singleton
|
9
|
+
include SlimBridge
|
10
|
+
include LocationOptions
|
11
|
+
|
12
|
+
def compile(file, options={})
|
13
|
+
markdown = RDiscount.new file_content file
|
14
|
+
content = markdown.to_html
|
15
|
+
options[:content] = content
|
16
|
+
content = render options if options[:layout]
|
17
|
+
content
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def file_content(basename)
|
23
|
+
File.read markdown_file basename
|
24
|
+
end
|
25
|
+
|
26
|
+
def markdown_file(basename)
|
27
|
+
"#{markdown_folder}/#{basename}.md"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
data/lib/bobkit/scope.rb
CHANGED
data/lib/bobkit/slim_bridge.rb
CHANGED
@@ -17,13 +17,14 @@ module Bobkit
|
|
17
17
|
partial = options.delete :partial
|
18
18
|
layout = options.delete :layout
|
19
19
|
output = options.delete :output
|
20
|
-
|
20
|
+
content = options.delete :content
|
21
|
+
|
21
22
|
context = options.empty? ? scope : options
|
22
23
|
if context.is_a? Hash or !context
|
23
24
|
context = Scope.new context
|
24
25
|
end
|
25
26
|
|
26
|
-
content
|
27
|
+
content ||= Slim::Template.new(partial_filename(partial), slim_options).render(context)
|
27
28
|
content = Slim::Template.new(layout_filename(layout), slim_options).render(context) { content } if layout
|
28
29
|
create_file "#{output_folder}/#{output}.html", content if output
|
29
30
|
content
|
data/lib/bobkit/tasks.rb
CHANGED
data/lib/bobkit/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bobkit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Danny Ben Shitrit
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: slim
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0.12'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rdiscount
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '2.2'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '2.2'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: runfile
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -192,6 +206,7 @@ files:
|
|
192
206
|
- lib/bobkit/i18n_bridge.rb
|
193
207
|
- lib/bobkit/i18n_mixin.rb
|
194
208
|
- lib/bobkit/location_options.rb
|
209
|
+
- lib/bobkit/markdown_bridge.rb
|
195
210
|
- lib/bobkit/options_base.rb
|
196
211
|
- lib/bobkit/sass_bridge.rb
|
197
212
|
- lib/bobkit/sass_options.rb
|