ristretto 0.0.1 → 0.0.2
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 +4 -4
- data/lib/ristretto.rb +2 -2
- data/lib/ristretto/version.rb +1 -1
- data/ristretto-0.0.1.gem +0 -0
- data/specs/ristretto_spec.rb +13 -5
- data/specs/specification.md +42 -0
- metadata +4 -3
- data/specs/markdown/indented_codeblocks.md +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eaeeaea9a3cdae764b9dd7d0ccb82228ac92c24d
|
4
|
+
data.tar.gz: 56109bf00339872fbf2b55e0739c1c89c9829f78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2aed50ca43f6b7e5496a3c560dad5eb2f22a6701d3c9c703781156ef3fcfeee4c20ddae5809672b9ce668bdcb5aa6d67f0eea3ca6bbddc524f11c5190585e7e3
|
7
|
+
data.tar.gz: 609e648df4b517d8c5df4dc85d2ea9ff70df67ace62350ff305629d3f2de7b8a10e62353017d9784188b9af71c60049f4acc38bc3014e0bd6c675d131ec89c56
|
data/lib/ristretto.rb
CHANGED
@@ -3,13 +3,13 @@ require "ristretto/version"
|
|
3
3
|
module Ristretto
|
4
4
|
def self.parse(file)
|
5
5
|
ruby = ''
|
6
|
-
File.read(file).gsub /^ (
|
6
|
+
File.read(file).gsub /^ ([^-+*$].*?)$/ do |match|
|
7
7
|
ruby << $1 << "\n"
|
8
8
|
end
|
9
9
|
ruby.strip
|
10
10
|
end
|
11
11
|
|
12
12
|
def self.execute(source)
|
13
|
-
|
13
|
+
instance_eval source
|
14
14
|
end
|
15
15
|
end
|
data/lib/ristretto/version.rb
CHANGED
data/ristretto-0.0.1.gem
ADDED
Binary file
|
data/specs/ristretto_spec.rb
CHANGED
@@ -3,17 +3,25 @@ require 'minitest/autorun'
|
|
3
3
|
|
4
4
|
describe Ristretto do
|
5
5
|
|
6
|
-
let(:
|
6
|
+
let(:parsed_markdown) { Ristretto.parse('specs/specification.md') }
|
7
7
|
|
8
8
|
describe "#execute" do
|
9
|
-
it "executes
|
10
|
-
Ristretto.execute(
|
9
|
+
it "executes simple ruby code" do
|
10
|
+
Ristretto.execute(parsed_markdown).must_equal "Hello, Ristretto!"
|
11
11
|
end
|
12
|
+
|
13
|
+
it "can cope with unbound methods"
|
14
|
+
|
15
|
+
it "parsed required ristretto files"
|
12
16
|
end
|
13
17
|
|
14
18
|
describe "#parse" do
|
15
|
-
it "parses markdown
|
16
|
-
|
19
|
+
it "parses markdown according to the Ristretto specification" do
|
20
|
+
parsed_markdown.must_equal "welcome = \"Hello, Ristretto!\"\n# comments\nwelcome"
|
17
21
|
end
|
22
|
+
|
23
|
+
it "groks tabbed indents"
|
24
|
+
|
25
|
+
it "parses backticked codeblocks"
|
18
26
|
end
|
19
27
|
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# The Ristretto Specification
|
2
|
+
|
3
|
+
This specification doubles the code test for the Ristretto gem.
|
4
|
+
|
5
|
+
## Indented Codeblocks
|
6
|
+
|
7
|
+
Ristretto should parse indented code blocks. By default, anything inside them will be treated like ruby.
|
8
|
+
|
9
|
+
welcome = "Hello, Ristretto!"
|
10
|
+
|
11
|
+
## Multiple Codeblocks
|
12
|
+
|
13
|
+
Multiple blocks should be parsed into a single string with the line termination `\n` character appended after each block.
|
14
|
+
|
15
|
+
# comments
|
16
|
+
welcome
|
17
|
+
|
18
|
+
The last resulting code string should be stripped of trailing whitespace.
|
19
|
+
|
20
|
+
## Tabbed Codelocks
|
21
|
+
|
22
|
+
TODO
|
23
|
+
|
24
|
+
## Fenced Codeblocks
|
25
|
+
|
26
|
+
TODO
|
27
|
+
|
28
|
+
## Lists
|
29
|
+
|
30
|
+
One thing Ristretto shouldn't do is parse indented lists.
|
31
|
+
|
32
|
+
- List like these
|
33
|
+
- but with sublists 4 or more spaces in.
|
34
|
+
+ starting with any of the markdown list markers `-`, `+`, or `*`.
|
35
|
+
|
36
|
+
* and even those with a preceding blank line.
|
37
|
+
|
38
|
+
## Non Ruby Code
|
39
|
+
|
40
|
+
Somethimes, you might need to include more than just Ruby in a codeblock. As such, Ristretto should ignore specific types of code such as shell or bash indicated by `$`
|
41
|
+
|
42
|
+
$ youknown -? like this
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ristretto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dave Kinkead
|
@@ -54,9 +54,10 @@ files:
|
|
54
54
|
- lib/ristretto.rb
|
55
55
|
- lib/ristretto/version.rb
|
56
56
|
- readme.md
|
57
|
+
- ristretto-0.0.1.gem
|
57
58
|
- ristretto.gemspec
|
58
|
-
- specs/markdown/indented_codeblocks.md
|
59
59
|
- specs/ristretto_spec.rb
|
60
|
+
- specs/specification.md
|
60
61
|
homepage: https://github.com/davekinkead/ristretto
|
61
62
|
licenses:
|
62
63
|
- MIT
|
@@ -82,5 +83,5 @@ signing_key:
|
|
82
83
|
specification_version: 4
|
83
84
|
summary: Literate Ruby inspired by Coffeescript
|
84
85
|
test_files:
|
85
|
-
- specs/markdown/indented_codeblocks.md
|
86
86
|
- specs/ristretto_spec.rb
|
87
|
+
- specs/specification.md
|