md_transformer 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/CHANGELOG.md +3 -0
- data/lib/md_transformer/markdown.rb +8 -0
- data/lib/md_transformer/version.rb +1 -1
- metadata +2 -3
- data/Gemfile.lock +0 -55
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d190a670ee64b5d6ac8368b271310b6719560505d8f36be19892f98918dfc4a
|
4
|
+
data.tar.gz: 217d3aad8ddb626f87d09ec4d4e76309e2026be458ebe32fb9c30e44eb1e0234
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80b6a5999e0dce18a1b0cff445a7bb643a47851043644d527f568966b7221e0e8fffebe86e6e4cec587d7d7819029a823d1d12137ab0cd8d20207f16d5e2e799
|
7
|
+
data.tar.gz: 354394988445b4dc14b19b2c6eefabb37e52bf76b2a74f62d31d7d23b7275de4187e7bf470323eb685d93bdefab8ca69964b24cc95c88145c434be5674cb79a0
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -38,6 +38,7 @@ module MdTransformer
|
|
38
38
|
source = File.read(source)
|
39
39
|
@title ||= options[:file]
|
40
40
|
end
|
41
|
+
source = translate(source)
|
41
42
|
parse!(source)
|
42
43
|
end
|
43
44
|
|
@@ -178,6 +179,13 @@ module MdTransformer
|
|
178
179
|
child
|
179
180
|
end
|
180
181
|
|
182
|
+
# Translates content to markdown prior to parsing
|
183
|
+
# @param content [String] the string Markdown content to translate
|
184
|
+
# @return [String] the translated content
|
185
|
+
def translate(content)
|
186
|
+
content.gsub(%r{<h([1-6])>(.*?)</h[1-6]>}m) { '#' * Regexp.last_match[1].to_i + ' ' + Regexp.last_match[2] }
|
187
|
+
end
|
188
|
+
|
181
189
|
# Parses the provided markdown string content into a the current object's content and children
|
182
190
|
# @param content [String] the string Markdown content to parse
|
183
191
|
def parse!(content)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: md_transformer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- wheatevo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-04-
|
11
|
+
date: 2019-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -94,7 +94,6 @@ files:
|
|
94
94
|
- ".travis.yml"
|
95
95
|
- CHANGELOG.md
|
96
96
|
- Gemfile
|
97
|
-
- Gemfile.lock
|
98
97
|
- LICENSE.txt
|
99
98
|
- README.md
|
100
99
|
- Rakefile
|
data/Gemfile.lock
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
md_transformer (0.1.0)
|
5
|
-
|
6
|
-
GEM
|
7
|
-
remote: https://rubygems.org/
|
8
|
-
specs:
|
9
|
-
ast (2.4.0)
|
10
|
-
diff-lcs (1.3)
|
11
|
-
jaro_winkler (1.5.2)
|
12
|
-
parallel (1.17.0)
|
13
|
-
parser (2.6.2.1)
|
14
|
-
ast (~> 2.4.0)
|
15
|
-
psych (3.1.0-x64-mingw32)
|
16
|
-
rainbow (3.0.0)
|
17
|
-
rake (10.5.0)
|
18
|
-
rspec (3.8.0)
|
19
|
-
rspec-core (~> 3.8.0)
|
20
|
-
rspec-expectations (~> 3.8.0)
|
21
|
-
rspec-mocks (~> 3.8.0)
|
22
|
-
rspec-core (3.8.0)
|
23
|
-
rspec-support (~> 3.8.0)
|
24
|
-
rspec-expectations (3.8.2)
|
25
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
26
|
-
rspec-support (~> 3.8.0)
|
27
|
-
rspec-mocks (3.8.0)
|
28
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
29
|
-
rspec-support (~> 3.8.0)
|
30
|
-
rspec-support (3.8.0)
|
31
|
-
rubocop (0.67.2)
|
32
|
-
jaro_winkler (~> 1.5.1)
|
33
|
-
parallel (~> 1.10)
|
34
|
-
parser (>= 2.5, != 2.5.1.1)
|
35
|
-
psych (>= 3.1.0)
|
36
|
-
rainbow (>= 2.2.2, < 4.0)
|
37
|
-
ruby-progressbar (~> 1.7)
|
38
|
-
unicode-display_width (>= 1.4.0, < 1.6)
|
39
|
-
ruby-progressbar (1.10.0)
|
40
|
-
unicode-display_width (1.5.0)
|
41
|
-
yard (0.9.19)
|
42
|
-
|
43
|
-
PLATFORMS
|
44
|
-
x64-mingw32
|
45
|
-
|
46
|
-
DEPENDENCIES
|
47
|
-
bundler (~> 2.0)
|
48
|
-
md_transformer!
|
49
|
-
rake (~> 10.0)
|
50
|
-
rspec (~> 3.0)
|
51
|
-
rubocop (~> 0.67)
|
52
|
-
yard (~> 0.9)
|
53
|
-
|
54
|
-
BUNDLED WITH
|
55
|
-
2.0.1
|