markdown 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +3 -3
- data/lib/markdown.rb +1 -1
- data/lib/markdown/config.rb +13 -12
- metadata +13 -13
data/Rakefile
CHANGED
@@ -14,9 +14,9 @@ Hoe.spec 'markdown' do
|
|
14
14
|
self.email = 'webslideshow@googlegroups.com'
|
15
15
|
|
16
16
|
self.extra_deps = [
|
17
|
-
['props','>= 0.
|
18
|
-
['textutils','>=0.
|
19
|
-
['kramdown','>= 0.13.
|
17
|
+
['props','>= 0.2.0'],
|
18
|
+
['textutils','>=0.2.0'],
|
19
|
+
['kramdown','>= 0.13.7']
|
20
20
|
]
|
21
21
|
|
22
22
|
# switch extension to .markdown for gihub formatting
|
data/lib/markdown.rb
CHANGED
data/lib/markdown/config.rb
CHANGED
@@ -37,23 +37,24 @@ DEFAULTS = { 'libs' => [
|
|
37
37
|
'fenced_code_blocks',
|
38
38
|
'tables',
|
39
39
|
'strikethrough' ] }, # todo/fix: merge nested hash??
|
40
|
-
'filters' => [
|
40
|
+
'filters' => [
|
41
|
+
'comments-percent-style' ] # optional (preprocessing) text filters: e.g. comments-percent-style, skip-end-directive, etc. (see textutils gem)
|
41
42
|
}
|
42
43
|
|
43
44
|
|
44
45
|
def initialize
|
45
46
|
@props = @props_default = Props.new( DEFAULTS, 'DEFAULTS' )
|
46
47
|
|
47
|
-
# check for user settings (markdown.yml) in home folder
|
48
|
+
# check for user settings (markdown.yml) in home folder
|
48
49
|
|
49
50
|
## todo: use .markdown.yml?? or differnt name ??
|
50
|
-
props_home_file = File.join( Env.home, 'markdown.yml' )
|
51
|
+
props_home_file = File.join( Env.home, 'markdown.yml' )
|
51
52
|
if File.exists?( props_home_file )
|
52
53
|
puts "Loading settings from '#{props_home_file}'..."
|
53
54
|
@props = @props_home = Props.load_file( props_home_file, @props )
|
54
55
|
end
|
55
56
|
|
56
|
-
# check for user settings (markdown.yml) in working folder
|
57
|
+
# check for user settings (markdown.yml) in working folder
|
57
58
|
|
58
59
|
props_work_file = File.join( '.', 'markdown.yml' )
|
59
60
|
if File.exists?( props_work_file )
|
@@ -78,7 +79,7 @@ DEFAULTS = { 'libs' => [
|
|
78
79
|
# returns an array of known markdown engines e.g.
|
79
80
|
# [ 'pandoc-ruby', 'rdiscount', 'rpeg-markdown', 'maruku', 'bluecloth', 'kramdown' ]
|
80
81
|
|
81
|
-
## todo: allow single lib para instead of libs
|
82
|
+
## todo: allow single lib para instead of libs
|
82
83
|
## todo: allow ENV setting markdown_[select]_lib=xxxx
|
83
84
|
|
84
85
|
## todo/fix: use lookup with config parent cascade
|
@@ -89,13 +90,13 @@ DEFAULTS = { 'libs' => [
|
|
89
90
|
## 2) lib property (single markdown engine)
|
90
91
|
## 3) libs property (first-come first-serve markdown engine list)
|
91
92
|
|
92
|
-
user_lib = Env.markdown_lib || @props.fetch( 'lib', nil )
|
93
|
+
user_lib = Env.markdown_lib || @props.fetch( 'lib', nil )
|
93
94
|
|
94
|
-
if user_lib.nil?
|
95
|
+
if user_lib.nil?
|
95
96
|
user_libs = @props.fetch( 'libs', nil )
|
96
97
|
else
|
97
98
|
[ user_lib ] # return as array (wrap single lib entry)
|
98
|
-
end
|
99
|
+
end
|
99
100
|
end
|
100
101
|
|
101
102
|
|
@@ -109,7 +110,7 @@ DEFAULTS = { 'libs' => [
|
|
109
110
|
require lib
|
110
111
|
@libs << lib
|
111
112
|
rescue LoadError => ex
|
112
|
-
## todo: use logger.debug instead of puts
|
113
|
+
## todo: use logger.debug instead of puts
|
113
114
|
puts "Markdown library #{lib} not found. Use gem install #{lib} to install."
|
114
115
|
end
|
115
116
|
end
|
@@ -122,15 +123,15 @@ DEFAULTS = { 'libs' => [
|
|
122
123
|
end
|
123
124
|
|
124
125
|
def markdown_lib_defaults
|
126
|
+
## todo: return props ? that acts like a hash?? (lets us support section lookup without deep merge???)
|
125
127
|
opts = @props.fetch( @libs.first, {} )
|
126
128
|
end
|
127
129
|
|
128
130
|
def markdown_to_html_method
|
129
131
|
lib = @libs.first
|
130
|
-
|
131
|
-
method = opts.fetch( 'converter', "#{lib.downcase}_to_html" ) # default to <lib>_to_html if converter prop not found
|
132
|
+
method = @props.fetch_from_section( lib, 'converter', "#{lib.downcase}_to_html" ) # default to <lib>_to_html if converter prop not found
|
132
133
|
method.tr('-','_').to_sym
|
133
|
-
end
|
134
|
+
end
|
134
135
|
|
135
136
|
end # class Config
|
136
137
|
end # module Markdown
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: markdown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 4
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.4.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Gerald Bauer
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-06-
|
18
|
+
date: 2012-06-10 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: props
|
@@ -25,12 +25,12 @@ dependencies:
|
|
25
25
|
requirements:
|
26
26
|
- - ">="
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
hash:
|
28
|
+
hash: 23
|
29
29
|
segments:
|
30
30
|
- 0
|
31
|
-
-
|
31
|
+
- 2
|
32
32
|
- 0
|
33
|
-
version: 0.
|
33
|
+
version: 0.2.0
|
34
34
|
type: :runtime
|
35
35
|
version_requirements: *id001
|
36
36
|
- !ruby/object:Gem::Dependency
|
@@ -41,12 +41,12 @@ dependencies:
|
|
41
41
|
requirements:
|
42
42
|
- - ">="
|
43
43
|
- !ruby/object:Gem::Version
|
44
|
-
hash:
|
44
|
+
hash: 23
|
45
45
|
segments:
|
46
46
|
- 0
|
47
|
-
-
|
47
|
+
- 2
|
48
48
|
- 0
|
49
|
-
version: 0.
|
49
|
+
version: 0.2.0
|
50
50
|
type: :runtime
|
51
51
|
version_requirements: *id002
|
52
52
|
- !ruby/object:Gem::Dependency
|
@@ -57,12 +57,12 @@ dependencies:
|
|
57
57
|
requirements:
|
58
58
|
- - ">="
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
hash:
|
60
|
+
hash: 37
|
61
61
|
segments:
|
62
62
|
- 0
|
63
63
|
- 13
|
64
|
-
-
|
65
|
-
version: 0.13.
|
64
|
+
- 7
|
65
|
+
version: 0.13.7
|
66
66
|
type: :runtime
|
67
67
|
version_requirements: *id003
|
68
68
|
- !ruby/object:Gem::Dependency
|