styledown 0.7.0.pre.0 → 1.0.1.pre.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.md +8 -0
- data/Notes.md +16 -0
- data/Readme.md +12 -15
- data/lib/styledown/version.rb +1 -1
- data/lib/styledown.rb +14 -0
- data/test/fixtures/simple/sample.css +4 -0
- data/test/fixtures/simple/sample.md +3 -0
- data/test/test.rb +17 -0
- data/test/test_helper.rb +4 -0
- data/vendor/dist/styledown.js +10 -8
- metadata +8 -6
- data/test/History.md +0 -3
- data/test/Notes.md +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d47b10ea920be0c6c121c9bb8e1bd8b91b1854f6
|
4
|
+
data.tar.gz: 8c97be7f883768893fa91bffff4e924aab5482cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a97f16363cdb5a16b140c370a99ecc3c8d94f2e6b65c5121f84dbbd06253febd343eede6df3d5ac32ec5900842ecf7c1276f0fde2f56d7f6c4ab21560939052a
|
7
|
+
data.tar.gz: 42be8ba2b159310326e6f8a8bf7272840c1abe5fabf7b3e29245c964f77b07482bc7439d97e10b2d27eb2d242a6b0a251886f4f4adcd44b247af0313b4a257dc
|
data/History.md
CHANGED
data/Notes.md
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
Developer notes
|
2
|
+
===============
|
3
|
+
|
4
|
+
### Updating source
|
5
|
+
|
6
|
+
Update `vendor/dist/styledown.js`. Get it as `dist/styledown.js` from the
|
7
|
+
[styledown/styledown] repo. This is built using the `npm run prepublish` hook.
|
8
|
+
|
9
|
+
[styledown/styledown]: https://github.com/styledown/styledown
|
10
|
+
|
11
|
+
### Releasing new versions
|
12
|
+
|
13
|
+
vim History.md
|
14
|
+
bump lib/styledown/version.rb
|
15
|
+
gem build *.gemspec
|
16
|
+
rake && gem push *.gem && git release v1.0.0
|
data/Readme.md
CHANGED
@@ -9,42 +9,39 @@ Ruby integration of [Styledown].
|
|
9
9
|
|
10
10
|
```rb
|
11
11
|
# Gemfile
|
12
|
-
gem 'styledown
|
13
|
-
```
|
14
|
-
|
15
|
-
Controller (TODO: this is to be implemented soon):
|
16
|
-
|
17
|
-
```rb
|
18
|
-
module StyleguideController
|
19
|
-
def index
|
20
|
-
files = Dir['./app/assets/stylesheets/*.scss']
|
21
|
-
render_styleguide files: files, layout: 'application'
|
22
|
-
end
|
23
|
-
end
|
12
|
+
gem 'styledown'
|
24
13
|
```
|
25
14
|
|
26
15
|
## Plain Ruby integration
|
27
16
|
|
28
|
-
|
17
|
+
API for `Styledown.parse` is exactly the same as the JS version ([docs]).
|
29
18
|
|
30
19
|
```rb
|
31
20
|
require 'styledown'
|
32
21
|
|
22
|
+
# Passing a Styledown sting:
|
33
23
|
Styledown.parse('### hello', bare: true)
|
34
24
|
|
25
|
+
# Parsing files from disk:
|
26
|
+
Styledown.parse([
|
27
|
+
'/path/to/input.css',
|
28
|
+
'/path/to/input.md',
|
29
|
+
'...'
|
30
|
+
])
|
31
|
+
|
32
|
+
# Parsing files from elsewhere:
|
35
33
|
Styledown.parse([
|
36
34
|
{ name: "input.md", data: "### hi from md" },
|
37
35
|
{ name: "input.css", data: "/**\n * hi from css:\n * world\n */" }
|
38
36
|
])
|
39
37
|
```
|
40
38
|
|
41
|
-
API for `Styledown.parse` is exactly the same as the JS version ([docs]).
|
42
39
|
|
43
40
|
[docs]: https://github.com/styledown/styledown/blob/master/docs/API.md#styledownparse
|
44
41
|
|
45
42
|
## :copyright:
|
46
43
|
|
47
|
-
**styledown
|
44
|
+
**styledown** © 2014+, Rico Sta. Cruz. Released under the [MIT License].<br>
|
48
45
|
Authored and maintained by Rico Sta. Cruz with help from [contributors].
|
49
46
|
|
50
47
|
> [ricostacruz.com](http://ricostacruz.com) ·
|
data/lib/styledown/version.rb
CHANGED
data/lib/styledown.rb
CHANGED
@@ -13,12 +13,26 @@ module Styledown
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def parse(source, options={})
|
16
|
+
if array_of_filenames?(source)
|
17
|
+
source = unpack_files(source)
|
18
|
+
end
|
19
|
+
|
16
20
|
context.call('Styledown.parse', source, options)
|
17
21
|
end
|
18
22
|
|
19
23
|
def js_version
|
20
24
|
context.eval('Styledown.version')
|
21
25
|
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def unpack_files(source)
|
30
|
+
source.map { |file| { name: file, data: File.read(file) } }
|
31
|
+
end
|
32
|
+
|
33
|
+
def array_of_filenames?(source)
|
34
|
+
source.is_a?(Array) && source[0].is_a?(String)
|
35
|
+
end
|
22
36
|
end
|
23
37
|
|
24
38
|
require File.expand_path('../styledown/railtie', __FILE__) if defined?(Rails)
|
data/test/test.rb
CHANGED
@@ -50,3 +50,20 @@ describe 'head options' do
|
|
50
50
|
@output.must_match /^<!doctype html>/
|
51
51
|
end
|
52
52
|
end
|
53
|
+
|
54
|
+
describe 'Working with arrays of strings' do
|
55
|
+
before do
|
56
|
+
@output = Styledown.parse([
|
57
|
+
fixture_path('simple/sample.css'),
|
58
|
+
fixture_path('simple/sample.md')
|
59
|
+
])
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'renders from .md' do
|
63
|
+
@output.must_match /Sample md block<\/h3>/
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'renders from .css' do
|
67
|
+
@output.must_match /Sample CSS block<\/h3>/
|
68
|
+
end
|
69
|
+
end
|
data/test/test_helper.rb
CHANGED
data/vendor/dist/styledown.js
CHANGED
@@ -154,7 +154,7 @@ Styledown.prototype = {
|
|
154
154
|
|
155
155
|
if (this.options.head !== false) {
|
156
156
|
// Unpack template
|
157
|
-
var $ = Cheerio.load(this.options.template);
|
157
|
+
var $ = Cheerio.load(htmlize(this.options.template));
|
158
158
|
$('body').append(htmlize(this.options.body));
|
159
159
|
$('[sg-content]').append(html).removeAttr('sg-content');
|
160
160
|
$('html, body').addClass(this.options.prefix);
|
@@ -294,8 +294,9 @@ module.exports = [
|
|
294
294
|
"",
|
295
295
|
"### Head",
|
296
296
|
"",
|
297
|
-
" <
|
298
|
-
" <
|
297
|
+
" <meta name='viewport' content='width=device-width, initial-scale=1' />",
|
298
|
+
" <script src='https://cdn.rawgit.com/styledown/styledown/v"+version+"/data/styledown.js'></script>",
|
299
|
+
" <link rel='stylesheet' href='https://cdn.rawgit.com/styledown/styledown/v"+version+"/data/styledown.css' />",
|
299
300
|
" <link rel='stylesheet' href='your-stylesheet-here.css' />",
|
300
301
|
"",
|
301
302
|
"### Body",
|
@@ -310,6 +311,7 @@ module.exports = [
|
|
310
311
|
|
311
312
|
(function () {
|
312
313
|
if (!this.window) this.window = this;
|
314
|
+
module.exports = require('../index');
|
313
315
|
this.Styledown = require('../index');
|
314
316
|
})();
|
315
317
|
|
@@ -19484,8 +19486,7 @@ module.exports={
|
|
19484
19486
|
"tarball": "http://registry.npmjs.org/cheerio/-/cheerio-0.17.0.tgz"
|
19485
19487
|
},
|
19486
19488
|
"directories": {},
|
19487
|
-
"_resolved": "https://registry.npmjs.org/cheerio/-/cheerio-0.17.0.tgz"
|
19488
|
-
"readme": "ERROR: No README data found!"
|
19489
|
+
"_resolved": "https://registry.npmjs.org/cheerio/-/cheerio-0.17.0.tgz"
|
19489
19490
|
}
|
19490
19491
|
|
19491
19492
|
},{}],102:[function(require,module,exports){
|
@@ -46278,14 +46279,15 @@ module.exports={
|
|
46278
46279
|
"styleguide"
|
46279
46280
|
],
|
46280
46281
|
"author": "Rico Sta. Cruz <hi@ricostacruz.com>",
|
46281
|
-
"version": "0.
|
46282
|
+
"version": "1.0.1",
|
46282
46283
|
"repository": {
|
46283
46284
|
"type": "git",
|
46284
|
-
"url": "https://github.com/
|
46285
|
+
"url": "https://github.com/styledown/styledown.git"
|
46285
46286
|
},
|
46286
46287
|
"main": "index",
|
46287
46288
|
"scripts": {
|
46288
|
-
"test": "mocha"
|
46289
|
+
"test": "mocha",
|
46290
|
+
"prepublish": "make dist"
|
46289
46291
|
},
|
46290
46292
|
"dependencies": {
|
46291
46293
|
"cheerio": "0.17.0",
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: styledown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.1.pre.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rico Sta. Cruz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: execjs
|
@@ -30,20 +30,22 @@ executables: []
|
|
30
30
|
extensions: []
|
31
31
|
extra_rdoc_files:
|
32
32
|
- History.md
|
33
|
+
- Notes.md
|
33
34
|
- Readme.md
|
34
35
|
files:
|
35
36
|
- ".gitignore"
|
36
37
|
- ".travis.yml"
|
37
38
|
- Gemfile
|
38
39
|
- History.md
|
40
|
+
- Notes.md
|
39
41
|
- Rakefile
|
40
42
|
- Readme.md
|
41
43
|
- lib/styledown.rb
|
42
44
|
- lib/styledown/railtie.rb
|
43
45
|
- lib/styledown/version.rb
|
44
46
|
- styledown.gemspec
|
45
|
-
- test/
|
46
|
-
- test/
|
47
|
+
- test/fixtures/simple/sample.css
|
48
|
+
- test/fixtures/simple/sample.md
|
47
49
|
- test/test.rb
|
48
50
|
- test/test_helper.rb
|
49
51
|
- vendor/dist/styledown.js
|
@@ -72,7 +74,7 @@ signing_key:
|
|
72
74
|
specification_version: 4
|
73
75
|
summary: "..."
|
74
76
|
test_files:
|
75
|
-
- test/
|
76
|
-
- test/
|
77
|
+
- test/fixtures/simple/sample.css
|
78
|
+
- test/fixtures/simple/sample.md
|
77
79
|
- test/test.rb
|
78
80
|
- test/test_helper.rb
|
data/test/History.md
DELETED