styledown 0.7.0.pre.0 → 1.0.1.pre.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 75307924c7f2816424e55d31bec1fe08537c7e7e
4
- data.tar.gz: 9ca8e3a43a75c5f2525166d81c854673b55d6831
3
+ metadata.gz: d47b10ea920be0c6c121c9bb8e1bd8b91b1854f6
4
+ data.tar.gz: 8c97be7f883768893fa91bffff4e924aab5482cc
5
5
  SHA512:
6
- metadata.gz: 692ae411e0108ebf4cb984e4f7e96b84fc5797b4d58820893fa7b296a6e58ecf467b36630ec1a18acea7c5b2692b3e578c05697f44e8742b44a2e7612865f31f
7
- data.tar.gz: 74ca1fdb720fe07382538e5856fc256851be24e848a32dcc74f4ecdb7a3ede6f73beaad3970fac3589e3a12a18d94dacffc631f6c777ce0ca9b0595fbf1eae59
6
+ metadata.gz: a97f16363cdb5a16b140c370a99ecc3c8d94f2e6b65c5121f84dbbd06253febd343eede6df3d5ac32ec5900842ecf7c1276f0fde2f56d7f6c4ab21560939052a
7
+ data.tar.gz: 42be8ba2b159310326e6f8a8bf7272840c1abe5fabf7b3e29245c964f77b07482bc7439d97e10b2d27eb2d242a6b0a251886f4f4adcd44b247af0313b4a257dc
data/History.md CHANGED
@@ -0,0 +1,8 @@
1
+ ## v1.0.1.pre.0 - September 5, 2014
2
+
3
+ * Update Styledown source to 1.0.1.
4
+ * Add support for `Styledown.parse(array of files)`.
5
+
6
+ ## v0.7.0.pre.0 - September 1, 2014
7
+
8
+ Initial pre-release. No Rails integration, but plain Ruby integration works.
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-rails'
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
- Contrary to the gem's name, styledown-rails does *not* require Rails.
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-rails** © 2014+, Rico Sta. Cruz. Released under the [MIT License].<br>
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) &nbsp;&middot;&nbsp;
@@ -1,5 +1,5 @@
1
1
  module Styledown
2
2
  def self.version
3
- version = "0.7.0-0"
3
+ version = "1.0.1-0"
4
4
  end
5
5
  end
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)
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Sample CSS block:
3
+ * Hello world. *Hola mundo.*
4
+ */
@@ -0,0 +1,3 @@
1
+ ### Sample md block
2
+
3
+ Hello world.
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
@@ -14,3 +14,7 @@ end
14
14
  def test_path(path='')
15
15
  File.expand_path("../#{path}", __FILE__)
16
16
  end
17
+
18
+ def fixture_path(path='')
19
+ test_path "fixtures/#{path}"
20
+ end
@@ -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
- " <script src='https://cdn.rawgit.com/rstacruz/styledown/v"+version+"/data/styledown.js'></script>",
298
- " <link rel='stylesheet' href='https://cdn.rawgit.com/rstacruz/styledown/v"+version+"/data/styledown.css' />",
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.6.1",
46282
+ "version": "1.0.1",
46282
46283
  "repository": {
46283
46284
  "type": "git",
46284
- "url": "https://github.com/rstacruz/styledown.git"
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.7.0.pre.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-01 00:00:00.000000000 Z
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/History.md
46
- - test/Notes.md
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/History.md
76
- - test/Notes.md
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
@@ -1,3 +0,0 @@
1
- ## v0.7.0.pre.0 - September 1, 2014
2
-
3
- Initial pre-release. No Rails integration, but plain Ruby integration works.
data/test/Notes.md DELETED
@@ -1,9 +0,0 @@
1
- Developer notes
2
- ===============
3
-
4
- ### Releasing new versions
5
-
6
- vim History.md
7
- bump lib/styledown/version.rb
8
- gem build *.gemspec
9
- rake && gem push *.gem && git release v1.0.0