styledown 1.0.1 → 1.0.2.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 +6 -11
- data/Notes.md +68 -2
- data/Rakefile +7 -2
- data/lib/styledown/version.rb +1 -1
- data/lib/styledown.rb +5 -3
- data/test/test.rb +11 -11
- data/test/test_helper.rb +3 -3
- data/vendor/dist/styledown.js +182 -161
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4eec94b0a4e0d5a730357f9fdc5c82401656d74c
|
4
|
+
data.tar.gz: f55c31765bf24914dcdacb049de80394f5e058e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d66440860aa56893f6d41faa897ae788b56d7ced326d3d8e29f4a5a115b8b65de31e6d6117b9d4272ef0927089711e385d8eeb7976cf4a84194ec504ca2f2e7e
|
7
|
+
data.tar.gz: 8d2363c1e1915e9927d7159fb1dc14fa0feb07c3efae32531ba9913c6ab20bfdbfb6305b42d1757a4435465b2ab456e176021765fc7cdb769a11cb8cc46ee82b
|
data/History.md
CHANGED
@@ -1,17 +1,12 @@
|
|
1
|
-
##
|
2
|
-
> Apr 19, 2016
|
1
|
+
## v1.0.2.pre.0 - January 16, 2014
|
3
2
|
|
4
|
-
|
3
|
+
* Update Styledown source to 1.0.2.
|
5
4
|
|
6
|
-
|
5
|
+
## v1.0.1.pre.0 - September 5, 2014
|
7
6
|
|
8
|
-
|
9
|
-
|
7
|
+
* Update Styledown source to 1.0.1.
|
8
|
+
* Add support for `Styledown.parse(array of files)`.
|
10
9
|
|
11
|
-
|
12
|
-
- Add support for `Styledown.parse(array of files)`.
|
13
|
-
|
14
|
-
## v0.7.0.pre.0
|
15
|
-
> September 1, 2014
|
10
|
+
## v0.7.0.pre.0 - September 1, 2014
|
16
11
|
|
17
12
|
Initial pre-release. No Rails integration, but plain Ruby integration works.
|
data/Notes.md
CHANGED
@@ -3,8 +3,11 @@ Developer notes
|
|
3
3
|
|
4
4
|
### Updating source
|
5
5
|
|
6
|
-
|
7
|
-
|
6
|
+
Use `rake update`.
|
7
|
+
|
8
|
+
This will update `vendor/dist/styledown.js`. Get it as `dist/styledown.js` from
|
9
|
+
the [styledown/styledown] repo. This is built using the `npm run prepublish`
|
10
|
+
hook.
|
8
11
|
|
9
12
|
[styledown/styledown]: https://github.com/styledown/styledown
|
10
13
|
|
@@ -14,3 +17,66 @@ Update `vendor/dist/styledown.js`. Get it as `dist/styledown.js` from the
|
|
14
17
|
bump lib/styledown/version.rb
|
15
18
|
gem build *.gemspec
|
16
19
|
rake && gem push *.gem && git release v1.0.0
|
20
|
+
|
21
|
+
Planned API
|
22
|
+
-----------
|
23
|
+
|
24
|
+
### Globbing
|
25
|
+
|
26
|
+
Globbing should be supported to make things convenient.
|
27
|
+
|
28
|
+
```rb
|
29
|
+
Styledown.parse([
|
30
|
+
Rails.root.join('app/assets/stylesheets/*/*.less')
|
31
|
+
])
|
32
|
+
```
|
33
|
+
|
34
|
+
### Controller integration
|
35
|
+
|
36
|
+
There should be better Rails integration later on. It'd be nice to be able to
|
37
|
+
simplify controller integration like so. (This should take caching into
|
38
|
+
consideration)
|
39
|
+
|
40
|
+
```rb
|
41
|
+
module StyleguidesController
|
42
|
+
layout 'styleguide'
|
43
|
+
|
44
|
+
def show
|
45
|
+
render styleguide: CSS_PATHS
|
46
|
+
end
|
47
|
+
|
48
|
+
CSS_PATHS = [
|
49
|
+
'app/assets/stylesheets/components/*',
|
50
|
+
'app/assets/stylesheets/overrides/*',
|
51
|
+
'app/assets/stylesheets/foobar/*',
|
52
|
+
]
|
53
|
+
end
|
54
|
+
```
|
55
|
+
|
56
|
+
### Generator
|
57
|
+
|
58
|
+
It'd be nice to do `rails g styledown:install` and have these things in place:
|
59
|
+
|
60
|
+
```rb
|
61
|
+
# config/routes.rb
|
62
|
+
get '/styleguides' => 'styleguides#show'
|
63
|
+
```
|
64
|
+
|
65
|
+
```rb
|
66
|
+
# app/controllers/styleguides_controller.rb
|
67
|
+
module StyleguidesController
|
68
|
+
# ... see above
|
69
|
+
end
|
70
|
+
```
|
71
|
+
|
72
|
+
```html
|
73
|
+
<!-- app/views/layouts/styleguide.html.erb -->
|
74
|
+
<html>
|
75
|
+
<head>
|
76
|
+
<meta charset='utf-8'>
|
77
|
+
</head>
|
78
|
+
<body>
|
79
|
+
<%= yield %>
|
80
|
+
</body>
|
81
|
+
</html>
|
82
|
+
```
|
data/Rakefile
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
require 'rake'
|
2
2
|
require 'rake/testtask'
|
3
|
-
|
3
|
+
|
4
4
|
Rake::TestTask.new do |t|
|
5
5
|
t.test_files = Dir.glob('test/**/*test.rb')
|
6
6
|
end
|
7
|
+
|
8
|
+
task :default => :test
|
7
9
|
|
8
|
-
|
10
|
+
desc "Updates styledown.js"
|
11
|
+
task :update do
|
12
|
+
system "wget https://github.com/styledown/styledown/raw/master/dist/styledown.js -O vendor/dist/styledown.js"
|
13
|
+
end
|
data/lib/styledown/version.rb
CHANGED
data/lib/styledown.rb
CHANGED
@@ -12,8 +12,10 @@ module Styledown
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
def parse(source, options
|
16
|
-
|
15
|
+
def parse(source, options={})
|
16
|
+
if array_of_filenames?(source)
|
17
|
+
source = unpack_files(source)
|
18
|
+
end
|
17
19
|
|
18
20
|
context.call('Styledown.parse', source, options)
|
19
21
|
end
|
@@ -22,7 +24,7 @@ module Styledown
|
|
22
24
|
context.eval('Styledown.version')
|
23
25
|
end
|
24
26
|
|
25
|
-
|
27
|
+
private
|
26
28
|
|
27
29
|
def unpack_files(source)
|
28
30
|
source.map { |file| { name: file, data: File.read(file) } }
|
data/test/test.rb
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
require File.expand_path('../test_helper', __FILE__)
|
2
2
|
|
3
|
-
describe
|
4
|
-
it
|
3
|
+
describe "Styledown.js_version" do
|
4
|
+
it "produces a string" do
|
5
5
|
Styledown.js_version.must_match /^\d+\.\d+\.\d+/
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
9
|
-
describe
|
9
|
+
describe "Basic parsing" do
|
10
10
|
before do
|
11
11
|
@output = Styledown.parse('### hi')
|
12
12
|
end
|
13
13
|
|
14
|
-
it
|
14
|
+
it "produces an HTML fragment" do
|
15
15
|
@output.must_match /<h3[^>]+>hi<\/h3>/
|
16
16
|
end
|
17
17
|
|
@@ -20,19 +20,19 @@ describe 'Basic parsing' do
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
describe
|
23
|
+
describe "Working with many files" do
|
24
24
|
before do
|
25
25
|
@output = Styledown.parse([
|
26
|
-
{ name
|
27
|
-
{ name
|
26
|
+
{ :name => "input.md", :data => "### hi from md" },
|
27
|
+
{ :name => "input.css", :data => "/**\n * hi from css:\n * world\n */" }
|
28
28
|
])
|
29
29
|
end
|
30
30
|
|
31
|
-
it
|
31
|
+
it "parses the Markdown file" do
|
32
32
|
@output.must_match /<h3[^>]+>hi from md<\/h3>/
|
33
33
|
end
|
34
34
|
|
35
|
-
it
|
35
|
+
it "parses the CSS file" do
|
36
36
|
@output.must_match /<h3[^>]+>hi from css<\/h3>/
|
37
37
|
end
|
38
38
|
end
|
@@ -42,11 +42,11 @@ describe 'head options' do
|
|
42
42
|
@output = Styledown.parse('### hi', head: '<meta>')
|
43
43
|
end
|
44
44
|
|
45
|
-
it
|
45
|
+
it "includes the head text" do
|
46
46
|
@output.must_match /<meta>/
|
47
47
|
end
|
48
48
|
|
49
|
-
it
|
49
|
+
it "produces an HTML document" do
|
50
50
|
@output.must_match /^<!doctype html>/
|
51
51
|
end
|
52
52
|
end
|
data/test/test_helper.rb
CHANGED
@@ -4,17 +4,17 @@ require './lib/styledown'
|
|
4
4
|
begin
|
5
5
|
require 'minitest/reporters'
|
6
6
|
if ENV['reporter'] == 'spec'
|
7
|
-
Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new(color
|
7
|
+
Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new(:color => true)
|
8
8
|
else
|
9
9
|
Minitest::Reporters.use! Minitest::Reporters::ProgressReporter.new
|
10
10
|
end
|
11
11
|
rescue LoadError => e
|
12
12
|
end
|
13
13
|
|
14
|
-
def test_path(path
|
14
|
+
def test_path(path='')
|
15
15
|
File.expand_path("../#{path}", __FILE__)
|
16
16
|
end
|
17
17
|
|
18
|
-
def fixture_path(path
|
18
|
+
def fixture_path(path='')
|
19
19
|
test_path "fixtures/#{path}"
|
20
20
|
end
|